Skip to content

A ~9M parameter LLM that talks like a small fish.

Python

Merge main into prompt branch, resolving conflict in __main__.py

Arman Hossain4c1669fc35ee
diff --cc guppylm/__main__.py
index edbd42d,516b553..f69761c
--- a/guppylm/__main__.py
+++ b/guppylm/__main__.py
@@@ -24,9 -53,29 +53,20 @@@ def main()
from .train import train
train()
+ elif cmd == "download":
+ download_model()
+
elif cmd == "chat":
- from .inference import main
- main()
+ if not os.path.exists(CHECKPOINT_PATH):
+ print("Model not found. Download the pre-trained model first:\n")
+ print(" python -m guppylm download\n")
+ print("Or train your own:\n")
+ print(" python -m guppylm prepare")
+ print(" python -m guppylm train")
+ return
+
- from .inference import GuppyInference
- engine = GuppyInference(CHECKPOINT_PATH, TOKENIZER_PATH)
- print("\nGuppy Chat (type 'quit' to exit)")
- while True:
- inp = input("\nYou> ").strip()
- if inp.lower() in ("quit", "exit", "q"):
- break
- r = engine.chat_completion([{"role": "user", "content": inp}])
- msg = r["choices"][0]["message"]
- if msg.get("content"):
- print(f"Guppy> {msg['content']}")
++ from .inference import main as inference_main
++ inference_main()
else:
print(f"Unknown command: {cmd}")
diff --cc guppylm/inference.py
index 86a444a,31d7089..023c71e
--- a/guppylm/inference.py
+++ b/guppylm/inference.py
@@@ -107,14 -104,7 +105,13 @@@ def main()
args = p.parse_args()
engine = GuppyInference(args.checkpoint, args.tokenizer, args.device)
+
+ if args.prompt:
+ result = engine.chat_completion([{"role": "user", "content": args.prompt}])
+ print(result["choices"][0]["message"]["content"])
+ return
+
print("\nGuppy Chat (type 'quit' to exit)")
- msgs = []
while True:
inp = input("\nYou> ").strip()
if inp.lower() in ("quit", "exit", "q"):