Instructions to use ngxson/Vistral-7B-ChatML with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ngxson/Vistral-7B-ChatML with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ngxson/Vistral-7B-ChatML") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ngxson/Vistral-7B-ChatML") model = AutoModelForCausalLM.from_pretrained("ngxson/Vistral-7B-ChatML") 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]:])) - llama-cpp-python
How to use ngxson/Vistral-7B-ChatML with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ngxson/Vistral-7B-ChatML", filename="vistral-7b-chatml-Q4_K_M.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 ngxson/Vistral-7B-ChatML with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ngxson/Vistral-7B-ChatML:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ngxson/Vistral-7B-ChatML:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ngxson/Vistral-7B-ChatML:Q4_K_M # Run inference directly in the terminal: llama-cli -hf ngxson/Vistral-7B-ChatML: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 ngxson/Vistral-7B-ChatML:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ngxson/Vistral-7B-ChatML: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 ngxson/Vistral-7B-ChatML:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ngxson/Vistral-7B-ChatML:Q4_K_M
Use Docker
docker model run hf.co/ngxson/Vistral-7B-ChatML:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use ngxson/Vistral-7B-ChatML with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ngxson/Vistral-7B-ChatML" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ngxson/Vistral-7B-ChatML", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ngxson/Vistral-7B-ChatML:Q4_K_M
- SGLang
How to use ngxson/Vistral-7B-ChatML 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 "ngxson/Vistral-7B-ChatML" \ --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": "ngxson/Vistral-7B-ChatML", "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 "ngxson/Vistral-7B-ChatML" \ --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": "ngxson/Vistral-7B-ChatML", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ngxson/Vistral-7B-ChatML with Ollama:
ollama run hf.co/ngxson/Vistral-7B-ChatML:Q4_K_M
- Unsloth Studio new
How to use ngxson/Vistral-7B-ChatML 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 ngxson/Vistral-7B-ChatML 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 ngxson/Vistral-7B-ChatML to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ngxson/Vistral-7B-ChatML to start chatting
- Docker Model Runner
How to use ngxson/Vistral-7B-ChatML with Docker Model Runner:
docker model run hf.co/ngxson/Vistral-7B-ChatML:Q4_K_M
- Lemonade
How to use ngxson/Vistral-7B-ChatML with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ngxson/Vistral-7B-ChatML:Q4_K_M
Run and chat with the model
lemonade run user.Vistral-7B-ChatML-Q4_K_M
List all available models
lemonade list
Model Description
This model is finetuned from Viet-Mistral/Vistral-7B-Chat. The dataset is taken from bkai-foundation-models/vi-self-chat-sharegpt-format
This is a low rank finetune to add support for chatml template. While the template does not affect model performance, it would be nice to support chatml since most of models based on Mistral already using it.
The format looks like this:
<|im_start|>system
Provide some context and/or instructions to the model.
<|im_end|>
<|im_start|>user
The user’s message goes here
<|im_end|>
<|im_start|>assistant
How to use it
The recommended way is to use the GGUF vistral-7b-chatml-Q4_K_M.gguf file included in this repository. Run it via llama.cpp (remember to pass -cml argument to use chatml template)
./main -m vistral-7b-chatml-Q4_K_M.gguf -p "Bạn là một trợ lí Tiếng Việt nhiệt tình và trung thực." -cml
Additionally, you can run the python3 run.py inside this repository to try the model using transformers library. This it not the recommended way since you may need to change some params inside in order to make it work.
This is an example of a conversation using llama.cpp:
- <|im_start|>system
- Bạn là một trợ lí Tiếng Việt nhiệt tình và trung thực.<|im_end|>
- <|im_start|>user
xin chào
- Tôi là một trợ lý AI được tạo ra để hỗ trợ con người. Bạn có câu hỏi gì về chủ đề nào đó?<|im_end|>
trợ lý AI là gì? bạn giải thích được không?
- Trợ lý AI là một chương trình máy tính sử dụng trí tuệ nhân tạo và học máy để hỗ trợ con người trong nhiều công việc khác nhau. Nó có thể hiểu và xử lý ngôn ngữ tự nhiên, nhận biết hình ảnh và âm thanh cũng như đưa ra các đề xuất hay câu trả lời phù hợp cho các yêu cầu của bạn.<|im_end|>
ồ, cảm ơn, vậy bạn có thể làm gì?
- Tôi được thiết kế để giúp đỡ con người trong nhiều công việc như giải đáp các câu hỏi, trả lời những vấn đề liên quan đến cuộc sống hàng ngày của họ. Tôi cũng hỗ trợ nghiên cứu và phân tích dữ liệu để đưa ra dự đoán hay tư vấn cho doanh nghiệp hoặc cá nhân.<|im_end|>
tức là sao?
- Ví dụ, nếu bạn đang thắc mắc về một chủ đề nào đó và không biết phải bắt đầu tìm kiếm ở đâu hay làm thế nào để hiểu rõ hơn về nó thì tôi có thể giúp bạn. Tôi cũng có khả năng đọc và phân tích dữ liệu từ nhiều nguồn khác nhau như các tài liệu nghiên cứu khoa học hoặc thông tin trên mạng xã hội, sau đó đưa ra những giải thích chi tiết cho vấn đề của bạn.<|im_end|>
Training
You can also look at the training code in the finetune.py file.
For tokenizer, I changed these things:
- Token
[INST]to<|im_start|>, make it become special token - Token
[/INST]to<|im_end|>, make it become special token - Change to
eos_tokento<|im_end|> - Update
chat_templateto chatml, taken from this example
Additionally, there is a checkpoint file in my repository if you want to merge the LORA yourself.
More information
Disclaimer: I'm not expert in machine learning, my background is from cybersecurity so the making of this model is a "hobby" to me. Training is done using a VPS on Google Cloud, I paid with my own money.
If you want to discuss, feel free to contact me at contact at ngxson dot com - ngxson.com
- Downloads last month
- 70