MiniCPM4-0.5B-QAT-Int4-GPTQ-format 小显存llm

MiniCPM4-0.5B-QAT-Int4-GPTQ-format · 模型库

python 复制代码
from modelscope import AutoTokenizer
from vllm import LLM, SamplingParams

model_name = "OpenBMB/MiniCPM4-0.5B-QAT-Int4-GPTQ-format"
prompt = [{"role": "user", "content": "推荐5个北京的景点。"}]

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
input_text = tokenizer.apply_chat_template(prompt, tokenize=False, add_generation_prompt=True)

llm = LLM(
    model=model_name,
    quantization="gptq_marlin",
    trust_remote_code=True,
    max_num_batched_tokens=32768,
    dtype="bfloat16", 
    gpu_memory_utilization=0.8, 
)
sampling_params = SamplingParams(top_p=0.7, temperature=0.7, max_tokens=1024, repetition_penalty=1.02)

outputs = llm.generate(prompts=input_text, sampling_params=sampling_params)

print(outputs[0].outputs[0].text)
相关推荐
不完备智能2 分钟前
🦌 DeerFlow 2.0 深度解析:字节跳动开源的"超级 Agent harness"架构揭秘
人工智能
阿木木AEcru2 分钟前
DeepSeek 崩了 13 小时,不是故障,是 V4 在换引擎
人工智能
小小工匠3 分钟前
Superpowers - 09 从构思到落地:如何用「计划编写与任务粒度」驾驭 AI 时代的软件开发
人工智能·skills·superpowers
SPC的存折3 分钟前
1、MySQL故障排查与运维案例
linux·运维·服务器·数据库·mysql
阿聪谈架构3 分钟前
第07章(下):LangGraph 工作流进阶 —— 检查点、人工介入与多 Agent 协作
人工智能·后端
Run_Teenage4 分钟前
Linux:认识信号,理解信号的产生和处理
linux·运维·算法
小小工匠5 分钟前
Superpowers - 08 在 AI 时代重写「需求评审会」:深入解读 Superpowers 的头脑风暴与设计规范机制
人工智能·skills·superpowers
橘子编程13 分钟前
Hermes Agent 完整使用指南
人工智能
yuhulkjv33516 分钟前
AI导出的Excel公式失效
人工智能·ai·chatgpt·excel·豆包·deepseek·ai导出鸭
Deitymoon17 分钟前
linux——TCP服务器获取客户端IP地址
linux·服务器·tcp/ip