forked from AaronFeng753/Ollama-Model-Dumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImport_Models.py
22 lines (17 loc) · 830 Bytes
/
Import_Models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import subprocess
def scan_folder(path):
for root, dirs, files in os.walk(path):
if any(file.endswith('.gguf') for file in files):
folder_name = os.path.basename(root)
print(fr'Import model: {folder_name}')
cmd = f'ollama create {folder_name} -f modelfile'
subprocess.run(cmd, shell=True, cwd=root)
#****************************************************************
#****************************************************************
#****************************************************************
# Your model backup folder:
scan_folder(r'E:\llama_backup')
#****************************************************************
#****************************************************************
#****************************************************************