Instructions to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4", dtype="auto") - llama-cpp-python
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4", filename="Tifa-Deepsex-14b-CoT-Chat-IQ4_NL.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL # Run inference directly in the terminal: llama-cli -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL # Run inference directly in the terminal: llama-cli -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
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 ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL # Run inference directly in the terminal: ./llama-cli -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
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 ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL # Run inference directly in the terminal: ./build/bin/llama-cli -hf ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
Use Docker
docker model run hf.co/ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
- LM Studio
- Jan
- Ollama
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with Ollama:
ollama run hf.co/ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
- Unsloth Studio
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 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 ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 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 ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 to start chatting
- Atomic Chat new
- Docker Model Runner
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with Docker Model Runner:
docker model run hf.co/ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
- Lemonade
How to use ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ValueFX9507/Tifa-Deepsex-14b-CoT-GGUF-Q4:IQ4_NL
Run and chat with the model
lemonade run user.Tifa-Deepsex-14b-CoT-GGUF-Q4-IQ4_NL
List all available models
lemonade list
关于discussions中提到问题以及最佳实践的思考及可能解决方案
discussion #8和#12都提到了生成文字混乱的问题,且#8表示<think>标签丢失,我使用的解决方案是利用llama.cpp的GBNF语法文件强制模型体现CoT。具体如下:
root ::= "<think>" cot "</think>" response
cot ::= [^<]+
response ::= .*
将其保存为think.gbnf, 然后在llama.cpp启动时(这里以llama-server为例)进行引用即可生效:
llama-server -m Tifa-Deepsex-14b-CoT-Q4_K_M.gguf --grammar-file think.gbnf
(请注意根据实际情况修改文件名称及路径)
另外就是关于给出的最佳实践。对于普通用户来说,很难直接触及发送到API的prompt,在应用GBNF语法的情况下也使得由客户端给出思维链后继续推理有些困难。对于这种情况,一种可能的解决方案就是老办法,将角色的相关信息直接写进系统提示词:
你正在扮演${角色身份},正${场景信息}。${按需添加背景信息}你需要需要体现人物${气质、性格特征},然后适当利用括号加入${题材}特有的环境描写,并且保持对话的${对话风格}风格。你必须完全沉浸于该角色及情境,并以该角色可能的思维方式和语气进行思考和回答。严禁脱离角色。
对于最佳实践中的楚夜,上述提示词中的空位填入后如下所示:
你正在扮演流浪武士楚夜,正站在长安城屋顶上。你需要需要体现人物孤傲的气质,然后适当利用括号加入武侠特有的环境描写,并且保持对话的冷峻风格。你必须完全沉浸于该角色及情境,并以该角色可能的思维方式和语气进行思考和回答。严禁脱离角色。
这个模型我还没有很深入的进行探索,但是根据我调猫娘的经验像这样应该差不多了。希望能帮上忙。
补充:最新版的llama.cpp的llama-server已经自带去除上下文思考内容了
好方法 推
順便分享 對於使用llama-cpp-python的我
使用方式是這樣的:
from llama_cpp import Llama, LlamaGrammar
model = Llama(model_path="Tifa-Deepsex-14b-CoT-F16.gguf",
n_gpu_layers=-1,# 使用 GPU 的層數,-1 表示全部在 GPU 上執行
n_ctx=8000
)
grammar = LlamaGrammar.from_file("think.gbnf")
response = model.create_chat_completion(
temperature=user_tempature,
max_tokens=user_max_tokens,
top_p=user_top_p,
repeat_penalty=user_repeat_penalty,
messages=[{
"role": "user",
"content": user_message
}],
stop=["<user>"],
grammar=grammar
)