在openi启智社区的dcu bw1000使用llama.cpp推理 stelterlab/Qwen3-Coder-30B-A3B-Instruct-AWQ(失败)

openi启智社区的dcu新推出 bw1000计算卡,不耗费积分,可以可劲用!

但是提供的镜像只有一个,感觉用起来很麻烦....

用llmfit看看模型情况

llmfit info stelterlab/Qwen3-Coder-30B-A3B-Instruct-AWQ

=== stelterlab/Qwen3-Coder-30B-A3B-Instruct-AWQ ===

Provider: stelterlab
Parameters: 4.6B
Quantization: Q4_K_M
Best Quant: Q8_0
Context Length: 262144 tokens
Use Case: Code generation and completion
Category: Coding
Released: 2025-07-31
Runtime: llama.cpp (est. ~17.2 tok/s)

Score Breakdown:
  Overall Score: 66.7 / 100
  Quality: 68  Speed: 43  Fit: 61  Context: 100
  Estimated Speed: 17.2 tok/s

Resource Requirements:
  Min VRAM: 2.4 GB
  Min RAM: 2.6 GB (CPU inference)
  Recommended RAM: 4.3 GB

MoE Architecture:
  Experts: 8 active / 128 total per token
  Active VRAM: 0.5 GB (vs 2.4 GB full model)

Fit Analysis:
  Status: 🟡 Good
  Run Mode: CPU+GPU
  Memory Utilization: 0.6% (2.6 / 405.5 GB)

Notes:
  MoE: insufficient VRAM for expert offloading
  Spilling entire model to system RAM
  Performance will be significantly reduced
  Best quantization for hardware: Q8_0 (model default: Q4_K_M)
  Estimated speed: 17.2 tok/s

安装llama.cpp

下载 llama.cpp源代码

git clone https://gitcode.com/GitHub_Trending/ll/llama.cpp

编译llama.cpp

cd llama.cpp cmake -B build cmake --build build --config Release


加入路径
 

export PATH=/root/llama.cpp/build/bin:$PATH

或者也可以直击用make install

cd build make install 

但是安装好后报错

oot@crdnotebook-2027598444851879937-denglf-12859:~/llama.cpp/build# llama-cli llama-cli: error while loading shared libraries: libmtmd.so.0: cannot open shared object file: No such file or directory root@crdnotebook-2027598444851879937-denglf-12859:~/llama.cpp/build# llama-gguf llama-gguf: error while loading shared libraries: libggml-base.so.0: cannot open shared object file: No such file or directory

原来是没有把路径加入的缘故,加入路径,问题解决:

export PATH=/root/llama.cpp/build/bin:$PATH

模型下载

安装modelscope

pip install modelscope

下载

from modelscope import snapshot_download snapshot_download('tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ', cache_dir="models")

推理

用llama-cli推理

llama-cli -m models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ

报错:

root@crdnotebook-2027598444851879937-denglf-12859:~# llama-cli -m models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ

Loading model... |gguf_init_from_file_impl: failed to read magic
llama_model_load: error loading model: llama_model_loader: failed to load model from models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ
llama_model_load_from_file_impl: failed to load model
llama_params_fit: encountered an error while trying to fit params to free device memory: failed to load model
gguf_init_from_file_impl: failed to read magic
llama_model_load: error loading model: llama_model_loader: failed to load model from models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ
llama_model_load_from_file_impl: failed to load model
common_init_from_params: failed to load model 'models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ'
srv    load_model: failed to load model, 'models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ'
 
Failed to load the model

看了一下,应该是这个模型: stelterlab/Qwen3-Coder-30B-A3B-Instruct-AWQ

问题是这个模型魔搭没有....

尝试用transformers推理

from transformers import AutoModelForCausalLM, AutoTokenizer model_name = "/root/models/tclf90/Qwen3-Coder-30B-A3B-Instruct-AWQ" # load the tokenizer and the model tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype="auto", device_map="auto" ) # prepare the model input prompt = "Write a quick sort algorithm." messages = [ {"role": "user", "content": prompt} ] text = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, ) model_inputs = tokenizer([text], return_tensors="pt").to(model.device) # conduct text completion generated_ids = model.generate( **model_inputs, max_new_tokens=65536 ) output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() content = tokenizer.decode(output_ids, skip_special_tokens=True) print("content:", content) 

也是失败

File /opt/conda/lib/python3.10/site-packages/transformers/quantizers/quantizer_awq.py:48, in AwqQuantizer.validate_environment(self, **kwargs) 46 def validate_environment(self, **kwargs): 47 if not is_gptqmodel_available(): ---> 48 raise ImportError( 49 "Loading an AWQ quantized model requires gptqmodel. Please install it with `pip install gptqmodel`" 50 ) 52 if not is_accelerate_available(): 53 raise ImportError("Loading an AWQ quantized model requires accelerate (`pip install accelerate`)") ImportError: Loading an AWQ quantized model requires gptqmodel. Please install it with `pip install gptqmodel`

总结

没调通,先搁置

llama.cpp是因为魔搭没有那个模型,所以模型不匹配

transformers是因为库的问题,需要重新安装torch等库,导致需要的库无法安装上,推理失败。

调试

报错ImportError: Loading an AWQ quantized model requires gptqmodel.

