Instructions to use Ayaka157/RetNet-0.5B-ep1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ayaka157/RetNet-0.5B-ep1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ayaka157/RetNet-0.5B-ep1", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Ayaka157/RetNet-0.5B-ep1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ayaka157/RetNet-0.5B-ep1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ayaka157/RetNet-0.5B-ep1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ayaka157/RetNet-0.5B-ep1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ayaka157/RetNet-0.5B-ep1
- SGLang
How to use Ayaka157/RetNet-0.5B-ep1 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 "Ayaka157/RetNet-0.5B-ep1" \ --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": "Ayaka157/RetNet-0.5B-ep1", "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 "Ayaka157/RetNet-0.5B-ep1" \ --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": "Ayaka157/RetNet-0.5B-ep1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ayaka157/RetNet-0.5B-ep1 with Docker Model Runner:
docker model run hf.co/Ayaka157/RetNet-0.5B-ep1
RetNet-0.5B, epoch 1
First training leg of the 0.5B model, run on a rented RTX 3090 24 GB. Validation loss 2.1035. The final model is RetNet-0.5B at 1.9459.
Same architecture and configuration: 504,179,896 parameters, 20 layers, d_model 1408, 22 heads,
vocab 20000, context 2048, chunk size 128.
Training
One epoch over chat_pack_v13 (552,330,489 token slots). Batch 4 × accum 1, 67,390 steps,
11.316 h wall clock, 13,551 tokens/s. Full cosine 1.1e-4 → 1.1e-5, warmup 500, AdamW 8-bit,
seed 1234. Peak memory 23,230 MiB out of 24,576 MiB — 1,346 MiB of headroom, which is why the
batch stayed at 4 on this card.
The run was split into two segments by a control flag: it stopped at step 10,661 and resumed from 10,509 after the last checkpoint at 10,508, so 153 steps were run twice.
Usage
Identical to the final model — trust_remote_code=True, standard AutoTokenizer:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Ayaka157/RetNet-0.5B-ep1"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.float32).eval()
ids = tok("<bos>ç”¨æˆ·ï¼šä½ å¥½ã€‚\n助手:")["input_ids"]
out = model.generate(torch.tensor([ids]), max_new_tokens=64, temperature=0.7)
print(tok.decode(out[0].tolist()[len(ids):]))
As in the other checkpoints, mode in config.json is parallel for inference; the training
run used chunkwise.
Evaluation numbers and the failure notes are on the final model card and in the technical report.
License
MIT.
- Downloads last month
- 270