From 0892264f28d71d781f21a5be9bb1c698c56cc63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= Date: Thu, 5 Dec 2024 19:12:18 +0000 Subject: [PATCH] see #2443 --- trl/scripts/chat.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/trl/scripts/chat.py b/trl/scripts/chat.py index d1746441ea..2ede78e6cb 100644 --- a/trl/scripts/chat.py +++ b/trl/scripts/chat.py @@ -17,6 +17,7 @@ import copy import json import os +import platform import pwd import re import time @@ -34,6 +35,9 @@ from trl.trainer.utils import get_quantization_config +if platform.system() != "Windows": + import pwd + init_zero_verbose() HELP_STRING = """\ @@ -217,7 +221,10 @@ def print_help(self): def get_username(): - return pwd.getpwuid(os.getuid())[0] + if platform.system() == "Windows": + return os.getlogin() + else: + return pwd.getpwuid(os.getuid()).pw_name def create_default_filename(model_name):