From 1fbb0b47130a64e8c7c5c5b0128eadc31bf1282c Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 25 Mar 2024 10:59:57 -0400 Subject: Few tweaks to Mynion These just helped me when I tried to use it again and it didn't work and I wasn't immediately sure why. --- Biz/Mynion.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Biz') diff --git a/Biz/Mynion.py b/Biz/Mynion.py index 85eadc8..d3dabcf 100644 --- a/Biz/Mynion.py +++ b/Biz/Mynion.py @@ -1,5 +1,7 @@ +""" +Mynion is a helper. +""" # : out mynion -# # : dep exllama # : dep slixmpp import argparse @@ -192,9 +194,10 @@ def load_model(model_name: str) -> typing.Any: config_path = os.path.join(model_dir, "config.json") st_pattern = os.path.join(model_dir, "*.safetensors") st = glob.glob(st_pattern) - if len(st) != 1: - print("found multiple safetensors!") - sys.exit() + if len(st) > 1: + raise ValueError("found multiple safetensors!") + elif len(st) < 1: + raise ValueError("could not find model") model_path = st[0] config = exllama.model.ExLlamaConfig(config_path) @@ -237,7 +240,7 @@ if __name__ == "__main__": print("pass: test: Biz/Mynion.py") sys.exit(0) else: - cli = argparse.ArgumentParser() + cli = argparse.ArgumentParser(description=__doc__) cli.add_argument("-u", "--user") cli.add_argument("-p", "--password") cli.add_argument("-m", "--model", choices=MY_MODELS) -- cgit v1.2.3