Instructions to use ahmadisakina/decoder-language-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ahmadisakina/decoder-language-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ahmadisakina/decoder-language-model")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ahmadisakina/decoder-language-model", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ahmadisakina/decoder-language-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ahmadisakina/decoder-language-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahmadisakina/decoder-language-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ahmadisakina/decoder-language-model
- SGLang
How to use ahmadisakina/decoder-language-model 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 "ahmadisakina/decoder-language-model" \ --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": "ahmadisakina/decoder-language-model", "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 "ahmadisakina/decoder-language-model" \ --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": "ahmadisakina/decoder-language-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ahmadisakina/decoder-language-model with Docker Model Runner:
docker model run hf.co/ahmadisakina/decoder-language-model
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,22 +1,26 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
##
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
##
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
model
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
---
|
| 5 |
+
# Decoder Language Model
|
| 6 |
+
Ein kleiner autoregressiver Decoder-only Transformer, trainiert auf Tiny Shakespeare.
|
| 7 |
+
|
| 8 |
+
## Architektur
|
| 9 |
+
- d_model=128, num_layers=2, nhead=4
|
| 10 |
+
- ~500k Parameter
|
| 11 |
+
|
| 12 |
+
## Metriken
|
| 13 |
+
- Loss (Train): 0.6342
|
| 14 |
+
- Perplexity (Train): 1.8854
|
| 15 |
+
|
| 16 |
+
## Laden
|
| 17 |
+
```python
|
| 18 |
+
from transformers import GPT2Tokenizer
|
| 19 |
+
import torch
|
| 20 |
+
from model import DecoderLanguageModel
|
| 21 |
+
|
| 22 |
+
tokenizer = GPT2Tokenizer.from_pretrained("ahmadisakina/decoder-language-model")
|
| 23 |
+
model = DecoderLanguageModel(vocab_size=tokenizer.vocab_size, d_model=128, nhead=4, num_layers=2)
|
| 24 |
+
model.load_state_dict(torch.load("pytorch_model.bin"))
|
| 25 |
+
model.eval()
|
| 26 |
```
|