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
02ef729a
"tests/clip/test_modeling_clip.py" did not exist on "c164c651dc382635f1135cf843e8fbd523d5e293"
Commit
02ef729a
authored
Aug 13, 2024
by
wangkx1
Browse files
verify success
parent
35cc8f36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
README.md
README.md
+6
-13
tutorial_ollama/launch_ollama.sh
tutorial_ollama/launch_ollama.sh
+2
-2
No files found.
README.md
View file @
02ef729a
# 基于DCU开源代码适配Ollama
#### 现有问题:
1.
export HIP_VISIBLE_DEVICES=2,3,4,5 等多卡后, ollama依然会优先加载所有模型到2号卡。随机会加载模型到其他卡;
2.
自测NV上ollama-v0.3.4的模型调度逻辑: 在多卡环境下, 并非多卡去推理一个模型。而是一张卡推一个模型。一个模型只可能会在1张卡上。假如说同时 run 了8个模型,那均衡分配8个模型到8张卡上面。超出8个模型之后, 同一张卡上会有多个模型。
3.
v0.1.43不支持gemma2;
4.
想要尝试新的ollama模型调度策略,可以使用 https://developer.hpccube.com/codes/OpenDAS/ollama 下的 v0.3.5 版本, 自行验证;
DCU上v0.3.5 ollama模型的调度策略和 NV一致。
#### 拓展: ollama + open-webui:
...
...
@@ -80,7 +75,7 @@ WORKDIR /app
```
bash
# sudo docker build -t <镜像名字> . # ollama_k100ai 可以更改为自己想要的镜像名字
# 构建涉及到大规模的代码编译, 时间预计花费15分钟左右
sudo
docker build
-t
ollama_k100ai .
sudo
docker build
-t
ollama_k100ai
_v0.3.5
.
```
### **4. 构建成功,查看镜像**
...
...
@@ -89,7 +84,7 @@ sudo docker build -t ollama_k100ai .
(
base
)
sugon@ailab:~
$
sudo
docker images
[
sudo
]
password
for
sugon:
REPOSITORY TAG IMAGE ID CREATED SIZE
ollama_k100ai
latest b60143c747ea About a minute ago 19.7GB
ollama_k100ai
_v0.3.5
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
```
...
...
@@ -128,19 +123,17 @@ image.sourcefind.cn:5000/dcu/admin/base/pytorch 2.1.0-ubuntu20.04-dtk24.04.1-p
vim ~/.bashrc, 键盘输入 i
下滑至文件末尾增加相关环境变量, 暂时仅支持设置0号卡和1号卡
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>
在终端执行:
...
...
tutorial_ollama/launch_ollama.sh
View file @
02ef729a
...
...
@@ -2,11 +2,11 @@
set
-x
docker_image
=
ollama_k100ai_v
1
docker_image
=
ollama_k100ai_v
0.3.5
tag
=
latest
export
MY_CONTAINER
=
"
base_dtk24.04.1_torch_ollama_k100ai
"
export
MY_CONTAINER
=
"
ollama_v0.3.5_v0
"
num
=
`
docker ps
-a
|grep
"
$MY_CONTAINER
"
|wc
-l
`
echo
$num
echo
$MY_CONTAINER
...
...
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