Instructions to use Erland/Llama-3.2-1B-JAX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Erland/Llama-3.2-1B-JAX with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Erland/Llama-3.2-1B-JAX")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Erland/Llama-3.2-1B-JAX") model = AutoModelForCausalLM.from_pretrained("Erland/Llama-3.2-1B-JAX", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Erland/Llama-3.2-1B-JAX with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Erland/Llama-3.2-1B-JAX" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Erland/Llama-3.2-1B-JAX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Erland/Llama-3.2-1B-JAX
- SGLang
How to use Erland/Llama-3.2-1B-JAX 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 "Erland/Llama-3.2-1B-JAX" \ --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": "Erland/Llama-3.2-1B-JAX", "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 "Erland/Llama-3.2-1B-JAX" \ --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": "Erland/Llama-3.2-1B-JAX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Erland/Llama-3.2-1B-JAX with Docker Model Runner:
docker model run hf.co/Erland/Llama-3.2-1B-JAX
Regarding max_position_embeddings
Hello, thank you for the great work. I have a question regarding max_position_embeddings.
You limited the value to 32768 while weight-porting, but I don't see any reason why it won't work at larger value (131072), because as far as I know they use rotary embedding which are not trainable, therefore if configured identically, we can increase the value freely.
Thanks again for the great work!
Sorry for the late reply.
The reason why I reduce the max_position_embeddings value is that it gives OOM. Altho I am not really sure myself, but I think it's because the JAX jit has to compile for the first time when we load the model. And the value that HuggingFace uses for the first initialization on the sequence dimension is the max_position_embeddings
Thank you for your response !!