Instructions to use aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2") model = AutoModelForCausalLM.from_pretrained("aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2", 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 aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2
- SGLang
How to use aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2 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 "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2" \ --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": "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2", "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 "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2" \ --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": "aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2 with Docker Model Runner:
docker model run hf.co/aws-neuron/Mistral-7B-Instruct-v0.2-seqlen-2048-bs-1-cores-2
Upload folder using huggingface_hub
Upload folder using huggingface_hub
Multi commit ID: 900c5fbd9bcbbc00a236298ffb0892582af87a5bb53af65e809ae80bf9dd8a8c
Scheduled commits:
- Upload 21 file(s) totalling 2.0G (f4b397c1183e04242c7dfa64fddb9809c58c7b0de9f4962f48aec1812d509eaa)
- Upload 21 file(s) totalling 2.1G (6cf690c92a5179db9f8676ed9c427654777b09fce653df820727f1a363ed29e1)
- Upload 19 file(s) totalling 2.0G (6512125ab32f0a1649265d71fca8f677076d0207c44a6140b451e3ea03e8223c)
- Upload 19 file(s) totalling 2.0G (794be9d05ceafdab568a3caab72cc6164fe3fc2dab4f0aa2309213afef54efb1)
- Upload 21 file(s) totalling 2.0G (163dbae62932ee7833eebf26c387dc2fbd3eda0892446b45291dfcc5d14c19ad)
- Upload 24 file(s) totalling 2.1G (ba8977eeefec3b0871905c7f18d31118a665c93b375ba9ee736bdda0465cad78)
- Upload 24 file(s) totalling 2.0G (af9ebd53817549a275b9ae22c3954b8945f15abb72cc4f73000f3fbc546879c1)
- Upload 18 file(s) totalling 2.1G (7072e292695efb5dff0e1ca6faeeaab2319b4539ff9305d2a31f4c4194a8d584)
- Upload 22 file(s) totalling 2.1G (630b22f0b14b9a5a57637feaea99d1e769a36f6e9a7618bcaf8632ee0d9f3d1c)
- Upload 21 file(s) totalling 2.0G (658c0b4b261ac96898575718d25766fe780cff28f782a76e2937485484084368)
- Upload 20 file(s) totalling 2.1G (f4f1c1e67f078727f9ceea6d333912acba53e0ddc8a0e3d74eb0d153be9e98a5)
- Upload 19 file(s) totalling 2.0G (4a2b31b58dc02fbb8f137486d9290c0e08817e7a4e036cc75086940e19c1a99d)
- Upload 18 file(s) totalling 2.1G (b6a18a0689389e44e4a73a5f14cefcb04d15108e795a4912055b2bdd3eb87d49)
- Upload 23 file(s) totalling 2.1G (83454115d512a595290d52d8ce98c4d287583dcdbfac76707e8c0969d8ac980b)
- Upload 20 file(s) totalling 574.3M (c78a658cab35c5f051989be749729d4ebd60c887c8fb5f8e0e1cf9983e2c7487)
This is a PR opened using the huggingface_hub library in the context of a multi-commit. PR can be commented as a usual PR. However, please be aware that manually updating the PR description, changing the PR status, or pushing new commits, is not recommended as it might corrupt the commit process. Learn more about multi-commits in this guide.
Multi-commit is now completed! You can ping the repo owner to review the changes. This PR can now be commented or modified without risking to corrupt it.
This is a comment posted using the huggingface_hub library in the context of a multi-commit. Learn more about multi-commits in this guide.
create_pr=False has been passed so PR is automatically merged.
This is a comment posted using the huggingface_hub library in the context of a multi-commit. Learn more about multi-commits in this guide.