File /opt/conda/lib/python3.10/site-packages/transformers/quantizers/quantizer_awq.py:48, in AwqQuantizer.validate_environment(self, **kwargs) 46 def validate_environment(self, **kwargs): 47 if not is_gptqmodel_available(): ---> 48 raise ImportError( 49 "Loading an AWQ quantized model requires gptqmodel. Please install it with `pip install gptqmodel`" 50 ) 52 if not is_accelerate_available(): 53 raise ImportError("Loading an AWQ quantized model requires accelerate (`pip install accelerate`)") ImportError: Loading an AWQ quantized model requires gptqmodel. Please install it with `pip install gptqmodel`

安装提示执行

pip install gptqmodel

安装失败,

 Exception: Unable to detect torch version via uv/pip/conda/importlib. Please install torch >= 2.7.1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed to build 'gptqmodel' when getting requirements to build wheel

用conda试试

conda install gptqmodel

也失败了。

PackagesNotFoundError: The following packages are not available from current channels:

  - gptqmodel

Read more

Local Moondream2实战案例:独立开发者用其构建AI绘画灵感助手App

Local Moondream2实战案例:独立开发者用其构建AI绘画灵感助手App 你有没有遇到过这样的创作瓶颈?脑子里有个模糊的画面,却怎么也找不到合适的词语来描述它,AI绘画工具生成的图片总是差那么点意思。或者,在网上看到一张惊艳的图片,想学习它的构图和风格,却不知从何分析起。 对于独立开发者或小型创意团队来说,聘请专业的设计师或购买昂贵的创意工具往往成本高昂。今天,我要分享一个实战案例:如何利用一个名为 Local Moondream2 的超轻量级工具,快速构建一个完全运行在你个人电脑上的“AI绘画灵感助手”,彻底解决上述痛点。 1. 为什么选择Local Moondream2? 在开始动手之前,我们先搞清楚这个工具到底能做什么,以及它为何适合独立开发者。 简单来说,Local Moondream2 是一个给你的电脑装上“眼睛”的本地化应用。你上传任何图片,它都能“看懂”,并用英文告诉你图片里有什么。它的核心能力有三项,每一项都对创意工作者极具价值: * 详细描述图片:它能生成一段极其详尽的英文描述,远超简单的“一只猫在沙发上”。这段描述可以直接用作AI绘画(如S

芯片制造行业如何通过WebUploader+PHP加密传输工程文件的分片数据?

《一个码农的奇幻外包漂流记》 需求分析会:当甲方爸爸说出"简单"二字时… 各位老铁们好!我是辽宁沈阳一名"资深"前端码农(资深=头发少)。刚接到个外包需求,看完后我直接表演了个东北式懵逼: 甲方需求翻译大赛: * “要支持20G文件” → “希望你电脑硬盘够大” * “兼容IE9” → “希望你心态够好” * “1000+文件的文件夹结构” → “希望你记忆力超群” * “预算100元含3年维护” → “希望你家里有矿” * “7×24小时支持” → “希望你不需要睡觉” 技术选型:穷且益坚版解决方案 前端部分(Vue3+原生JS缝合怪版) // 文件夹上传器(贫困版)classDiaoSiFolderUploader{constructor(){this.chunkSize =5*1024*1024;// 5MB一片this.maxTry =99;// 最大重试次数(因为甲方网络是2G)this.

(附源码)基于Java web的在线考试系统的设计与实现-计算机毕设 33482

(附源码)基于Java web的在线考试系统的设计与实现-计算机毕设 33482

基于Java web的在线考试系统的设计与实现 摘  要 随着信息技术的迅速发展,教育行业对在线考试系统的需求不断增加,尤其是在数字化转型的背景下,传统的人工考试管理方式逐渐暴露出诸多问题,如效率低、资源浪费、信息滞后等。为了提升考试管理的效率和学生的学习体验,在线考试系统的开发显得尤为重要。 该系统的功能设计主要包括:学生在线报名、考试、成绩查询、错题管理等功能;教师可以发布、编辑试卷、批改作业、查看成绩分析等;管理员负责系统用户管理、考试资源调度、公告发布等。系统通过清晰的角色分配,确保各类用户能够高效使用系统,实现学习、教学和管理的数字化与智能化。 技术方案上,系统前端采用Vue.js框架构建,实现与用户的良好交互;后端使用SpringBoot框架,结合Java语言进行业务逻辑处理,确保系统的高性能和可扩展性;MySQL数据库用于存储用户数据、考试成绩、题库信息等,保障数据的高效管理和查询性能。 通过在线考试系统的实施能够大幅提升考试管理效率,减少人工干预,优化资源分配,增强学生的参与感和互动体验。该系统不仅能帮助教育机构实现信息化管理,还能为学生和教师提供便捷

微信小程序webview postmessage通信指南

微信小程序webview postmessage通信指南

需求概述 在微信小程序中使用 web-view 组件与内嵌网页进行双向通信,主要通过 postMessage 实现。以下是完整的配置和使用方法: 通信指南 微信小程序webview官方文档 1. 基础配置 小程序端配置 // app.json 或 page.json { "usingComponents": {}, "permission": { "scope.webView": { "desc": "用于网页和小程序通信" } } } 网页端配置 <!-- 内嵌网页需引入微信JS-SDK --> <script src="https://res.wx.qq.com/open/