Instructions to use bhenrym14/airophin-v2-13b-PI-8k-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bhenrym14/airophin-v2-13b-PI-8k-fp16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bhenrym14/airophin-v2-13b-PI-8k-fp16")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bhenrym14/airophin-v2-13b-PI-8k-fp16") model = AutoModelForCausalLM.from_pretrained("bhenrym14/airophin-v2-13b-PI-8k-fp16", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bhenrym14/airophin-v2-13b-PI-8k-fp16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bhenrym14/airophin-v2-13b-PI-8k-fp16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bhenrym14/airophin-v2-13b-PI-8k-fp16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bhenrym14/airophin-v2-13b-PI-8k-fp16
- SGLang
How to use bhenrym14/airophin-v2-13b-PI-8k-fp16 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 "bhenrym14/airophin-v2-13b-PI-8k-fp16" \ --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": "bhenrym14/airophin-v2-13b-PI-8k-fp16", "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 "bhenrym14/airophin-v2-13b-PI-8k-fp16" \ --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": "bhenrym14/airophin-v2-13b-PI-8k-fp16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bhenrym14/airophin-v2-13b-PI-8k-fp16 with Docker Model Runner:
docker model run hf.co/bhenrym14/airophin-v2-13b-PI-8k-fp16
Curious to know how 8k context llama2 got trained on 24gb GPU
Can you share the finetuning script, how did you train 8k context length llama2 got trained on 24gb GPU?
I trained it on a RTX 6000 Ada, which has 48gb VRAM. However, for this model, I didn't actually perform any training at 8k context length (unlike the first airophin model). I started from another model checkpoint that had been trained on such.
As far as the finetuning script goes, It's basically a modified version of the qlora script in the original qlora paper. I have a version of it here (there are differences to what I used here; I may update it when I get a chance): https://github.com/bhenrym14/qlora-airoboros-longcontext/blob/main/qlora_airo.py
Thanks @bhenrym14 for the clarification. Just wanted to confirm what you have used as model_max_len, 8192 or default one i.e 2048 in mentioned script ? Also can you confirm if similar script was used to finetune the first airophin model(bhenrym14/airophin-13b-pntk-16k-fp16), if yes then what was value of model_max_len there and gpu type and how many gpus?
This script relies on the RoPE monkey-patch to apply the desired interpolation factor (where I just hard-coded it); this is because I wrote this before transformers had native support for RoPE scaling. So yes, for this model, I did scale appropriately (factor of 2) for 8192 context. Since tranformers now has support, I generally will edit the backbone config to include the desired scaling method, and use the model_max_len to control the maximum sequence length the model sees in training; this is simply so I can run larger batches without risking OOM on a couple of samples in an otherwise shorter sequence dataset.
For the airoboros finetune phase, I capped it at ~3000 for max_model_len (again, RoPE scaling is still for 8192). I trained on a single gpu. It was a RTX 6000 Ada generation.