Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangkx1
ollama_dcu
Commits
221bd71d
Commit
221bd71d
authored
Aug 14, 2024
by
wangkx1
Browse files
Update 00-build_ollama_base.md
parent
530813e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
tutorial_ollama/00-build_ollama_base.md
tutorial_ollama/00-build_ollama_base.md
+18
-7
No files found.
tutorial_ollama/00-build_ollama_base.md
View file @
221bd71d
# 基于DCU开源代码适配Ollama
DCU上v0.3.5 ollama模型的调度策略和 NV一致。
#### 现有问题:
1.
export HIP_VISIBLE_DEVICES=2,3,4,5 等多卡后, ollama依然会优先加载所有模型到2号卡。随机会加载模型到其他卡;
2.
v0.1.43不支持gemma2;
3.
自测NV上ollama-v0.3.4的模型调度逻辑: 在多卡环境下, 并非多卡去推理一个模型。而是一张卡推一个模型。一个模型只可能会在1张卡上。假如说同时 run 了8个模型,那均衡分配8个模型到8张卡上面。超出8个模型之后, 同一张卡上会有多个模型。
本工程的v0.3.5的多卡环境下模型调度策略已经和NV一致.
v0.3.5: https://developer.hpccube.com/codes/wangkx1/ollama_dcu/-/tree/v0.3.5
#### 拓展: ollama + open-webui:
教程见:
[
./tutorial_ollama/01-ollama_open-webui.md
](
./tutorial_ollama/01-ollama_open-webui.md
)
...
...
@@ -74,7 +84,7 @@ WORKDIR /app
```
bash
# sudo docker build -t <镜像名字> . # ollama_k100ai 可以更改为自己想要的镜像名字
# 构建涉及到大规模的代码编译, 时间预计花费15分钟左右
sudo
docker build
-t
ollama_k100ai
_v0.3.5
.
sudo
docker build
-t
ollama_k100ai .
```
### **4. 构建成功,查看镜像**
...
...
@@ -83,7 +93,7 @@ sudo docker build -t ollama_k100ai_v0.3.5 .
(
base
)
sugon@ailab:~
$
sudo
docker images
[
sudo
]
password
for
sugon:
REPOSITORY TAG IMAGE ID CREATED SIZE
ollama_k100ai
_v0.3.5
latest b60143c747ea About a minute ago 19.7GB
ollama_k100ai
latest b60143c747ea About a minute ago 19.7GB
image.sourcefind.cn:5000/dcu/admin/base/pytorch 2.1.0-ubuntu20.04-dtk24.04.1-py3.8 a474220de118 5 weeks ago 17.2GB
image.sourcefind.cn:5000/dcu/admin/base/pytorch 2.1.0-ubuntu20.04-dtk24.04.1-py3.10 a4dd5be0ca23 6 weeks ago 17.1GB
```
...
...
@@ -122,17 +132,18 @@ image.sourcefind.cn:5000/dcu/admin/base/pytorch 2.1.0-ubuntu20.04-dtk24.04.1-p
vim ~/.bashrc, 键盘输入 i
# export HIP_VISIBLE_DEVICES=0 # 不指定的话, 会默认使用所有卡。
export
HIP_VISIBLE_DEVICES
=
0
export
OLLAMA_HOST
=
"0.0.0.0:28120(将28120替换为自己选择的端口号)"
export
PATH
=
/app/ollama:
$PATH
# 如果有迁移的本地模型仓库, 需要增加环境变量
export
OLLAMA_MODELS
=
/local—model-path
切换至英文输入法, 键盘输入: Esc 后, 输入 wq + enter , 保存退出
;
激活环境变量:
source
~/.bashrc
```
<font
color=
red
>
**建议启动ollama容器的方法:**
</font>
在终端执行:
...
...
@@ -207,4 +218,4 @@ ollama create llama3-zh -f ./xxx.mf
### **10. ollama + open-webui**
见:
[
ollama_open-webui
](
.
/01-ollama_open-webui.md
)
见:
[
./tutorial_ollama/01-ollama_open-webui.md
](
./tutorial_ollama
/01-ollama_open-webui.md
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment