Update README.md
Browse files
README.md
CHANGED
@@ -3,200 +3,115 @@ base_model: distilgpt2
|
|
3 |
library_name: peft
|
4 |
---
|
5 |
|
6 |
-
# Model Card for
|
7 |
|
8 |
-
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
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 |
-
|
|
|
|
|
29 |
|
30 |
-
|
31 |
|
32 |
-
-
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
|
|
45 |
|
46 |
-
|
|
|
47 |
|
48 |
-
|
|
|
49 |
|
50 |
-
|
|
|
51 |
|
52 |
-
|
|
|
53 |
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
-
|
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 |
-
|
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 |
-
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
|
|
|
|
130 |
|
131 |
-
|
132 |
|
|
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
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]
|
200 |
-
### Framework versions
|
201 |
|
202 |
- PEFT 0.13.2
|
|
|
3 |
library_name: peft
|
4 |
---
|
5 |
|
6 |
+
# Model Card for `gautam-raj/fine-tuned-distilgpt2`
|
7 |
|
8 |
+
## Model Description
|
9 |
|
10 |
+
This model is a fine-tuned version of the `distilgpt2` model, trained using the Alpaca dataset. It has been optimized for generating text based on instructions and responses, designed to assist in tasks where conversational text generation is required.
|
11 |
|
12 |
+
## Model Architecture
|
13 |
|
14 |
+
The model is based on `distilgpt2`, a smaller, distilled version of GPT-2 (Generative Pretrained Transformer 2). DistilGPT2 maintains a balance between efficiency and performance, making it suitable for applications with resource constraints. The model has been fine-tuned using a custom dataset to improve its conversational abilities.
|
15 |
|
16 |
+
- **Base model**: `distilgpt2`
|
17 |
+
- **Fine-tuned on**: Alpaca dataset
|
18 |
+
- **Architecture type**: Causal language model (Autoregressive)
|
19 |
+
- **Number of layers**: 6 layers
|
20 |
+
- **Hidden size**: 768
|
21 |
+
- **Attention heads**: 12
|
22 |
+
- **Vocabulary size**: 50257
|
23 |
|
24 |
+
## Intended Use
|
25 |
|
26 |
+
This model can be used for various text generation tasks, such as:
|
27 |
+
- Conversational AI
|
28 |
+
- Dialogue systems
|
29 |
+
- Text-based question answering
|
30 |
+
- Instruction-based text generation
|
31 |
|
32 |
+
**Examples of use cases**:
|
33 |
+
- Chatbots
|
34 |
+
- AI assistants
|
35 |
+
- Story or content generation based on a given prompt
|
36 |
+
- Educational tools for conversational learning
|
37 |
|
38 |
+
## Limitations
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
- **Bias**: Like many language models, this model may inherit biases present in the dataset it was trained on.
|
41 |
+
- **Context length**: The model can process a maximum of 512 tokens in one forward pass. Longer inputs will need to be truncated.
|
42 |
+
- **Specificity**: The model might not always generate highly accurate or context-specific answers, particularly in specialized domains outside its training data.
|
43 |
|
44 |
+
## Training Data
|
45 |
|
46 |
+
The model was fine-tuned on the Alpaca dataset, which is a collection of instruction-response pairs. This data is intended to enhance the model’s ability to follow instructions and respond in a conversational manner.
|
|
|
|
|
47 |
|
48 |
+
### Alpaca Dataset
|
49 |
|
50 |
+
The Alpaca dataset consists of instruction-based examples and outputs, ideal for training conversational agents. It includes a diverse set of instructions across multiple domains and tasks.
|
51 |
|
52 |
+
## How to Use
|
53 |
|
54 |
+
You can load this model and generate text using the following code:
|
55 |
|
56 |
+
```python
|
57 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
58 |
|
59 |
+
# Load the fine-tuned model and tokenizer
|
60 |
+
model_path = 'gautam-raj/fine-tuned-distilgpt2' # Path to the model on Hugging Face
|
61 |
|
62 |
+
model = AutoModelForCausalLM.from_pretrained(model_path)
|
63 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
64 |
|
65 |
+
# Input text
|
66 |
+
input_text = "Give three tips for staying healthy."
|
67 |
|
68 |
+
# Tokenize the input text
|
69 |
+
inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True)
|
70 |
|
71 |
+
# Generate the response from the model
|
72 |
+
outputs = model.generate(
|
73 |
+
**inputs, # Pass tokenized inputs to the model
|
74 |
+
max_length=100, # Maximum length of the generated output
|
75 |
+
num_return_sequences=1, # Number of sequences to generate
|
76 |
+
no_repeat_ngram_size=2, # To avoid repetitive phrases
|
77 |
+
temperature=0.5, # Control randomness in generation
|
78 |
+
top_p=0.9, # Nucleus sampling
|
79 |
+
top_k=50, # Top-k sampling
|
80 |
+
do_sample=True
|
81 |
+
)
|
82 |
|
83 |
+
# Decode the generated output
|
84 |
+
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
85 |
|
86 |
+
print(generated_text)
|
87 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
## Evaluation
|
90 |
|
91 |
+
This model has not yet been evaluated in a formal benchmark, but it performs reasonably well on conversational and instructional tasks based on its fine-tuning with the Alpaca dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
## License
|
94 |
|
95 |
+
Specify the license for the model. If you are using a license like the MIT License, you can indicate that here. Example:
|
96 |
|
97 |
+
```
|
98 |
+
The model is licensed under the MIT License.
|
99 |
+
```
|
100 |
|
101 |
+
## Citation
|
102 |
|
103 |
+
If you are publishing the model and want to cite it, you can add a citation format here. For example:
|
104 |
|
105 |
+
```
|
106 |
+
@article{gautam2024fine,
|
107 |
+
title={Fine-tuned DistilGPT2 for Instruction-based Text Generation},
|
108 |
+
author={Gautam Raj},
|
109 |
+
year={2024},
|
110 |
+
journal={Hugging Face},
|
111 |
+
url={https://huggingface.co/gautam-raj/fine-tuned-distilgpt2}
|
112 |
+
}
|
113 |
+
```
|
114 |
|
115 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
- PEFT 0.13.2
|