mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-20 04:37:00 +00:00
add function
This commit is contained in:
@@ -23,8 +23,8 @@ def main():
|
||||
generate_parser.set_defaults(fn=generate)
|
||||
|
||||
add_parser = subparsers.add_parser("add")
|
||||
add_parser.add_argument("model_file")
|
||||
generate_parser.set_defaults(fn=add)
|
||||
add_parser.add_argument("file")
|
||||
add_parser.set_defaults(fn=add)
|
||||
|
||||
args = parser.parse_args()
|
||||
args = vars(args)
|
||||
@@ -48,4 +48,4 @@ def generate(*args, **kwargs):
|
||||
|
||||
|
||||
def add(*args, **kwargs):
|
||||
model.add(*args, **kwargs)
|
||||
engine.add(*args, **kwargs)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
import shutil
|
||||
from contextlib import contextmanager
|
||||
from llama_cpp import Llama as LLM
|
||||
from template import template
|
||||
@@ -61,3 +62,9 @@ def load(model, models_home=".", llms={}):
|
||||
def unload(model, llms={}):
|
||||
if model in llms:
|
||||
llms.pop(model)
|
||||
|
||||
|
||||
def add(file, models_home=".", *args, **kwargs):
|
||||
if not os.path.exists(file):
|
||||
raise ValueError("Model file {model} not found")
|
||||
shutil.move(file, models_home)
|
||||
|
||||
Reference in New Issue
Block a user