vishal1d commited on
Commit
9fd4ce4
·
verified ·
1 Parent(s): 7b1d092

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +179 -85
README.md CHANGED
@@ -1,199 +1,293 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
 
9
 
 
 
10
 
11
 
12
  ## Model Details
 
 
 
 
 
 
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
  ### Direct Use
41
 
42
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
 
 
43
 
44
- [More Information Needed]
45
 
46
  ### Downstream Use [optional]
47
 
48
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
 
 
49
 
50
- [More Information Needed]
51
 
52
  ### Out-of-Scope Use
53
 
54
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
 
63
 
64
- ### Recommendations
 
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
 
 
 
69
 
70
- ## How to Get Started with the Model
 
 
71
 
72
- Use the code below to get started with the model.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- [More Information Needed]
75
 
76
  ## Training Details
77
 
 
 
 
 
 
 
 
 
 
 
78
  ### Training Data
79
 
80
  <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
- [More Information Needed]
83
 
84
  ### Training Procedure
85
 
86
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
 
 
 
 
87
 
88
- #### Preprocessing [optional]
89
 
90
- [More Information Needed]
 
91
 
 
92
 
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
- ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
 
107
  ### Testing Data, Factors & Metrics
108
 
109
  #### Testing Data
110
 
111
  <!-- This should link to a Dataset Card if possible. -->
 
112
 
113
- [More Information Needed]
114
 
115
  #### Factors
116
 
117
  <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
 
 
 
 
118
 
119
- [More Information Needed]
120
 
121
  #### Metrics
122
 
123
  <!-- These are the evaluation metrics being used, ideally with a description of why. -->
 
124
 
125
- [More Information Needed]
126
 
127
- ### Results
128
 
129
- [More Information Needed]
130
 
131
- #### Summary
132
 
133
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
 
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
  ## Technical Specifications [optional]
 
154
 
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
166
 
167
- #### Software
168
 
169
- [More Information Needed]
170
 
171
- ## Citation [optional]
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
 
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
182
 
183
- ## Glossary [optional]
 
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
192
 
193
  ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
 
 
 
196
 
197
  ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - falcon
5
+ - peft
6
+ - lora
7
+ - imdb
8
+ - text-generation
9
+ datasets:
10
+ - imdb
11
+ base_model:
12
+ - tiiuae/falcon-rw-1b
13
+ pipeline_tag: text-generation
14
  ---
15
 
16
  # Model Card for Model ID
17
 
18
  <!-- Provide a quick summary of what the model is/does. -->
19
+ # 🦅 Falcon LoRA - IMDb Sentiment Generation
20
 
