-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
35 lines (26 loc) · 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import argparse
from transllm.core import LLMtranslator
def main():
parser = argparse.ArgumentParser(description="LLM Model Chat")
parser.add_argument("--hfmodel", type=str, help="Path to the LLM model")
parser.add_argument(
"--lang", type=str, default="ko", help="language for translation (default: ko)",
)
parser.add_argument(
"--translator", type=str, default="google", help="translate service API",
)
args = parser.parse_args()
model = LLMtranslator(args.hfmodel, target_lang=args.lang, translator="google")
print("=== LLM Model Chat ===")
print("You can start chatting with the LLM model. Enter 'q' to quit.")
print("-----------------------------------------")
while True:
user_input = input("User: ")
if user_input.lower() == "q":
print("Exiting the chat.")
break
answer = model.generate(user_input)
print("LLM: ", answer)
print("-----------------------------------------")
if __name__ == "__main__":
main()