Instructions to use shareAI/llama3.1-8b-instruct-dpo-zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use shareAI/llama3.1-8b-instruct-dpo-zh with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="shareAI/llama3.1-8b-instruct-dpo-zh", filename="llama3.1_8b_chinese_chat_q4_k_m-shareAI.gguf", )
llm.create_chat_completion( messages = "{\n \"question\": \"What is my name?\",\n \"context\": \"My name is Clara and I live in Berkeley.\"\n}" ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use shareAI/llama3.1-8b-instruct-dpo-zh with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M # Run inference directly in the terminal: llama-cli -hf shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M # Run inference directly in the terminal: llama-cli -hf shareAI/llama3.1-8b-instruct-dpo-zh: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 shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf shareAI/llama3.1-8b-instruct-dpo-zh: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 shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
Use Docker
docker model run hf.co/shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use shareAI/llama3.1-8b-instruct-dpo-zh with Ollama:
ollama run hf.co/shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
- Unsloth Studio new
How to use shareAI/llama3.1-8b-instruct-dpo-zh 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 shareAI/llama3.1-8b-instruct-dpo-zh 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 shareAI/llama3.1-8b-instruct-dpo-zh to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for shareAI/llama3.1-8b-instruct-dpo-zh to start chatting
- Docker Model Runner
How to use shareAI/llama3.1-8b-instruct-dpo-zh with Docker Model Runner:
docker model run hf.co/shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
- Lemonade
How to use shareAI/llama3.1-8b-instruct-dpo-zh with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull shareAI/llama3.1-8b-instruct-dpo-zh:Q4_K_M
Run and chat with the model
lemonade run user.llama3.1-8b-instruct-dpo-zh-Q4_K_M
List all available models
lemonade list
llama3.1-8b-instruct 中文DPO版
模型介绍
像原版instruct一样,喜欢用有趣中文和表情符号回答问题。
Github:https://github.com/CrazyBoyM/llama3-Chinese-chat
特点:偏好中文和emoji表情,且不损伤原instruct版模型能力。实测中文DPO版问答性能体验超过现在市面上任何llama3.1中文微调版 (微调会大面积破坏llama3.1原版能力,导致遗忘)
训练细节
DPO(beta 0.5) + lora rank128, alpha256 + 打开"lm_head", "input_layernorm", "post_attention_layernorm", "norm"层训练.
模型部署
网页脚本文件:https://github.com/CrazyBoyM/llama3-Chinese-chat/blob/main/deploy/web_streamlit_for_instruct_v2.py
已经在模型文件夹里内置了一份web.py,可以直接使用。
pip install streamlit
pip install transformers==4.40.1
streamlit run web.py ./llama3.1-8b-instruct-dpo-zh
模型下载
SDK下载
#安装ModelScope
pip install modelscope
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('shareAI/llama3.1-8b-instruct-dpo-zh')
Git下载
#Git模型下载
git clone https://www.modelscope.cn/shareAI/llama3.1-8b-instruct-dpo-zh.git
目前已经上传 Q4 K_M 的GGUF量化模型,后续将进一步进行手机端或边缘算力端展示
- Downloads last month
- 60
4-bit