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
c4070499
Commit
c4070499
authored
Aug 14, 2024
by
wangkx1
Browse files
Update 00-build_ollama_base.md
parent
95005046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
tutorial_ollama/00-build_ollama_base.md
tutorial_ollama/00-build_ollama_base.md
+16
-10
No files found.
tutorial_ollama/00-build_ollama_base.md
View file @
c4070499
# 基于DCU开源代码适配Ollama
DCU上v0.3.5 ollama模型的调度策略和 NV一致。
教程见:
[
./tutorial_ollama/01-ollama_open-webui.md
](
./tutorial_ollama/01-ollama_open-webui.md
)
## 适配步骤
工程地址:http://developer.hpccube.com/codes/wangkx1/ollama_dcu.git
...
...
@@ -68,7 +74,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. 构建成功,查看镜像**
...
...
@@ -77,7 +83,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
```
...
...
@@ -85,6 +91,8 @@ image.sourcefind.cn:5000/dcu/admin/base/pytorch 2.1.0-ubuntu20.04-dtk24.04.1-p
### **5. 进入容器**
进入指定文件夹:
`cd tutorial_ollama`
<font
color=
red
>
**注意点:**
</font>
-
`launch_`
前缀的脚本之中的
`export MY_CONTAINER="sg_t0"`
,
`sg_t0`
是容器的名字,需要自己修改,使得名字需要唯一,才能启动属于自己的容器。如果名字重复很可能会进入别人的容器;
...
...
@@ -114,19 +122,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>
在终端执行:
...
...
@@ -175,7 +181,7 @@ ollama 执行`run`命令, 会自动拉取模型
对话过程中可以输入
`本地图像的绝对路径`
,多模态大模型会对图片内容自动进行一个描述
### **
8
自定义模型**
### **
9.
自定义模型**
我们可以利用下载到本地的GGUF模型文件,创建一个Modelfile模型描述文件给ollama使用。
...
...
@@ -198,7 +204,7 @@ ollama create llama3-zh -f ./xxx.mf
### **
9
. ollama + open-webui**
### **
10
. ollama + open-webui**
见:
[
./tutorial_ollama/01-ollama_open-webui.md
](
./tutorial_ollama/01-ollama_open-webui.md
)
\ No newline at end of file
见:
[
ollama_open-webui
](
./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