File size: 1,850 Bytes
22f7524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
license: apache-2.0
datasets:
- rahul77/rahul-gpt2-1k
language:
- en
base_model: openai-community/gpt2
pipeline_tag: text-generation
library_name: transformers
tags:
- text-generation
- GPT-2
- fine-tuned
- language-model
- transformers
---

# GPT-2 Fine-Tuned Model

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.

## Model Details

- **Model Name:** GPT-2 Fine-Tuned
- **Base Model:** gpt2
- **Architecture:** GPT2LMHeadModel
- **Tokenization:** Supported
  - `pad_token_id`: 50256
  - `bos_token_id`: 50256
  - `eos_token_id`: 50256

## Supported Tasks

This model supports the following task:

- **Text Generation**

## Configuration

### Model Configuration (config.json)

- **Hidden Size:** 768
- **Number of Layers:** 12
- **Number of Attention Heads:** 12
- **Vocab Size:** 50257
- **Token Type IDs:** Not used

### Generation Configuration (generation_config.json)

- **Sampling Temperature:** 0.7
- **Top-p (nucleus sampling):** 0.9
- **Pad Token ID:** 50256
- **Bos Token ID:** 50256
- **Eos Token ID:** 50256

## Usage

To use this model for text generation via the Hugging Face API, use the following Python code snippet:

```python
import requests

api_url = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Frahul77%2Fgpt-2-finetune%26quot%3B%3C%2Fspan%3E
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",  # Replace with your Hugging Face API token
    "Content-Type": "application/json"
}

data = {
    "inputs": "What is a large language model?",
    "parameters": {
        "max_length": 50
    }
}

response = requests.post(api_url, headers=headers, json=data)

if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")
    print(response.json())