Ffftdtd5dtft commited on
Commit
7f18d0d
1 Parent(s): f33c730

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -7,7 +7,7 @@ import matplotlib.pyplot as plt
7
  import matplotlib.animation as animation
8
  import time
9
  from tqdm import tqdm
10
- from transformers import AutoTokenizer, AutoModel, AutoModelForTextToWaveform, TrainingArguments
11
  from diffusers import DiffusionPipeline
12
  from huggingface_hub import login, HfApi, Repository
13
  from dotenv import load_dotenv
@@ -84,7 +84,7 @@ def push_to_hub(local_dir, repo_name):
84
 
85
  def load_model(model_name):
86
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
87
- model = AutoModel.from_pretrained(model_name)
88
  return tokenizer, model
89
 
90
  def train(model, train_loader, eval_loader, args):
@@ -195,20 +195,18 @@ def main():
195
 
196
  # Definir los argumentos de entrenamiento
197
  training_args = TrainingArguments(
198
- output_dir="outputs/unified_model",
199
- evaluation_strategy="epoch",
200
- learning_rate=9e-4,
201
  per_device_train_batch_size=2,
202
  per_device_eval_batch_size=16,
203
- num_train_epochs=1, # Reduced epochs for quick training
204
- weight_decay=0.01,
205
- logging_steps=10, # More frequent logging for quicker feedback
206
- optim="adamw_hf"
207
  )
208
 
209
  # Definir el optimizador
210
- optimizer = AdamW(unified_model.parameters(), lr=training_args.learning_rate)
211
 
 
212
  train_losses = []
213
  eval_losses = []
214
 
 
7
  import matplotlib.animation as animation
8
  import time
9
  from tqdm import tqdm
10
+ from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
11
  from diffusers import DiffusionPipeline
12
  from huggingface_hub import login, HfApi, Repository
13
  from dotenv import load_dotenv
 
84
 
85
  def load_model(model_name):
86
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
87
+ model = AutoModelForCausalLM.from_pretrained(model_name)
88
  return tokenizer, model
89
 
90
  def train(model, train_loader, eval_loader, args):
 
195
 
196
  # Definir los argumentos de entrenamiento
197
  training_args = TrainingArguments(
 
 
 
198
  per_device_train_batch_size=2,
199
  per_device_eval_batch_size=16,
200
+ num_train_epochs=1,
201
+ logging_steps=10,
202
+ save_steps=10,
203
+ evaluation_strategy="steps"
204
  )
205
 
206
  # Definir el optimizador
207
+ optimizer = AdamW(unified_model.parameters(), lr=5e-5)
208
 
209
+ # Listas para almacenar las pérdidas
210
  train_losses = []
211
  eval_losses = []
212