21
+ This model is a **LoRA fine-tuned version of [`tiiuae/falcon-rw-1b`](https://huggingface.co/tiiuae/falcon-rw-1b)** using the **IMDb movie review dataset**.
22
+ It's trained to generate sentiment-rich movie review completions from short prompts. LoRA (Low-Rank Adaptation) enables efficient fine-tuning with fewer resources.
23
 
24
 
25
  ## Model Details
26
+ **Base Model:** Falcon RW 1B (`tiiuae/falcon-rw-1b`)
27
+ - **Fine-Tuning Method:** Parameter-Efficient Fine-Tuning (LoRA via PEFT)
28
+ - **Dataset:** IMDb (1000 samples for demonstration)
29
+ - **Input Length:** 128 tokens
30
+ - **Training Framework:** 🤗 Transformers + PEFT
31
+ - **Trained on:** Google Colab (T4 GPU)
32
 
33
  ### Model Description
34
 
35
+ - **Developed by:** Vishal D.
36
+ - **Shared on Hugging Face Hub:** [`vishal1d/falcon-lora-imdb`](https://huggingface.co/vishal1d/falcon-lora-imdb)
37
+ - **Model Type:** Causal Language Model (AutoModelForCausalLM)
38
+ - **Language(s):** English
39
+ - **License:** Apache 2.0
40
+ - **Finetuned From:** [`tiiuae/falcon-rw-1b`](https://huggingface.co/tiiuae/falcon-rw-1b)
41
+ -
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ### Direct Use
44
 
45
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
46
+ You can use this model for:
47
+ - Generating sentiment-aware movie reviews
48
+ - NLP educational experiments
49
+ - Demonstrating LoRA fine-tuning in Transformers
50
 
 
51
 
52
  ### Downstream Use [optional]
53
 
54
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
55
+ This model can serve as a base for:
56
+ - Continued fine-tuning on other text datasets
57
+ - Training custom sentiment generation apps
58
+ - Teaching parameter-efficient fine-tuning methods
59
+
60
 
 
61
 
62
  ### Out-of-Scope Use
63
 
64
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
65
+ Avoid using this model for:
66
+ - Real-world sentiment classification (it generates, not classifies)
67
+ - Medical, legal, or safety-critical decision-making
68
+ - Non-English text (not trained or evaluated for multilingual use)
69
 
 
70
 
71
+ ## How to Get Started with the Model
72
 
73
+ Use the code below to get started with the model.
74
 
75
+ from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
76
+ from peft import PeftModel, PeftConfig
77
 
78
+ # LoRA adapter model ID on Hugging Face Hub
79
+ adapter_id = "vishal1d/falcon-lora-imdb"
80
 
81
+ # Load the adapter configuration
82
+ peft_config = PeftConfig.from_pretrained(adapter_id)
83
 
84
+ # Load the base Falcon model
85
+ base_model = AutoModelForCausalLM.from_pretrained(
86
+ peft_config.base_model_name_or_path,
87
+ trust_remote_code=True,
88
+ device_map="auto"
89
+ )
90
 
91
+ # Load the LoRA adapter on top of the base model
92
+ model = PeftModel.from_pretrained(base_model, adapter_id)
93
+ model.eval()
94
 
95
+ # Load the tokenizer
96
+ tokenizer = AutoTokenizer.from_pretrained(peft_config.base_model_name_or_path, trust_remote_code=True)
97
+ tokenizer.pad_token = tokenizer.eos_token
98
+
99
+ # Create a text generation pipeline
100
+ generator = pipeline(
101
+ "text-generation",
102
+ model=model,
103
+ tokenizer=tokenizer,
104
+ max_new_tokens=100,
105
+ do_sample=True,
106
+ temperature=0.8,
107
+ top_k=50,
108
+ top_p=0.95
109
+ )
110
+
111
+ # Example prompt
112
+ prompt = "The movie was absolutely wonderful because"
113
+ output = generator(prompt)
114
+
115
+ # Display the generated text
116
+ print(output[0]["generated_text"])
117
 
 
118
 
119
  ## Training Details
120
 
121
+ - **LoRA Config:**
122
+ - `r=8`
123
+ - `lora_alpha=16`
124
+ - `lora_dropout=0.1`
125
+ - `target_modules=["query_key_value"]`
126
+ - **Batch Size:** 2 (with gradient_accumulation=4)
127
+ - **Epochs:** 1 (demo purpose)
128
+ - **Precision:** FP16
129
+ - **Training Samples:** 1000 IMDb reviews
130
+
131
  ### Training Data
132
 
133
  <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
134
+ The model was fine-tuned on the IMDb dataset, a large-scale dataset containing 50,000 movie reviews labeled as positive or negative.
135
+
136
+ For demonstration and quick experimentation, only 1000 samples from the IMDb train split were used.
137
+
138
+ Dataset Card: IMDb on Hugging Face
139
+
140
+ Format: Text classification (binary sentiment)
141
+
142
+ Preprocessing:
143
+
144
+ Tokenized using tiiuae/falcon-rw-1b tokenizer
145
+
146
+ Max input length: 128 tokens
147
+
148
+ Labels were set as input_ids for causal language modeling
149
 
 
150
 
151
  ### Training Procedure
152
 
153
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
154
+ Preprocessing
155
+ Tokenized each review using Falcon's tokenizer
156
+
157
+ Truncated/padded to max length of 128
158
 
159
+ Used causal language modeling: labels = input_ids (predict next token)
160
 
161
+ Training Hyperparameters
162
+ Model: tiiuae/falcon-rw-1b
163
 
164
+ Fine-tuning method: LoRA (Low-Rank Adaptation) via PEFT
165
 
166
+ LoRA Config:
167
 
168
+ r=8, lora_alpha=16, lora_dropout=0.1
169
 
170
+ Target module: "query_key_value"
171
 
172
+ Training Args:
173
 
174
+ per_device_train_batch_size=2
175
+
176
+ gradient_accumulation_steps=4
177
+
178
+ num_train_epochs=1
179
+
180
+ fp16=True
181
+
182
+ Frameworks: 🤗 Transformers, PEFT, Datasets, Trainer
183
+
184
+ Speeds, Sizes, Times
185
+ GPU used: Google Colab (Tesla T4, 16GB)
186
+
187
+ Training time: ~10–15 minutes for 1 epoch on 1000 samples
188
+
189
+ Checkpoint size (adapter only): ~6.3 MB (adapter_model.safetensors)
190
 
 
191
 
 
192
 
193
  ### Testing Data, Factors & Metrics
194
 
195
  #### Testing Data
196
 
197
  <!-- This should link to a Dataset Card if possible. -->
198
+ Evaluation was done interactively using text prompts. No quantitative metrics were used since the model was trained for demo-scale.
199
 
 
200
 
201
  #### Factors
202
 
203
  <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
204
+ Prompt completion
205
+
206
+ Sentiment alignment
207
+
208
+ Fluency of generated text
209
 
 
210
 
211
  #### Metrics
212
 
213
  <!-- These are the evaluation metrics being used, ideally with a description of why. -->
214
+ Evaluation was qualitative, based on prompt completions. Since this model was trained on only 1000 IMDb samples for demonstration, we evaluated it by:
215
 
216
+ Text Coherence: Does the output form grammatically valid sentences?
217
 
218
+ Sentiment Appropriateness: Does the generated output reflect the sentiment implied by the prompt?
219
 
220
+ Relevance: Is the continuation logically connected to the prompt?
221
 
222
+ No quantitative metrics (like accuracy, BLEU, ROUGE) were computed due to the generative nature of the task.
223
 
224
 
225
+ ### Results
226
 
227
+ The model successfully generated fluent, sentiment-aware text completions for short prompts like:
228
 
229
+ Prompt: "The movie was absolutely wonderful because"
230
+ Output: "...it had brilliant performances, touching moments, and a truly powerful story that left the audience in awe."
231
 
232
+ These results show that the model can be useful for sentiment-rich text generation, even with limited training data.
233
 
234
+ #### Summary
235
 
236
+ Even with only 1000 IMDb samples, the model can produce sentiment-aligned completions.
237
 
238
+ LoRA fine-tuning was efficient and lightweight.
239
 
240
+ Best used for experimentation or small-scale inference.
 
 
 
 
241
 
242
  ## Technical Specifications [optional]
243
+ Model architecture: Falcon-RW-1B (decoder-only transformer)
244
 
245
+ Fine-tuning: LoRA (Low-Rank Adaptation)
 
 
246
 
247
+ Precision: Mixed precision (fp16)
248
 
249
+ Tokenizer: tiiuae/falcon-rw-1b tokenizer
250
 
251
+ Frameworks Used: Hugging Face Transformers, Datasets, PEFT
252
 
253
+ ### Model Architecture and Objective
254
 
255
+ This model uses the tiiuae/falcon-rw-1b architecture, which is a decoder-only transformer similar to GPT. The objective is causal language modeling, where the model predicts the next token given all previous tokens.
256
 
257
+ During fine-tuning, Low-Rank Adaptation (LoRA) was used to efficiently adjust a small number of weights (via low-rank updates) while keeping the base model frozen.
258
 
259
+ ### Compute Infrastructure
260
 
 
261
 
262
+ #### Hardware
263
 
264
+ Hardware
265
+ GPU: NVIDIA Tesla T4 (16 GB VRAM)
266
 
267
+ Platform: Google Colab
268
 
269
+ #### Software
270
 
271
+ Software
272
+ Python Version: 3.10
273
 
274
+ PyTorch: 2.7.1
275
 
276
+ Transformers: 4.52.4
277
 
278
+ PEFT: 0.15.2
279
 
280
+ BitsAndBytes: 0.46.0 (if used for quantization)
281
 
282
  ## Model Card Authors [optional]
283
 
284
+ Vishal D. – Model fine-tuning and publication
285
+
286
+ Based on Falcon-RW-1B by TII UAE
287
+ ]
288
 
289
  ## Model Card Contact
290
 
291
+ 📧 Email: tvishal810@gmail,com
292
+
293
+ 🧠 Hugging Face: vishal1d