marinone94
commited on
Commit
•
6d4cdd4
1
Parent(s):
d6fb5e8
handle PermissionError
Browse files
run_speech_recognition_seq2seq_streaming.py
CHANGED
@@ -78,10 +78,13 @@ if (hf_token is None or wandb_token == "None") and os.path.exists("./creds.txt")
|
|
78 |
os.environ["EMAIL_PASSWORD"] = value.strip()
|
79 |
|
80 |
if hf_token is not None:
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
85 |
else:
|
86 |
logger.warning("Huggingface API key not set, relying on ~/.huggingface/token")
|
87 |
|
|
|
78 |
os.environ["EMAIL_PASSWORD"] = value.strip()
|
79 |
|
80 |
if hf_token is not None:
|
81 |
+
try:
|
82 |
+
os.makedirs("/root/.huggingface", exist_ok=True)
|
83 |
+
with open("/root/.huggingface/token", "w") as f:
|
84 |
+
f.write(hf_token)
|
85 |
+
logger.info("Huggingface API key set")
|
86 |
+
except PermissionError:
|
87 |
+
logger.warning("Huggingface API key not set, relying on ~/.huggingface/token")
|
88 |
else:
|
89 |
logger.warning("Huggingface API key not set, relying on ~/.huggingface/token")
|
90 |
|