diff options
author | Ben Sima <ben@bsima.me> | 2024-03-25 10:59:57 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2024-03-25 10:59:57 -0400 |
commit | 1fbb0b47130a64e8c7c5c5b0128eadc31bf1282c (patch) | |
tree | d2cfd0a490d096fb51265d004c24e4d6b734bbdf | |
parent | 4a14865b93e5fa83ac0d1c88a19d424abea22aca (diff) |
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.
-rw-r--r-- | Biz/Mynion.py | 13 |
1 files changed, 8 insertions, 5 deletions
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) |