Instructions to use tktung/MultiSV_Mixtral-8x7B-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tktung/MultiSV_Mixtral-8x7B-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tktung/MultiSV_Mixtral-8x7B-v0.1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tktung/MultiSV_Mixtral-8x7B-v0.1") model = AutoModelForCausalLM.from_pretrained("tktung/MultiSV_Mixtral-8x7B-v0.1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tktung/MultiSV_Mixtral-8x7B-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tktung/MultiSV_Mixtral-8x7B-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tktung/MultiSV_Mixtral-8x7B-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tktung/MultiSV_Mixtral-8x7B-v0.1
- SGLang
How to use tktung/MultiSV_Mixtral-8x7B-v0.1 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 "tktung/MultiSV_Mixtral-8x7B-v0.1" \ --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": "tktung/MultiSV_Mixtral-8x7B-v0.1", "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 "tktung/MultiSV_Mixtral-8x7B-v0.1" \ --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": "tktung/MultiSV_Mixtral-8x7B-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tktung/MultiSV_Mixtral-8x7B-v0.1 with Docker Model Runner:
docker model run hf.co/tktung/MultiSV_Mixtral-8x7B-v0.1
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Run the model
Instruction format
The template used to build a prompt for this Instruct model is defined as follows:
### USER:
{instruction1}
### RESPONSE:
{respone1}
### USER:
{instruction2}
### RESPONSE:
{respone2}
Run the model with the transformers library:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "tktung/MultiSV_Mixtral-8x7B-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,
device_map="auto",
dtype=torch.float16 # optional, load in 16-bit precision mode to reduce memory usage
)
model.eval()
def make_prompt(instruction):
return f"""### USER:
{instruction}
### RESPONSE:
"""
user_input = "Känner du till WARA M&L?"
input_prompt = make_prompt(user_input)
input_ids = tokenizer(input_prompt, return_tensors="pt")["input_ids"]
generated_token_ids = model.generate(
inputs=input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.6,
top_p=1,
)[0]
generated_text = tokenizer.decode(generated_token_ids)
Retrieval Augmented Generation
The model was trained with the following prompt format for RAG:
Vietnamese:
### USER:
Sử dụng ngữ cảnh sau để trả lời câu hỏi ở cuối:
{context}
Câu hỏi: {human_prompt}
### RESPONSE:
Swedish:
### USER:
Använd följande sammanhang för att svara på frågan:
{context}
Fråga: {human_prompt}
### RESPONSE:
- Downloads last month
- 14