Instructions to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/Mistral-7B-Instruct-Uz-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/Mistral-7B-Instruct-Uz-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Mistral-7B-Instruct-Uz-GGUF", filename="Mistral-7B-Instruct-Uz.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Mistral-7B-Instruct-Uz-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Mistral-7B-Instruct-Uz-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF 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 "QuantFactory/Mistral-7B-Instruct-Uz-GGUF" \ --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": "QuantFactory/Mistral-7B-Instruct-Uz-GGUF", "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 "QuantFactory/Mistral-7B-Instruct-Uz-GGUF" \ --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": "QuantFactory/Mistral-7B-Instruct-Uz-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Ollama:
ollama run hf.co/QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/Mistral-7B-Instruct-Uz-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/Mistral-7B-Instruct-Uz-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/Mistral-7B-Instruct-Uz-GGUF to start chatting
- Pi new
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Mistral-7B-Instruct-Uz-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Mistral-7B-Instruct-Uz-GGUF-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:# Run inference directly in the terminal:
llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:# Run inference directly in the terminal:
./llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:# Run inference directly in the terminal:
./build/bin/llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:Use Docker
docker model run hf.co/QuantFactory/Mistral-7B-Instruct-Uz-GGUF:QuantFactory/Mistral-7B-Instruct-Uz-GGUF
This is quantized version of behbudiy/Mistral-7B-Instruct-Uz created using llama.cpp
Original Model Card
Model Description
The Mistral-7B-Instruct-Uz model has been continually pre-trained and instruction-tuned using a mix of publicly available and syntheticly constructed Uzbek and English data to preserve its original knowledge while enhancing its capabilities. This model is designed to support various natural language processing tasks in Uzbek, such as machine translation, summarization, and dialogue systems, ensuring robust performance across these applications. For details regarding the performance metrics compared to the base model, see this post.
- Developed by:
Installation
It is recommended to use behbudiy/Mistral-7B-Instruct-Uz with mistral-inference. For HF transformers code snippets, please keep scrolling.
pip install mistral_inference
Download
from huggingface_hub import snapshot_download
from pathlib import Path
mistral_models_path = Path.home().joinpath('mistral_models', '7B-Instruct-Uz')
mistral_models_path.mkdir(parents=True, exist_ok=True)
snapshot_download(repo_id="behbudiy/Mistral-7B-Instruct-Uz", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
Chat
After installing mistral_inference, a mistral-chat CLI command should be available in your environment. You can chat with the model using
mistral-chat $HOME/mistral_models/7B-Instruct-Uz --instruct --max_tokens 256
Instructiong Following
from mistral_inference.transformer import Transformer
from mistral_inference.generate import generate
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
from mistral_common.protocol.instruct.messages import UserMessage
from mistral_common.protocol.instruct.request import ChatCompletionRequest
tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tokenizer.model.v3")
model = Transformer.from_folder(mistral_models_path)
completion_request = ChatCompletionRequest(messages=[UserMessage(content="O'zbekiston haqida ma'lumot ber.")])
tokens = tokenizer.encode_chat_completion(completion_request).tokens
out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
result = tokenizer.instruct_tokenizer.tokenizer.decode(out_tokens[0])
print(result)
Generate with transformers
If you want to use Hugging Face transformers to generate text, you can do something like this.
from transformers import pipeline
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
chatbot = pipeline("text-generation", model="behbudiy/Mistral-7B-Instruct-Uz", device='cuda')
chatbot(messages)
Information on Evaluation Method
To evaluate on the translation task, we used FLORES+ Uz-En / En-Uz datasets, where we merged the dev and test sets to create a bigger evaluation data for each Uz-En and En-Uz subsets. We used the following prompt to do one-shot Uz-En evaluation both for the base model and Uzbek-optimized model (for En-Uz eval, we changed the positions of the words "English" and "Uzbek").
prompt = f'''You are a professional Uzbek-English translator. Your task is to accurately translate the given Uzbek text into English.
Instructions:
1. Translate the text from Uzbek to English.
2. Maintain the original meaning and tone.
3. Use appropriate English grammar and vocabulary.
4. If you encounter an ambiguous or unfamiliar word, provide the most likely translation based on context.
5. Output only the English translation, without any additional comments.
Example:
Uzbek: "Bugun ob-havo juda yaxshi, quyosh charaqlab turibdi."
English: "The weather is very nice today, the sun is shining brightly."
Now, please translate the following Uzbek text into English:
"{sentence}"
'''
To assess the model's ability in Uzbek sentiment analysis, we used the risqaliyevds/uzbek-sentiment-analysis dataset, for which we created binary labels (0: Negative, 1: Positive) using GPT-4o API (refer to behbudiy/uzbek-sentiment-analysis dataset). We used the following prompt for the evaluation:
prompt = f'''Given the following text, determine the sentiment as either 'Positive' or 'Negative.' Respond with only the word 'Positive' or 'Negative' without any additional text or explanation.
Text: {text}"
'''
For Uzbek News Classification, we used risqaliyevds/uzbek-zero-shot-classification dataset and asked the model to predict the category of the news using the following prompt:
prompt = f'''Classify the given Uzbek news article into one of the following categories. Provide only the category number as the answer.
Categories:
0 - Politics (Siyosat)
1 - Economy (Iqtisodiyot)
2 - Technology (Texnologiya)
3 - Sports (Sport)
4 - Culture (Madaniyat)
5 - Health (Salomatlik)
6 - Family and Society (Oila va Jamiyat)
7 - Education (Ta'lim)
8 - Ecology (Ekologiya)
9 - Foreign News (Xorijiy Yangiliklar)
Now classify this article:
"{text}"
Answer (number only):"
'''
MMLU
We used this script.
More
For more details and examples, refer to the base model below: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3
- Downloads last month
- 316
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/Mistral-7B-Instruct-Uz-GGUF
Base model
mistralai/Mistral-7B-v0.3
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF:# Run inference directly in the terminal: llama-cli -hf QuantFactory/Mistral-7B-Instruct-Uz-GGUF: