Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save itsdotscience/ca577257f15d586a9568a6d18a068932 to your computer and use it in GitHub Desktop.
Save itsdotscience/ca577257f15d586a9568a6d18a068932 to your computer and use it in GitHub Desktop.
Ollama and symlinks
Ollama and symlinks
2024 - its.science
For saving space and or unifying windows and linux upon a single local fs model repo for both the answer isn't sexy but it is simple.
c:\Users\test\.ollama\models\blobs>mklink sha256-00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686 sha25600cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b90699778
68d8dabad64422673686
symbolic link created for sha256-00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686 <<===>> sha25600cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64
422673686
c:\Users\test\.ollama\models\blobs>mklink sh256-effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778 sha256effee654126d95c2b388673af6b21bb5065d04e36e6f8
ca9fe47aada0435c778
symbolic link created for sh256-effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778 <<===>> sha256effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada
0435c778
c:\Users\test\.ollama\models\blobs>mklink sha256-b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab31288288ac sha256b8f642deb5f499997cc8599df192201706ab87f02fef
0ea52f12ab31288288ac
symbolic link created for sha256-b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab31288288ac <<===>> sha256b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab3
1288288ac
itadotscience@spotsandlots:~$ ollama create estopianmaid -f Modelfile.estopia
transferring model data
creating model layer
creating parameters layer
creating config layer
using already created layer sha256:0c080e38df51ad28006341ef096c817556c9c5502a2ae96996d9bc25ec591cf1
writing layer sha256:822e0ad862ed24ee4d532fe0df3881077774c09055cf5c16118de0b767db1806
writing layer sha256:bc461b0267794c1a0af9b6609b205d3e232f8c9e833030c4bf7a7764ca31ed1b
writing manifest
success
itadotscience@spotsandlots:~$ ls -l ~/.ollama/models/blobs/sha256:0c080e38df51ad28006341ef096c817556c9c5502a2ae96996d9bc25ec591cf1
lrwxrwxrwx 1 itadotscience itadotscience 45 May 19 22:26 /home/itadotscience/.ollama/models/blobs/sha256:0c080e38df51ad28006341ef096c817556c9c5502a2ae96996d9b
c25ec591cf1 -> /mnt/t/ai/models/EstopianMaid-13B-Q4_K_S.gguf
still there, still a symlink.
time=2024-05-19T22:21:35.046-04:00 level=INFO source=images.go:710 msg="total blobs: 3"
time=2024-05-19T22:21:35.046-04:00 level=INFO source=images.go:717 msg="total unused blobs removed: 0"
logs look good
how about on non-wsl linux? we'll tar up are 6 file test and see
1d root@i-have-the-openpower9:/tmp/fstest # ls -al
total 20
drwxr-xr-x 2 spotty spotty 180 May 20 01:57 .
drwxrwxrwt 1775 root root 40480 May 20 01:56 ..
lrwxrwxrwx 1 developer developer 71 May 19 22:15 sh256-effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778 -> sha256:effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778
lrwxrwxrwx 1 developer developer 71 May 19 22:12 sha256-00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686 -> sha256:00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686
lrwxrwxrwx 1 developer developer 55 May 19 22:06 sha256:00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686 -> /mnt/t/ai/models/TinyLlama-1.1B_ReLora_Bastard_8_0.gguf
lrwxrwxrwx 1 developer developer 71 May 19 22:16 sha256-b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab31288288ac -> sha256:b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab31288288ac
-rwxrwxrwx 1 developer developer 335 May 19 21:55 sha256:b8f642deb5f499997cc8599df192201706ab87f02fef0ea52f12ab31288288ac
-rwxrwxrwx 1 developer developer 30 May 19 21:55 sha256:effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778
-rwxr-xr-x 1 spotty spotty 10240 May 20 01:56 test.tar
as expected over on an ibm power9
finally lets test with ollama running on windows
c:\Users\test\.ollama\models\blobs>mklink sha256-0c080e38df51ad28006341ef096c817556c9c5502a2ae96996d9b t:\ai\models\TinyLlama-1.1B_ReLora_Bastard_8_0.gguf
symbolic link created for sha256-0c080e38df51ad28006341ef096c817556c9c5502a2ae96996d9b <<===>> t:\ai\models\TinyLlama-1.1B_ReLora_Bastard_8_0.gguf
c:\Users\test\.ollama\models\blobs>C:\Users\test\AppData\Local\Programs\Ollama\ollama.exe create test -f..\..\Modelfile.tinyllamarelora
transferring model data
using existing layer sha256:00cb8fdaf7bbdf3c4084fcf13aeeeeb4cc3b9069977868d8dabad64422673686
creating new layer sha256:effee654126d95c2b388673af6b21bb5065d04e36e6f8ca9fe47aada0435c778
creating new layer sha256:33e0cf026901889d517cd9ffb3c3480e4b89d2b4646043f50d4a593cc62fcb89
writing manifest
success
started ollama, logs look good
time=2024-05-20T02:27:11.586-04:00 level=INFO source=images.go:704 msg="total blobs: 3"
time=2024-05-20T02:27:11.587-04:00 level=INFO source=images.go:711 msg="total unused blobs removed: 0"
the symlinks between the - and : didn't trigger unused blob cleanup. <mic drop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment