Instructions to use princeton-nlp/Llama-3-8B-ProLong-64k-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use princeton-nlp/Llama-3-8B-ProLong-64k-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="princeton-nlp/Llama-3-8B-ProLong-64k-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("princeton-nlp/Llama-3-8B-ProLong-64k-Base") model = AutoModelForCausalLM.from_pretrained("princeton-nlp/Llama-3-8B-ProLong-64k-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use princeton-nlp/Llama-3-8B-ProLong-64k-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "princeton-nlp/Llama-3-8B-ProLong-64k-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "princeton-nlp/Llama-3-8B-ProLong-64k-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/princeton-nlp/Llama-3-8B-ProLong-64k-Base
- SGLang
How to use princeton-nlp/Llama-3-8B-ProLong-64k-Base 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 "princeton-nlp/Llama-3-8B-ProLong-64k-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "princeton-nlp/Llama-3-8B-ProLong-64k-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "princeton-nlp/Llama-3-8B-ProLong-64k-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "princeton-nlp/Llama-3-8B-ProLong-64k-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use princeton-nlp/Llama-3-8B-ProLong-64k-Base with Docker Model Runner:
docker model run hf.co/princeton-nlp/Llama-3-8B-ProLong-64k-Base
princeton_nlp/Llama-3-8B-ProLong-64k-Base
[Paper] [HF Collection] [Code]
ProLong (Princeton long-context language models) is a family of long-context models that are continued trained and supervised fine-tuned from Llama-3-8B, with a maximum context window of 512K tokens. Our main ProLong model is one of the best-performing long-context models at the 10B scale (evaluated by HELMET).
To train this strong long-context model, we conduct thorough ablations on the long-context pre-training data, SFT data, and numerous other design choices. We demonstrate our findings in our paper, How to Train Long-Context Language Models (Effectively).
Authors: Tianyu Gao*, Alexander Wettig*, Howard Yen, Danqi Chen (* equal contribution)
Contact: {tianyug, awettig}@princeton.edu
The ProLong Models
- princeton_nlp/Llama-3-8B-ProLong-64k-Base ← you are here!
- princeton_nlp/Llama-3-8B-ProLong-64k-Instruct
- princeton_nlp/Llama-3-8B-ProLong-512k-Base
- ⭐ princeton_nlp/Llama-3-8B-ProLong-512k-Instruct
Model card
Here are some quick facts about our main ProLong model: princeton-nlp/Llama-3-8B-ProLong-512k-Instruct.
- Base model: meta-llama/Meta-Llama-3-8B-Instruct
- Long-context continued training: 20B tokens on 64K training data (princeton-nlp/prolong-data-64K), and 20B tokens on 512K training data (princeton-nlp/prolong-data-512K)
- Supervised fine-tuning (SFT): UltraChat
- Maximum context window: 512K tokens
ProLong performance on HELMET averaged over 32K, 64K, and 128K lengths. All models are instruct models.
ProLong training recipe.
Citation
@article{gao2024prolong,
title={How to Train Long-Context Language Models (Effectively)},
author={Gao, Tianyu and Wettig, Alexander and Yen, Howard and Chen, Danqi},
journal={arXiv preprint arXiv:2410.02660},
year={2024}
}
- Downloads last month
- 8,279
Model tree for princeton-nlp/Llama-3-8B-ProLong-64k-Base
Base model
meta-llama/Meta-Llama-3-8B-Instruct