omark807 commited on
Commit
5a45c2e
verified
1 Parent(s): f0ea920

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -4
README.md CHANGED
@@ -3,12 +3,111 @@ license: gpl
3
  language:
4
  - en
5
  base_model:
6
- - litert-community/Gemma3-1B-IT
7
  tags:
8
  - accessibility
9
- - code
 
 
10
  datasets:
11
  - omark807/web_a11y_dataset
12
  metrics:
13
- - accuracy
14
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  language:
4
  - en
5
  base_model:
6
+ - google/gemma-3-1b-it
7
  tags:
8
  - accessibility
9
+ - question-answering
10
+ - fine-tuning
11
+ - llm
12
  datasets:
13
  - omark807/web_a11y_dataset
14
  metrics:
15
+ - eval_loss # Changed from 'accuracy' to reflect actual metric
16
+ ---
17
+ # Model Card for omark807/gemma3-finetuned-web-accessibility
18
+
19
+ This model is a fine-tuned version of Google's Gemma 1B-IT, adapted for the task of answering questions related to web accessibility, WCAG (Web Content Accessibility Guidelines) principles, and general digital accessibility best practices. It was fine-tuned using the LoRA (Low-Rank Adaptation) method.
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+
25
+ This model is a Causal Language Model (`AutoModelForCausalLM`) fine-tuned from `google/gemma-3-1b-it`. Its primary function is to serve as a conversational assistant for queries concerning web accessibility. It processes user questions about accessibility guidelines and concepts (e.g., alt text, color contrast, keyboard navigation) and generates informative answers based on the patterns learned from its fine-tuning dataset.
26
+
27
+ - **Developed by:** mkhan259 (via this collaborative troubleshooting session)
28
+ - **Shared by:** omark807
29
+ - **Model type:** Causal Language Model (Fine-tuned via PEFT/LoRA)
30
+ - **Language(s) (NLP):** English
31
+ - **License:** GPL
32
+ - **Finetuned from model:** [google/gemma-3-1b-it](https://huggingface.co/google/gemma-3-1b-it)
33
+
34
+ ### Model Sources
35
+
36
+ - **Repository:** (Link to your GitHub repository under `xability/gemma3-finetune-example`)
37
+ - **Base Model on Hugging Face:** [https://huggingface.co/google/gemma-3-1b-it](https://huggingface.co/google/gemma-3-1b-it)
38
+
39
+ ## Uses
40
+
41
+ ### Direct Use
42
+
43
+ This model is intended for direct use as a conversational agent or a knowledge base query system for specific questions about digital accessibility. Potential users include web developers, designers, accessibility auditors, or anyone seeking quick information about WCAG guidelines and their implementation.
44
+
45
+ ### Downstream Use
46
+
47
+ This model could potentially be integrated into:
48
+ - Accessibility testing tools to provide explanations for detected issues.
49
+ - Chatbots on accessibility resource websites.
50
+ - Educational platforms teaching web accessibility.
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ This model is **not intended** for:
55
+ - Providing legal advice or certifications regarding accessibility compliance.
56
+ - Diagnosing user disabilities.
57
+ - Generating content unrelated to web accessibility.
58
+ - Generating harmful, biased, or unethical content.
59
+ - Substituting professional accessibility audits or human expertise.
60
+
61
+ ## Bias, Risks, and Limitations
62
+
63
+ - **Data Limitations:** The model's knowledge is limited to the `omark807/web_a11y_dataset` (73 samples for training, 15 for evaluation). It may not cover all aspects of web accessibility comprehensively, nor may it respond accurately to questions outside the scope of its training data. Its responses are highly dependent on the quality and breadth of this specific dataset.
64
+ - **Generalization:** Due to the relatively small dataset size, the model's ability to generalize to new or complex accessibility questions beyond the training examples may be limited.
65
+ - **Bias Inheritance:** The model inherits potential biases present in its base model (`google/gemma-3-1b-it`) and any biases inadvertently introduced through the fine-tuning dataset.
66
+ - **Factual Accuracy:** While fine-tuned on factual data, LLMs can still "hallucinate" or provide inaccurate information. Users should cross-reference critical information.
67
+ - **No Human Evaluation:** The evaluation performed is quantitative (loss-based), not qualitative or human-based, which is important for conversational models.
68
+
69
+ ### Recommendations
70
+
71
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. For critical applications or for definitive answers, always consult official WCAG documentation, accessibility experts, or perform thorough manual audits.
72
+
73
+ ## How to Get Started with the Model
74
+
75
+ Use the code below to get started with the model.
76
+
77
+ ```python
78
+ from transformers import AutoModelForCausalLM, AutoTokenizer
79
+ import torch
80
+
81
+ # Replace 'omark807' with your actual username/organization if different
82
+ model_id = "omark807/gemma3-finetuned-web-accessibility" # This will be the ID on Hugging Face Hub
83
+
84
+ # Load tokenizer
85
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
86
+
87
+ # Load the model. Adjust load_in_4bit and torch_dtype based on your GPU and desired precision.
88
+ # Model was trained in float16 due to bitsandbytes import failure.
89
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
90
+ # Or, if you want to try 4-bit inference (requires bitsandbytes to work):
91
+ # from bitsandbytes import BitsAndBytesConfig
92
+ # bnb_config_inference = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16)
93
+ # model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config_inference, device_map="auto")
94
+
95
+ # Example prompt following Gemma's instruction format
96
+ prompt = "<start_of_turn>user\nWhat is the purpose of alt text in images?<end_of_turn>\n<start_of_turn>model\n"
97
+
98
+ # Tokenize input
99
+ input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
100
+
101
+ # Generate response
102
+ outputs = model.generate(
103
+ **input_ids,
104
+ max_new_tokens=256,
105
+ num_return_sequences=1,
106
+ do_sample=True, # Recommended for more varied responses
107
+ top_p=0.9, # Top-p sampling
108
+ temperature=0.7 # Sampling temperature
109
+ )
110
+
111
+ # Decode and print response
112
+ response = tokenizer.decode(outputs[0], skip_special_tokens=False)
113
+ print(response)