1
1
import ollama
2
2
import yaml
3
3
from ollama import delete
4
+ import sys
4
5
5
- def check_and_pull_models (model_option = 0 ):
6
+ def check_and_pull_models (model_option : int = 0 ):
6
7
"""
7
8
This function checks for Ollama models based on the provided integer parameter.
8
9
@@ -14,12 +15,12 @@ def check_and_pull_models(model_option=0):
14
15
15
16
models_to_check = ["gemma:2b" , "tinyllama:latest" , "llava:latest" ]
16
17
if model_option == 1 :
17
- models_to_check .append ()
18
+ models_to_check .append ("llama2-uncensored:latest" )
18
19
models = ollama .list ()
19
20
available_models = {model ["name" ]: model for model in models ["models" ]}
20
21
model_list = list (available_models .keys ())
21
- models_to_pull = set (models_to_check ) - set (model_list )
22
-
22
+ models_to_pull = set (models_to_check ) - set (model_list )
23
+
23
24
if models_to_pull :
24
25
print ("Models to pull:" )
25
26
for model_name in models_to_pull :
@@ -44,7 +45,7 @@ def create_knowly_models(models_list):
44
45
ollama .create (model = "KnowlyTinyLlama" ,path = "./modelfiles/tinyllama/Modelfile" )
45
46
elif "llava" in model :
46
47
ollama .create (model = "KnowlyLlava" ,path = "./modelfiles/llava/Modelfile" )
47
- else :
48
+ elif "llama2" in model :
48
49
ollama .create (model = "KnowlyLlama2" ,path = "./modelfiles/llama2/Modelfile" )
49
50
50
51
print ("Model finetuning complete." )
@@ -71,4 +72,5 @@ def delete_ollama_model(model_name: str) -> None:
71
72
72
73
73
74
if __name__ == "__main__" :
74
- check_and_pull_models ()
75
+ n = int (sys .argv [- 1 ])
76
+ check_and_pull_models (model_option = n )
0 commit comments