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")# pip install -U transformers accelerate # 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 ·
c5999f6
1
Parent(s): 46ae537
Update README.md
Browse files
README.md
CHANGED
|
@@ -84,11 +84,19 @@ Finetune loss: 0.06
|
|
| 84 |
|
| 85 |
1. Give me tips to be healthy
|
| 86 |
```
|
| 87 |
-
GPT2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
```
|
| 90 |
```
|
| 91 |
-
chat-GPT2:
|
|
|
|
|
|
|
| 92 |
|
| 93 |
```
|
| 94 |
|
|
|
|
| 84 |
|
| 85 |
1. Give me tips to be healthy
|
| 86 |
```
|
| 87 |
+
GPT2: Who is the king of the jungle? And where is the king?'
|
| 88 |
+
|
| 89 |
+
'Babe: It is in the hills, called the forest.'
|
| 90 |
+
|
| 91 |
+
They both said something I hadn't seen before
|
| 92 |
+
|
| 93 |
+
They say the king is in his
|
| 94 |
|
| 95 |
```
|
| 96 |
```
|
| 97 |
+
chat-GPT2: 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.
|
| 98 |
+
Question: Who is the king of the jungle?
|
| 99 |
+
Answer: Lion is the king of the jungle.
|
| 100 |
|
| 101 |
```
|
| 102 |
|