Instructions to use Azamorn/retnet-tinystories with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Azamorn/retnet-tinystories with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Azamorn/retnet-tinystories")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Azamorn/retnet-tinystories", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Azamorn/retnet-tinystories with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Azamorn/retnet-tinystories" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Azamorn/retnet-tinystories", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Azamorn/retnet-tinystories
- SGLang
How to use Azamorn/retnet-tinystories 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 "Azamorn/retnet-tinystories" \ --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": "Azamorn/retnet-tinystories", "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 "Azamorn/retnet-tinystories" \ --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": "Azamorn/retnet-tinystories", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Azamorn/retnet-tinystories with Docker Model Runner:
docker model run hf.co/Azamorn/retnet-tinystories
| from transformers import AutoTokenizer | |
| from retnet.modeling_retnet import RetNetForCausalLM | |
| model = RetNetForCausalLM.from_pretrained("./") | |
| tokenizer = AutoTokenizer.from_pretrained('gpt2') | |
| tokenizer.model_max_length = 16384 | |
| tokenizer.pad_token = tokenizer.eos_token | |
| tokenizer.unk_token = tokenizer.eos_token | |
| tokenizer.bos_token = tokenizer.eos_token | |
| inputs = tokenizer("Hello, my dog is cute and ", return_tensors="pt") | |
| # Generate output with max_length parameter | |
| generation_output = model.generate(**inputs, max_length=50) # Adjust max_length as needed | |
| output = tokenizer.decode(generation_output[0], skip_special_tokens=True) | |
| print(output) |