Instructions to use zaursamedov1/FIxtral with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zaursamedov1/FIxtral with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zaursamedov1/FIxtral") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zaursamedov1/FIxtral") model = AutoModelForCausalLM.from_pretrained("zaursamedov1/FIxtral") 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
- vLLM
How to use zaursamedov1/FIxtral with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zaursamedov1/FIxtral" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zaursamedov1/FIxtral", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zaursamedov1/FIxtral
- SGLang
How to use zaursamedov1/FIxtral 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 "zaursamedov1/FIxtral" \ --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": "zaursamedov1/FIxtral", "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 "zaursamedov1/FIxtral" \ --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": "zaursamedov1/FIxtral", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zaursamedov1/FIxtral with Docker Model Runner:
docker model run hf.co/zaursamedov1/FIxtral
Simple Use Case
This section demonstrates a simple use case of how to interact with our model to solve problems in a step-by-step, friendly manner.
Define the Function
We define a function get_completion which takes user input, combines it with a predefined system prompt, and then sends this combined prompt to our model. The model's response is then printed out.
Here's how the function is implemented:
import torch
from transformers import pipeline
import os
# Load model
test_pipeline = pipeline(model="zaursamedov1/FIxtral",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto")
### Define the function
def get_completion(input):
system = "Think step by step and solve the problem in a friendly way."
prompt = f"#### System: {system}\\n#### User: \\n{input}\\n\\n#### Response from FIxtral model:"
print(prompt)
fixtral_prompt = test_pipeline(prompt, max_new_tokens=500)
return fixtral_prompt[0]["generated_text"]
# Let's prompt
prompt = "problem"
print(get_completion(prompt))
- Downloads last month
- 5