Text Generation
Transformers
PyTorch
Safetensors
English
gpt2
chemistry
biology
text-generation-inference
Instructions to use Arjun-G-Ravi/chat-GPT2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Arjun-G-Ravi/chat-GPT2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Arjun-G-Ravi/chat-GPT2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Arjun-G-Ravi/chat-GPT2") model = AutoModelForCausalLM.from_pretrained("Arjun-G-Ravi/chat-GPT2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Arjun-G-Ravi/chat-GPT2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Arjun-G-Ravi/chat-GPT2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Arjun-G-Ravi/chat-GPT2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Arjun-G-Ravi/chat-GPT2
- SGLang
How to use Arjun-G-Ravi/chat-GPT2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Arjun-G-Ravi/chat-GPT2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Arjun-G-Ravi/chat-GPT2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Arjun-G-Ravi/chat-GPT2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Arjun-G-Ravi/chat-GPT2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Arjun-G-Ravi/chat-GPT2 with Docker Model Runner:
docker model run hf.co/Arjun-G-Ravi/chat-GPT2
Commit ·
ff9993b
1
Parent(s): c5567b3
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,12 +10,10 @@ library_name: transformers
|
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
widget:
|
| 12 |
- text: >-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
Response:
|
| 19 |
example_title: Knowledge-AI
|
| 20 |
- text: >-
|
| 21 |
Below is an instruction that describes a task. Write a response that
|
|
@@ -81,45 +79,36 @@ Finetuned epochs: 50
|
|
| 81 |
Finetune loss: 0.06
|
| 82 |
```
|
| 83 |
|
| 84 |
-
#
|
| 85 |
|
| 86 |
1. Give me tips to be healthy
|
| 87 |
```
|
| 88 |
-
|
| 89 |
-
- Eat a balanced diet that includes plenty of fruits, vegetables, whole grains, lean proteins, and healthy fats.
|
| 90 |
-
- Exercise regularly to maintain a healthy weight and reduce the risk of developing any health issues.
|
| 91 |
-
- Get enough sleep and stay hydrated by drinking plenty of water.
|
| 92 |
-
- Get enough fiber and healthy fats to support your overall health and wellbeing.
|
| 93 |
-
- Practice mindful breathing and avoid activities that can increase stress.
|
| 94 |
-
- Get enough sleep and maintain a healthy weight.
|
| 95 |
-
```
|
| 96 |
|
| 97 |
-
2. Write a poem on cows
|
| 98 |
```
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
In their humble homes they rest.
|
| 102 |
|
| 103 |
-
|
| 104 |
-
They can be found in the fields and gardens,
|
| 105 |
-
Birds and insects to feed us.
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
|
| 115 |
-
Cows are the beloved petals of life,
|
| 116 |
-
They are loyal companions and faithful stewards,
|
| 117 |
-
Their presence will always be seen.
|
| 118 |
```
|
| 119 |
|
| 120 |
3. Which is the fastest animal in the world
|
| 121 |
```
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
|
|
|
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
widget:
|
| 12 |
- text: >-
|
| 13 |
+
Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
|
| 14 |
+
Question: Who is the king of the jungle?
|
| 15 |
+
Answer:
|
| 16 |
+
|
|
|
|
|
|
|
| 17 |
example_title: Knowledge-AI
|
| 18 |
- text: >-
|
| 19 |
Below is an instruction that describes a task. Write a response that
|
|
|
|
| 79 |
Finetune loss: 0.06
|
| 80 |
```
|
| 81 |
|
| 82 |
+
# Comparision with GPT2
|
| 83 |
|
| 84 |
1. Give me tips to be healthy
|
| 85 |
```
|
| 86 |
+
GPT2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
|
|
|
| 88 |
```
|
| 89 |
+
```
|
| 90 |
+
chat-GPT2:
|
|
|
|
| 91 |
|
| 92 |
+
```
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
2. Write a poem on cows
|
| 95 |
+
```
|
| 96 |
+
GPT2:
|
| 97 |
|
| 98 |
+
```
|
| 99 |
+
```
|
| 100 |
+
chat-GPT2:
|
| 101 |
|
|
|
|
|
|
|
|
|
|
| 102 |
```
|
| 103 |
|
| 104 |
3. Which is the fastest animal in the world
|
| 105 |
```
|
| 106 |
+
GPT2:
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
```
|
| 110 |
+
chat-GPT2:
|
| 111 |
+
|
| 112 |
```
|
| 113 |
|
| 114 |
|