Update app.py
Browse files
app.py
CHANGED
@@ -30,9 +30,19 @@ def load_and_train():
|
|
30 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
31 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
32 |
|
33 |
-
#
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
print("Daily Dialog columns:", dataset_humanizado.column_names)
|
38 |
print("Code Search Net columns:", dataset_codigo.column_names)
|
|
|
30 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
31 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
32 |
|
33 |
+
# Intentar cargar los datasets con manejo de errores
|
34 |
+
try:
|
35 |
+
dataset_humanizado = load_dataset('daily_dialog', split='train', cache_dir='/dev/shm', trust_remote_code=True)
|
36 |
+
dataset_codigo = load_dataset('code_search_net', split='train', cache_dir='/dev/shm', trust_remote_code=True)
|
37 |
+
except Exception as e:
|
38 |
+
print(f"Error al cargar los datasets: {e}")
|
39 |
+
# Si hay un error, podrías intentar cargar un dataset alternativo o reintentar después de un tiempo
|
40 |
+
time.sleep(60) # Esperar 60 segundos antes de reintentar
|
41 |
+
try:
|
42 |
+
dataset_humanizado = load_dataset('alternative_dataset', split='train', cache_dir='/dev/shm', trust_remote_code=True)
|
43 |
+
except Exception as e:
|
44 |
+
print(f"Error al cargar el dataset alternativo: {e}")
|
45 |
+
return
|
46 |
|
47 |
print("Daily Dialog columns:", dataset_humanizado.column_names)
|
48 |
print("Code Search Net columns:", dataset_codigo.column_names)
|