Model container with generator logic, initial

This commit is contained in:
turboderp
2023-11-11 02:53:00 +01:00
parent d2480bae28
commit 9d34479e3e
2 changed files with 317 additions and 0 deletions

21
model_test.py Normal file
View File

@@ -0,0 +1,21 @@
from model import ModelContainer
def progress(module, modules):
print(f"Loaded {module}/{modules} modules")
yield
mc = ModelContainer("/mnt/str/models/_exl2/mistral-7b-instruct-exl2/4.0bpw/", max_seq_len = 100)
mc.load(progress)
gen = mc.generate_gen("Once upon a tim", generate_window = 16, token_healing = True)
for g in gen: print(g, end = "")
mc.unload()
del mc
mc = ModelContainer("/mnt/str/models/_exl2/mistral-7b-instruct-exl2/4.65bpw/")
mc.load(progress)
response = mc.generate("All work and no play makes turbo a derpy cat.\nAll work and no play makes turbo a derpy cat.\nAll", top_k = 1)
print (response)