Run this model with HF Jobs
Run togethercomputer/LLaMA-2-7B-32K on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/togethercomputer/LLaMA-2-7B-32K. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/togethercomputer/LLaMA-2-7B-32K on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/togethercomputer/LLaMA-2-7B-32K. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/togethercomputer/LLaMA-2-7B-32K. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use togethercomputer/LLaMA-2-7B-32K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use togethercomputer/LLaMA-2-7B-32K with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="togethercomputer/LLaMA-2-7B-32K")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("togethercomputer/LLaMA-2-7B-32K") model = AutoModelForCausalLM.from_pretrained("togethercomputer/LLaMA-2-7B-32K", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use togethercomputer/LLaMA-2-7B-32K with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "togethercomputer/LLaMA-2-7B-32K" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "togethercomputer/LLaMA-2-7B-32K", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/togethercomputer/LLaMA-2-7B-32K
- SGLang
How to use togethercomputer/LLaMA-2-7B-32K 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 "togethercomputer/LLaMA-2-7B-32K" \ --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": "togethercomputer/LLaMA-2-7B-32K", "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 "togethercomputer/LLaMA-2-7B-32K" \ --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": "togethercomputer/LLaMA-2-7B-32K", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use togethercomputer/LLaMA-2-7B-32K with Docker Model Runner:
docker model run hf.co/togethercomputer/LLaMA-2-7B-32K
Update README.md
Browse files9 unmodified lines101112131415161718192023 unmodified lines4445464748495017 unmodified lines6869707172737412 unmodified lines87888990919293947 unmodified lines1021031041051061071089 unmodified lineslibrary_name: transformers---# Llama-2-7B-32K-beta## Model DescriptionLlama-2-7B-32K-beta is an open-source, long context language model developed by Together, fine-tuned from Meta's original Llama-2 7B model.This model represents our efforts to contribute to the rapid progress of the open-source ecosystem for large language models.The model has been extended to a context length of 32K with position interpolation,allowing applications on multi-document QA, long text summarization, etc.23 unmodified linesNext, we provide examples of how to fine-tune the model for specific applications.The example datasets are placed in [togethercomputer/Long-Data-Collections](https://huggingface.co/datasets/togethercomputer/Long-Data-Collections)You can use the [OpenChatKit](https://github.com/togethercomputer/OpenChatKit) to fine-tune your own 32K model over Llama-2-7B-32K-beta.Please refer to [OpenChatKit](https://github.com/togethercomputer/OpenChatKit) for step-by-step illustrations.1. Long Context QA.17 unmodified lines## InferenceYou can use the [Together API](https://together.ai/blog/api-announcement) to try out Llama-2-7B-32K-beta for inference.The updated inference stack allows for efficient inference.To run the model locally, we strongly recommend to install Flash Attention V2, which is necessary to obtain the best performance:12 unmodified lines```pythonfrom transformers import AutoTokenizer, AutoModelForCausalLMtokenizer = AutoTokenizer.from_pretrained("togethercomputer/Llama-2-7B-32K-beta")model = AutoModelForCausalLM.from_pretrained("togethercomputer/Llama-2-7B-32K-beta", trust_remote_code=True, torch_dtype=torch.float16)input_context = "Your text here"input_ids = tokenizer.encode(input_context, return_tensors="pt")7 unmodified lines## Limitations and BiasAs with all language models, Llama-2-7B-32K-beta may generate incorrect or biased content. It's important to keep this in mind when using the model.## Community9 unmodified lines101112131415161718192023 unmodified lines4445464748495017 unmodified lines6869707172737412 unmodified lines87888990919293947 unmodified lines1021031041051061071089 unmodified lineslibrary_name: transformers---# LLaMA-2-7B-32K## Model DescriptionLLaMA-2-7B-32K is an open-source, long context language model developed by Together, fine-tuned from Meta's original Llama-2 7B model.This model represents our efforts to contribute to the rapid progress of the open-source ecosystem for large language models.The model has been extended to a context length of 32K with position interpolation,allowing applications on multi-document QA, long text summarization, etc.23 unmodified linesNext, we provide examples of how to fine-tune the model for specific applications.The example datasets are placed in [togethercomputer/Long-Data-Collections](https://huggingface.co/datasets/togethercomputer/Long-Data-Collections)You can use the [OpenChatKit](https://github.com/togethercomputer/OpenChatKit) to fine-tune your own 32K model over LLaMA-2-7B-32K.Please refer to [OpenChatKit](https://github.com/togethercomputer/OpenChatKit) for step-by-step illustrations.1. Long Context QA.17 unmodified lines## InferenceYou can use the [Together API](https://together.ai/blog/api-announcement) to try out LLaMA-2-7B-32K for inference.The updated inference stack allows for efficient inference.To run the model locally, we strongly recommend to install Flash Attention V2, which is necessary to obtain the best performance:12 unmodified lines```pythonfrom transformers import AutoTokenizer, AutoModelForCausalLMtokenizer = AutoTokenizer.from_pretrained("togethercomputer/LLaMA-2-7B-32K")model = AutoModelForCausalLM.from_pretrained("togethercomputer/LLaMA-2-7B-32K", trust_remote_code=True, torch_dtype=torch.float16)input_context = "Your text here"input_ids = tokenizer.encode(input_context, return_tensors="pt")7 unmodified lines## Limitations and BiasAs with all language models, LLaMA-2-7B-32K may generate incorrect or biased content. It's important to keep this in mind when using the model.## Community
README.md+7-7