华为升腾910b3 八卡 跑deepseek-r1 671b

 适配Dockerfile

参考项目:https://github.com/zhongTao99/ollama

:[Ascend ] add ascend npu support by zhongTao99 · Pull Request #5872 · ollama/ollama · GitHubIt's a draft for ascend npu support, It can get gpu info for npu, and need to be optimizationfix:#5315The pre-builded ollama that support Huawei Atlas A2 series as the backend can be obtained fr...https://github.com/ollama/ollama/pull/5872https://github.com/ollama/ollama/pull/5872

直接docker 拉取镜像:
 

docker pull leopony/ollama:latest
docker save -o ollama.tar leopony/ollama:latest

docker 镜像转 singularity 镜像:
 

singularity build ollama.sif oci-archive:ollama.tar
singularity exec \
  --contain \
  --bind /dev/davinci0:/dev/davinci0 \
  --bind /dev/davinci_manager:/dev/davinci_manager \
  --bind /dev/devmm_svm:/dev/devmm_svm \
  --bind /dev/hisi_hdc:/dev/hisi_hdc \
  --bind /usr/local/dcmi:/usr/local/dcmi \
  --bind /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
  --bind /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
  --bind /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
  --bind /etc/ascend_install.info:/etc/ascend_install.info \
  --bind /share/home/lyzeng24/.ollama:/share/home/lyzeng24/.ollama \
  --network-args "portmap=11434:11434/tcp" \
  ollama.sif /bin/bash
  
-c "source /usr/local/Ascend/ascend-toolkit/set_env.sh && /bin/bash"

ollama serve &

虽然能顺利识别华为升腾NPU,也能成功加载但是无法推理。

可能原因:
ollama_Atlas_A2_series_cann8.0.rc2.bin.gz

不适配910b3,是A2编译的。

### 部署 DeepSeek华为升腾 910B #### 准备环境 为了确保 DeepSeek 能够顺利运行于华为升腾 910B 平台上,需先安装必要的依赖库并配置好开发环境。这通常涉及到 CANN (Compute Architecture for Neural Networks) 的设置以及 Python 开发包的准备[^1]。 #### 安装 CANN 及其组件 CANN 是专门为 Atlas 系列产品设计的一套完整的软件栈,它提供了从底层驱动到高层框架的支持。对于想要利用 Ascend NPU 进行推理或训练的应用程序来说,安装最新版本的 CANN 是必不可少的第一步。通过官方文档可以获取详细的安装指南和兼容性列表。 #### 获取预编译模型或转换现有模型 如果计划直接使用已经过优化处理过的预训练模型,则可以直接下载对应格式文件;而对于自定义创建的新模型,则可能需要借助工具链完成由 TensorFlow 或 PyTorch 到 MindSpore IR 表达形式之间的迁移工作。MindConverter 工具能够帮助简化这一过程。 #### 编写应用程序接口调用代码 一旦完成了上述准备工作之后,就可以着手编写具体的业务逻辑部分了。下面给出了一段简单的 Python 示例代码用于加载已有的 .om 文件并通过 AIPP 接口执行前向传播操作: ```python from mindspore import context, Tensor import numpy as np context.set_context(device_target="Ascend", device_id=0) def load_model_and_predict(input_data_path): graph = Graph() with open('model.om', 'rb') as f: model_content = f.read() session = Session(graph) input_tensor = Tensor(np.fromfile(input_data_path, dtype=np.float32).reshape((1, 3, 224, 224))) output_tensors = session.run([input_tensor]) return output_tensors[0].asnumpy().tolist() ``` 此段脚本展示了如何初始化上下文环境、读取 OM 模型数据流、构建会话对象并向其中传入输入张量以获得预测结果的过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值