Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- rahul77/rahul-gpt2-1k
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: openai-community/gpt2
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
library_name: transformers
|
| 10 |
+
tags:
|
| 11 |
+
- text-generation
|
| 12 |
+
- GPT-2
|
| 13 |
+
- fine-tuned
|
| 14 |
+
- language-model
|
| 15 |
+
- transformers
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# GPT-2 Fine-Tuned Model
|
| 19 |
+
|
| 20 |
+
This is a fine-tuned version of the GPT-2 model designed for text generation tasks. The model has been fine-tuned to improve its performance on generating coherent and contextually relevant text.
|
| 21 |
+
|
| 22 |
+
## Model Details
|
| 23 |
+
|
| 24 |
+
- **Model Name:** GPT-2 Fine-Tuned
|
| 25 |
+
- **Base Model:** gpt2
|
| 26 |
+
- **Architecture:** GPT2LMHeadModel
|
| 27 |
+
- **Tokenization:** Supported
|
| 28 |
+
- `pad_token_id`: 50256
|
| 29 |
+
- `bos_token_id`: 50256
|
| 30 |
+
- `eos_token_id`: 50256
|
| 31 |
+
|
| 32 |
+
## Supported Tasks
|
| 33 |
+
|
| 34 |
+
This model supports the following task:
|
| 35 |
+
|
| 36 |
+
- **Text Generation**
|
| 37 |
+
|
| 38 |
+
## Configuration
|
| 39 |
+
|
| 40 |
+
### Model Configuration (config.json)
|
| 41 |
+
|
| 42 |
+
- **Hidden Size:** 768
|
| 43 |
+
- **Number of Layers:** 12
|
| 44 |
+
- **Number of Attention Heads:** 12
|
| 45 |
+
- **Vocab Size:** 50257
|
| 46 |
+
- **Token Type IDs:** Not used
|
| 47 |
+
|
| 48 |
+
### Generation Configuration (generation_config.json)
|
| 49 |
+
|
| 50 |
+
- **Sampling Temperature:** 0.7
|
| 51 |
+
- **Top-p (nucleus sampling):** 0.9
|
| 52 |
+
- **Pad Token ID:** 50256
|
| 53 |
+
- **Bos Token ID:** 50256
|
| 54 |
+
- **Eos Token ID:** 50256
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
To use this model for text generation via the Hugging Face API, use the following Python code snippet:
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import requests
|
| 62 |
+
|
| 63 |
+
api_url = "https://api-inference.huggingface.co/models/rahul77/gpt-2-finetune"
|
| 64 |
+
headers = {
|
| 65 |
+
"Authorization": "Bearer YOUR_API_TOKEN", # Replace with your Hugging Face API token
|
| 66 |
+
"Content-Type": "application/json"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
data = {
|
| 70 |
+
"inputs": "What is a large language model?",
|
| 71 |
+
"parameters": {
|
| 72 |
+
"max_length": 50
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
response = requests.post(api_url, headers=headers, json=data)
|
| 77 |
+
|
| 78 |
+
if response.status_code == 200:
|
| 79 |
+
print(response.json())
|
| 80 |
+
else:
|
| 81 |
+
print(f"Error: {response.status_code}")
|
| 82 |
+
print(response.json())
|