File size: 3,786 Bytes
6db84a2
f129ccd
6db84a2
 
f129ccd
 
 
 
 
6db84a2
f129ccd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4f4e351
f129ccd
 
 
 
 
 
 
4f4e351
 
 
f129ccd
 
 
 
 
 
 
 
 
 
4f4e351
f129ccd
 
 
 
 
4f4e351
 
 
 
f129ccd
4f4e351
f129ccd
 
 
 
 
 
 
4f4e351
f129ccd
 
 
 
4f4e351
f129ccd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
language: en
license: mit
tags:
  - text-generation
  - transformers
  - safetensors
base_model: distilbert/distilgpt2
parameters: 81912576
---

# Text2GPT ๐Ÿค–

Text2GPT is a lightweight text generation model fine-tuned from [DistilGPT2](https://huggingface.co/distilbert/distilgpt2), with 81.9M parameters, designed for efficient and coherent text generation. It leverages the power of transformers and supports Safetensors for secure model loading. Ideal for creative writing, text completion, and more! ๐Ÿš€

---

## Features โœจ

- Generates human-like text with minimal input ๐Ÿ“
- Supports Safetensors for safe and efficient loading ๐Ÿ”’
- Fine-tuned for low-resource environments โšก
- Compatible with Hugging Face `transformers` and vLLM ๐Ÿš€

## Installation ๐Ÿ› ๏ธ

Install the required dependencies:

```bash
pip install transformers torch safetensors
```

## Usage ๐ŸŽฎ

### Loading the Model with Transformers

Use the Hugging Face `transformers` library to load and generate text:

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load model and tokenizer
model_name = "kulia-moon/Text2GPT"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Generate text
input_text = "Once upon a time"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=50, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### Using Pipeline for Simplicity

For quick text generation:

```python
from transformers import pipeline

pipe = pipeline("text-generation", model="kulia-moon/Text2GPT")
print(pipe("My name is Julien and I like to", max_length=30, do_sample=True)[0]["generated_text"])
```

### vLLM Deployment for Scalability

Deploy with vLLM for high-throughput inference:

```bash
docker run --runtime nvidia --gpus all -v ~/.cache/huggingface:/root/.cache/huggingface -p 8000:8000 --ipc=host vllm/vllm-openai:latest --model kulia-moon/Text2GPT
```

Then, serve the model:

```bash
docker exec -it my_vllm_container bash -c "vllm serve kulia-moon/Text2GPT"
```

## Widget Examples ๐Ÿ–ฑ๏ธ

Try these prompts on the [model page](https://huggingface.co/kulia-moon/Text2GPT):

- "Once upon a time" โณ
- "My name is Julien and I like to" ๐Ÿ˜Š
- "Paris is an amazing place to visit," ๐Ÿ—ผ
- "I like traveling by train because" ๐Ÿš‚

**Example Output**:

**Input**: "Once upon a time"  
**Output**: "Once upon a time, a curious AI roamed the digital realm, crafting tales of wonder."

## Model Details ๐Ÿ“Š

- **Architecture**: DistilGPT2-based, 6 layers, 81.9M parameters
- **Base Model**: [distilbert/distilgpt2](https://huggingface.co/distilbert/distilgpt2)
- **Safetensors**: Supported, 81,912,576 parameters (non-sharded, non-quantized)
- **Intended Use**: Text generation, creative writing, dialogue completion
- **Limitations**: May produce biased or repetitive outputs; not optimized for sensitive tasks

## Evaluation Report ๐Ÿ“ˆ

Evaluation metrics are under development. Preliminary tests suggest performance comparable to DistilGPT2 (perplexity ~21.1 on WikiText-103). Contributions for detailed metrics are welcome via [discussions](https://huggingface.co/kulia-moon/Text2GPT/discussions)! ๐Ÿ™Œ

## Requirements โš™๏ธ

- Python 3.8+
- `transformers>=4.30.0`
- `torch>=2.0.0`
- `safetensors>=0.4.0`

## License ๐Ÿ“œ

This model is licensed under the [MIT License](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/mit.md).

## Community & Support ๐Ÿ’ฌ

Join the conversation or seek help at:
- [Hugging Face Discussions](https://huggingface.co/kulia-moon/Text2GPT/discussions)
- [Model Page](https://huggingface.co/kulia-moon/Text2GPT)

Contributions and feedback are welcome! ๐ŸŒŸ