Instructions to use model-scope/glm-4-9b-chat-GPTQ-Int8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use model-scope/glm-4-9b-chat-GPTQ-Int8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="model-scope/glm-4-9b-chat-GPTQ-Int8", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("model-scope/glm-4-9b-chat-GPTQ-Int8", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use model-scope/glm-4-9b-chat-GPTQ-Int8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "model-scope/glm-4-9b-chat-GPTQ-Int8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "model-scope/glm-4-9b-chat-GPTQ-Int8", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/model-scope/glm-4-9b-chat-GPTQ-Int8
- SGLang
How to use model-scope/glm-4-9b-chat-GPTQ-Int8 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 "model-scope/glm-4-9b-chat-GPTQ-Int8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "model-scope/glm-4-9b-chat-GPTQ-Int8", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "model-scope/glm-4-9b-chat-GPTQ-Int8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "model-scope/glm-4-9b-chat-GPTQ-Int8", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use model-scope/glm-4-9b-chat-GPTQ-Int8 with Docker Model Runner:
docker model run hf.co/model-scope/glm-4-9b-chat-GPTQ-Int8
GLM-4-9B-Chat-GPTQ-Int8-量化修复
【模型更新日期】
2024-06-18
【模型大小】
11.0GB
【06-05 情况告知】
- 目前需要用vllm entrypoint的方式来启动模型。
【更新日志】
2004-06-18
优化模型量化损失
2004-06-05 23:50
首次commit
【介绍】
GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开源版本。 在语义、数学、推理、代码和知识等多方面的数据集测评中,GLM-4-9B 及其人类偏好对齐的版本 GLM-4-9B-Chat 均表现出较高的性能。 除了能进行多轮对话,GLM-4-9B-Chat 还具备网页浏览、代码执行、自定义工具调用(Function Call)和长文本推理(支持最大 128K 上下文)等高级功能。 本代模型增加了多语言支持,支持包括日语,韩语,德语在内的 26 种语言。我们还推出了支持 1M 上下文长度(约 200 万中文字符)的模型。
【量化修复】
调优了现有 AWQ 与 GPTQ 量化算法的量化策略。带有量化修复标签的Int3模型,可以比肩默认AWQ与GPTQ算法的Int8模型的能力。
量化修复可以极大减少模型的
1.乱吐字、2.无限循环、3.长文能力丢失等量化损失造成的模型不可用的情况。调优后的量化模型,
AWQ与GPTQ模型在能力上没有表现出明显区别。同时考虑到GPTQ的vLLM引擎的并发推理效率最好,所以不再制作AWQ模型。待工作完成后补充...
【同期量化修复模型】
待工作完成后补充...
【模型下载】
from modelscope import snapshot_download
model_dir = snapshot_download('tclf90/模型名', cache_dir="本地路径")
【vLLM推理(目前仅限Linux)】
1. Python 简易调试
待工作完成后补充...
2. 类ChatGPT RESTFul API Server
>>> python -m vllm.entrypoints.openai.api_server --model 本地路径/tclf90/模型名称
- Downloads last month
- 7