We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e30aaa0 commit a6dcfc5Copy full SHA for a6dcfc5
torchchat.py
@@ -6,7 +6,7 @@
6
7
import argparse
8
import logging
9
-import subprocess
+import signal
10
import sys
11
12
# MPS ops missing with Multimodal torchtune
@@ -25,7 +25,15 @@
25
default_device = "cpu"
26
27
28
+def signal_handler(sig, frame):
29
+ print("\nInterrupted by user. Bye!\n")
30
+ sys.exit(0)
31
+
32
33
if __name__ == "__main__":
34
+ # Set the signal handler for SIGINT
35
+ signal.signal(signal.SIGINT, signal_handler)
36
37
# Initialize the top-level parser
38
parser = argparse.ArgumentParser(
39
prog="torchchat",
0 commit comments