首先进入ollama/models,将模型文件夹复制到models下。

找不到的同学,可以利用查找文件神器:everything.exe 下载链接:https://www.voidtools.com/zh-cn/downloads/

all-MiniLM-L12-v1模型文件内容如上:

步骤一:创建model.yaml文件

name: all-MiniLM-L12-v1
format: safetensors
architecture: all-MiniLM-L12-v1
description: All-MiniLM-L12-v1 model for text embedding

用记事本编辑以上内容,name改为自己模型的名字,保存后后缀改为yaml文件

步骤二:创建modules.json文件

[
  {
    "name": "all-MiniLM-L12-v1",
    "path": "model.safetensors",
    "format": "safetensors"
  }
]

同理记事本编辑后,保存改文件后缀.json,其中name改为模型名称。

完整结构如下:

步骤三:创建Modelfile.txt文件,内容如下:

FROM ./model.safetensors

右键 打开终端,运行:

ollama create all-MiniLM-L12-v1 -f C:\Users\Swee\.ollama\models\all-MiniLM-L12-v1\Modelfile

 其他模型改模型名称就欧克。

若报错:

gathering model components
copying file sha256:fba7637034542f691ef4b1ad735d664971e8d9723012a1973d4ee985742e8e72 100%
copying file sha256:8ca4a4f68fce4ed0c3dda8672b353e32ce56c231021411ac6fba12ba52ef803c 100%
copying file sha256:ae8eb28eeebfed037bc91d77a98b336ee3a215b04c21deff81388868b4321f97 100%
copying file sha256:0e8136d8f0917b2e1c5c4c2009b3955285ed6dba95fc330c1aea7777f8a74c37 100%
copying file sha256:303df45a03609e4ead04bc3dc1536d0ab19b5358db685b6f3da123d05ec200e3 100%
copying file sha256:be50c3628f2bf5bb5e3a7f17b1f74611b2561a3a27eeab05e5aa30f411572037 100%
converting model
Error: unknown architecture

则打开配置文件config.json

增加:

"architectures": ["BertModel"],

成功如下:

验证:ollama list

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