Instructions to use Datascience-Lab/GPT2-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Datascience-Lab/GPT2-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Datascience-Lab/GPT2-small")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Datascience-Lab/GPT2-small") model = AutoModelForCausalLM.from_pretrained("Datascience-Lab/GPT2-small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Datascience-Lab/GPT2-small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Datascience-Lab/GPT2-small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Datascience-Lab/GPT2-small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Datascience-Lab/GPT2-small
- SGLang
How to use Datascience-Lab/GPT2-small 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 "Datascience-Lab/GPT2-small" \ --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": "Datascience-Lab/GPT2-small", "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 "Datascience-Lab/GPT2-small" \ --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": "Datascience-Lab/GPT2-small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Datascience-Lab/GPT2-small with Docker Model Runner:
docker model run hf.co/Datascience-Lab/GPT2-small
Update README.md
#2
by WONBKIM - opened
README.md
CHANGED
|
@@ -37,5 +37,9 @@ outputs = model.generate(inputs['input_ids'], max_length=128,
|
|
| 37 |
temperature = 0.5)
|
| 38 |
outputs = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 39 |
|
| 40 |
-
# 출력 결과 : '출근이 힘들면 출근을 하지 않는 것이 좋다. 하지만 출퇴근 시간을 늦추는 것은 오히려 건강에 좋지 않다..
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
```
|
|
|
|
| 37 |
temperature = 0.5)
|
| 38 |
outputs = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 39 |
|
| 40 |
+
# 출력 결과 : '출근이 힘들면 출근을 하지 않는 것이 좋다. 하지만 출퇴근 시간을 늦추는 것은 오히려 건강에 좋지 않다..
|
| 41 |
+
특히나 장시간의 업무로 인해 피로가 쌓이고 면역력이 떨어지면, 피로감이 심해져서 잠들기 어려운 경우가 많다.
|
| 42 |
+
이런 경우라면 평소보다 더 많은 양으로 과식을 하거나 무리한 다이어트를 할 수 있다.
|
| 43 |
+
따라서 식단 조절과 함께 영양 보충에 신경 써야 한다.
|
| 44 |
+
또한 과도한 음식이 체중 감량에 도움을 주므로 적절한 운동량을 유지하는 것도 중요하다.'
|
| 45 |
```
|