Alexander Rødseth pushed to branch main at Arch Linux / Packaging / Packages / 
ollama-tinyllama


Commits:
67f1b388 by Alexander F. Rødseth at 2024-09-04T15:38:05+02:00
upgpkg: 0.0.1-1

- - - - -


3 changed files:

- .SRCINFO
- PKGBUILD
- + model.install


Changes:

=====================================
.SRCINFO
=====================================
@@ -1,8 +1,9 @@
 pkgbase = ollama-tinyllama
        pkgdesc = The tinyllama (1B) large language model (LLM), for Ollama
-       pkgver = 1.0.0
+       pkgver = 0.0.1
        pkgrel = 1
        url = https://github.com/jzhang38/TinyLlama
+       install = model.install
        arch = any
        license = Apache-2.0
        makedepends = netcat


=====================================
PKGBUILD
=====================================
@@ -1,11 +1,11 @@
 # Maintainer: Alexander F. Rødseth <[email protected]>
 
-# This package is mainly meant to demonstrate how to package Ollama models, 
with the AUR in mind.
-# See https://ollama.com/models for an overview of model names and tags.
+# This package demonstrates one way of packaging Ollama models.
+# See https://ollama.com/models for an overview of available model names and 
tags.
 
 pkgname=ollama-tinyllama
-_tag=1.1b
-pkgver=1.0.0
+_tag=latest
+pkgver=0.0.1
 pkgrel=1
 pkgdesc='The tinyllama (1B) large language model (LLM), for Ollama'
 arch=(any)
@@ -15,6 +15,7 @@ depends=(ollama)
 makedepends=(netcat python)
 optdepends=('ollama-cuda: for using the GPU'
             'ollama-rocm: for using the GPU')
+install=model.install
 
 prepare() {
   # Find a free port. This is currently a bit awkward, see also: 
https://github.com/ollama/ollama/issues/3369
@@ -27,10 +28,11 @@ prepare() {
   # Start Ollama
   ollama serve &
   serve_pid=$!
-  sleep 5
 
-  # Download the model
-  ollama pull "${pkgname#ollama-}:$_tag"
+  # Try downloading the model with Ollama. Wait 1 second if the server is not 
ready yet. Try 10 times.
+  for i in {1..10}; do
+    ollama pull "${pkgname#ollama-}:$_tag" && break || sleep 1
+  done
 
   # Stop Ollama
   kill $serve_pid
@@ -38,5 +40,5 @@ prepare() {
 
 package() {
   install -d "$pkgdir/var/lib/ollama"
-  cp -r models "$pkgdir/var/lib/ollama/"
+  cp -r models/. "$pkgdir/var/lib/ollama/"
 }


=====================================
model.install
=====================================
@@ -0,0 +1,4 @@
+#!/bin/sh
+post_install() {
+  chown -R ollama:ollama /var/lib/ollama
+}



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/ollama-tinyllama/-/commit/67f1b388a85b1f3015ea28688a5fd16395c77e42

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/ollama-tinyllama/-/commit/67f1b388a85b1f3015ea28688a5fd16395c77e42
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to