teknium/OpenHermes-2.5
Viewer • Updated • 1M • 13.4k • 930
How to use timpal0l/Mistral-7B-v0.1-flashback-v2-instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="timpal0l/Mistral-7B-v0.1-flashback-v2-instruct") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("timpal0l/Mistral-7B-v0.1-flashback-v2-instruct")
model = AutoModelForCausalLM.from_pretrained("timpal0l/Mistral-7B-v0.1-flashback-v2-instruct", device_map="auto")How to use timpal0l/Mistral-7B-v0.1-flashback-v2-instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
How to use timpal0l/Mistral-7B-v0.1-flashback-v2-instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct" \
--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": "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct" \
--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": "timpal0l/Mistral-7B-v0.1-flashback-v2-instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use timpal0l/Mistral-7B-v0.1-flashback-v2-instruct with Docker Model Runner:
docker model run hf.co/timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
Mistral-7B-v0.1-flashback-v2-instruct is an instruct based version of the base model timpal0l/Mistral-7B-v0.1-flashback-v2. It has been finetuned on a the machine translated instruct dataset OpenHermes2.5.
from transformers import pipeline
pipe = pipeline(
"text-generation",
"timpal0l/Mistral-7B-v0.1-flashback-v2-instruct",
device_map="auto"
)
text = """
Hur många ägg har jag? Jag hade 10 ägg, sen gav jag bort 5 ägg.
Sen fick jag 3 ägg av en kompis.
"""
generated = pipe(f"USER:{text}ASSISTANT:", max_length=512, temperature=0.6)
print(generated[0]["generated_text"].split("ASSISTANT: ")[1:][0])
Output:
Du har 8 ägg. Här är resonemanget:
1. Du börjar med 10 ägg
2. Du ger bort 5 ägg, vilket lämnar dig med 10 - 5 = 5 ägg
3. Sedan får du 3 ägg av en kompis, vilket gör att du har 5 + 3 = 8 ägg.