Spaces:
Sleeping
Sleeping
Update train_model.py
Browse files- train_model.py +7 -1
train_model.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# train_model.py (Training Script)
|
2 |
-
|
3 |
import argparse
|
4 |
from transformers import (
|
5 |
GPT2Config,
|
@@ -145,6 +145,12 @@ def main():
|
|
145 |
raise ValueError("HF_API_TOKEN is not set.")
|
146 |
|
147 |
# Initialize tokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
try:
|
149 |
logging.info("Initializing tokenizer...")
|
150 |
if args.task == "generation":
|
|
|
1 |
# train_model.py (Training Script)
|
2 |
+
from huggingface_hub import login
|
3 |
import argparse
|
4 |
from transformers import (
|
5 |
GPT2Config,
|
|
|
145 |
raise ValueError("HF_API_TOKEN is not set.")
|
146 |
|
147 |
# Initialize tokenizer
|
148 |
+
try:
|
149 |
+
login(token=hf_token)
|
150 |
+
logging.info("Successfully logged in to Hugging Face Hub.")
|
151 |
+
except Exception as e:
|
152 |
+
logging.error(f"Failed to log in to Hugging Face Hub: {str(e)}")
|
153 |
+
raise e
|
154 |
try:
|
155 |
logging.info("Initializing tokenizer...")
|
156 |
if args.task == "generation":
|