fix hf_token
Browse files
app.py
CHANGED
@@ -25,14 +25,15 @@ def stream_output(pipe, queue):
|
|
25 |
queue.put(line.decode('utf-8').rstrip())
|
26 |
pipe.close()
|
27 |
|
28 |
-
def run_command(command):
|
29 |
# Create process with pipes for stdout and stderr
|
30 |
process = subprocess.Popen(
|
31 |
command,
|
32 |
stdout=subprocess.PIPE,
|
33 |
stderr=subprocess.PIPE,
|
34 |
#bufsize=1,
|
35 |
-
universal_newlines=False
|
|
|
36 |
)
|
37 |
|
38 |
# Create queues to store output
|
@@ -113,7 +114,8 @@ def process_model(ft_model_id: str, base_model_id: str, rank: str, private_repo,
|
|
113 |
f"--device={device}"
|
114 |
]
|
115 |
print("cmd", cmd)
|
116 |
-
(
|
|
|
117 |
print("returncode", returncode)
|
118 |
print("output_stdout", output_stdout)
|
119 |
print("output_stderr", output_stderr)
|
|
|
25 |
queue.put(line.decode('utf-8').rstrip())
|
26 |
pipe.close()
|
27 |
|
28 |
+
def run_command(command, env_vars):
|
29 |
# Create process with pipes for stdout and stderr
|
30 |
process = subprocess.Popen(
|
31 |
command,
|
32 |
stdout=subprocess.PIPE,
|
33 |
stderr=subprocess.PIPE,
|
34 |
#bufsize=1,
|
35 |
+
universal_newlines=False,
|
36 |
+
env=env_vars,
|
37 |
)
|
38 |
|
39 |
# Create queues to store output
|
|
|
114 |
f"--device={device}"
|
115 |
]
|
116 |
print("cmd", cmd)
|
117 |
+
env_vars = dict(os.environ, HF_TOKEN=oauth_token.token)
|
118 |
+
returncode, output_stdout, output_stderr = run_command(cmd, env_vars)
|
119 |
print("returncode", returncode)
|
120 |
print("output_stdout", output_stdout)
|
121 |
print("output_stderr", output_stderr)
|