Instructions to use taide/TAIDE-LX-7B-Chat-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use taide/TAIDE-LX-7B-Chat-4bit with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="taide/TAIDE-LX-7B-Chat-4bit", filename="taide-7b-a.2-q4_k_m.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use taide/TAIDE-LX-7B-Chat-4bit with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M # Run inference directly in the terminal: llama-cli -hf taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M # Run inference directly in the terminal: llama-cli -hf taide/TAIDE-LX-7B-Chat-4bit: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 taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf taide/TAIDE-LX-7B-Chat-4bit: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 taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
Use Docker
docker model run hf.co/taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use taide/TAIDE-LX-7B-Chat-4bit with Ollama:
ollama run hf.co/taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
- Unsloth Studio new
How to use taide/TAIDE-LX-7B-Chat-4bit 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 taide/TAIDE-LX-7B-Chat-4bit 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 taide/TAIDE-LX-7B-Chat-4bit to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for taide/TAIDE-LX-7B-Chat-4bit to start chatting
- Docker Model Runner
How to use taide/TAIDE-LX-7B-Chat-4bit with Docker Model Runner:
docker model run hf.co/taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
- Lemonade
How to use taide/TAIDE-LX-7B-Chat-4bit with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull taide/TAIDE-LX-7B-Chat-4bit:Q4_K_M
Run and chat with the model
lemonade run user.TAIDE-LX-7B-Chat-4bit-Q4_K_M
List all available models
lemonade list
does not appear to have a file named config.json
我想用transformer load TAIDE-LX-7B-Chat-4bit 出現以下錯誤,應該是沒有 config.json
code:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("taide/TAIDE-LX-7B-Chat-4bit", load_in_4bit=True, device_map="auto", token="HF_token")
OSError: taide/TAIDE-LX-7B-Chat-4bit does not appear to have a file named config.json. Checkout
您好,
repo 需改為 "taide/TAIDE-LX-7B-Chat"。
Best regards.
也有同樣的問題+1,因為想使用TAIDE-LX-7B-Chat-4bit輕量的先測試,一樣是 說沒有 config.json
TAIDE-LX-7B-Chat-4bit裡面只有這些檔案,我是一個個下載到/taide/TAIDE-LX-7B-Chat-4bit路徑下的資料夾裡面
.gitattributes、README.md、README_en.md、taide-7b-a.2-q4_k_m.gguf
但是一樣有這樣的錯誤,不曉得該怎麼修改 謝謝
torch.no_grad()
def stream_generate():
device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "./taide/TAIDE-LX-7B-Chat-4bit" ## 我的python程式碼和taide資料夾是同樣的路徑下,不確定是否OK
token = "#########" #put your own authentication token here ## 這是要輸入自己的HuggingFace的Access Token嗎?
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
model = LlamaForCausalLM.from_pretrained(model_name,
torch_dtype=torch.float16,
use_safetensors=True,
device_map=device,
load_in_8bit=True)
model.eval()
您好,
- 請改成下載 https://huggingface.co/taide/TAIDE-LX-7B-Chat
- model_name = "./taide/TAIDE-LX-7B-Chat-4bit"
改成
model_name = "./taide/TAIDE-LX-7B-Chat"
Best regards.
您好,
- 請改成下載 https://huggingface.co/taide/TAIDE-LX-7B-Chat
- model_name = "./taide/TAIDE-LX-7B-Chat-4bit"
改成
model_name = "./taide/TAIDE-LX-7B-Chat"Best regards.
謝謝您 那請問
token = "#########" #put your own authentication token here ## 這是要輸入我自己的HuggingFace的Access Token嗎?
您好,
完整的測試程式碼(只需把 my_token 填入您自己的 access token),如下,請參考:
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
# https://huggingface.co/docs/hub/security-tokens#user-access-tokens
my_token = "***********************************************************************" # 這行需換成您自己的 access token
# load model
model_name = "taide/TAIDE-LX-7B-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False, token=my_token)
model = AutoModelForCausalLM.from_pretrained(model_name, load_in_4bit=True, device_map="auto", token=my_token)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
# prepare prompt
question = "臺灣最高的建築物是?"
chat = [
{"role": "user", "content": f"{question}"},
]
prompt = tokenizer.apply_chat_template(chat, tokenize=False)
# generate response
x = pipe(f"{prompt}", max_new_tokens=1024)
print(f"TAIDE: {x}")
Best regards.
@NCGWRjason 我成功執行TAIDE-LX-7B-Chat-4bit
我的方式如下:
1.將taide-7b-a.2-q4_k_m.gguf下載下來
2.然後我用llama_cpp來運行
只是因模型小所以輸出的回答不多有時發生說到一半而中止