Text Generation
Transformers
Safetensors
English
llama
meta
llama-3
conversational
text-generation-inference
Instructions to use gradientai/Llama-3-8B-Instruct-Gradient-1048k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gradientai/Llama-3-8B-Instruct-Gradient-1048k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gradientai/Llama-3-8B-Instruct-Gradient-1048k") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gradientai/Llama-3-8B-Instruct-Gradient-1048k") model = AutoModelForCausalLM.from_pretrained("gradientai/Llama-3-8B-Instruct-Gradient-1048k", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gradientai/Llama-3-8B-Instruct-Gradient-1048k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gradientai/Llama-3-8B-Instruct-Gradient-1048k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gradientai/Llama-3-8B-Instruct-Gradient-1048k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gradientai/Llama-3-8B-Instruct-Gradient-1048k
- SGLang
How to use gradientai/Llama-3-8B-Instruct-Gradient-1048k 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 "gradientai/Llama-3-8B-Instruct-Gradient-1048k" \ --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": "gradientai/Llama-3-8B-Instruct-Gradient-1048k", "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 "gradientai/Llama-3-8B-Instruct-Gradient-1048k" \ --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": "gradientai/Llama-3-8B-Instruct-Gradient-1048k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gradientai/Llama-3-8B-Instruct-Gradient-1048k with Docker Model Runner:
docker model run hf.co/gradientai/Llama-3-8B-Instruct-Gradient-1048k
Update README.md
Browse files
README.md
CHANGED
|
@@ -16,7 +16,9 @@ For more info see our [End-to-end development service for custom LLMs and AI sys
|
|
| 16 |
|
| 17 |
This model extends LLama-3 8B's context length from 8k to > 1040K, developed by Gradient, sponsored by compute from [Crusoe Energy](https://huggingface.co/crusoeai). It demonstrates that SOTA LLMs can learn to operate on long context with minimal training by appropriately adjusting RoPE theta. We trained on 830M tokens for this stage, and 1.4B tokens total for all stages, which is < 0.01% of Llama-3's original pre-training data.
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
**Approach:**
|
| 22 |
|
|
@@ -32,7 +34,7 @@ Notably, we layered parallelism on top of Ring Attention with a custom network t
|
|
| 32 |
|
| 33 |
**Data:**
|
| 34 |
|
| 35 |
-
For training data, we generate long contexts by augmenting [SlimPajama](https://huggingface.co/datasets/cerebras/SlimPajama-627B).
|
| 36 |
|
| 37 |
**Progressive Training Details:**
|
| 38 |
|
|
@@ -100,6 +102,9 @@ Drop an email to [contact@gradient.ai](mailto:contact@gradient.ai)
|
|
| 100 |
|
| 101 |
[3] https://github.com/jzhang38/EasyContext
|
| 102 |
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
----
|
| 105 |
|
|
|
|
| 16 |
|
| 17 |
This model extends LLama-3 8B's context length from 8k to > 1040K, developed by Gradient, sponsored by compute from [Crusoe Energy](https://huggingface.co/crusoeai). It demonstrates that SOTA LLMs can learn to operate on long context with minimal training by appropriately adjusting RoPE theta. We trained on 830M tokens for this stage, and 1.4B tokens total for all stages, which is < 0.01% of Llama-3's original pre-training data.
|
| 18 |
|
| 19 |
+
**Update (5/3): We further fine-tuned our model to strengthen its assistant-like chat ability as well. The NIAH result is updated.**
|
| 20 |
+
|
| 21 |
+

|
| 22 |
|
| 23 |
**Approach:**
|
| 24 |
|
|
|
|
| 34 |
|
| 35 |
**Data:**
|
| 36 |
|
| 37 |
+
For training data, we generate long contexts by augmenting [SlimPajama](https://huggingface.co/datasets/cerebras/SlimPajama-627B). We also fine-tune on a chat dataset based on UltraChat [4], following a similar recipe for data augmentation to [2].
|
| 38 |
|
| 39 |
**Progressive Training Details:**
|
| 40 |
|
|
|
|
| 102 |
|
| 103 |
[3] https://github.com/jzhang38/EasyContext
|
| 104 |
|
| 105 |
+
[3] Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan
|
| 106 |
+
Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling
|
| 107 |
+
high-quality instructional conversations. arXiv preprint arXiv:2305.14233, 2023.
|
| 108 |
|
| 109 |
----
|
| 110 |
|