stakelovelace commited on
Commit
d16807d
1 Parent(s): 2069fff

commit from tesla

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -44,7 +44,7 @@ def train_model(model, tokenizer, data, device):
44
  num_train_epochs=3,
45
  per_device_train_batch_size=1,
46
  gradient_accumulation_steps=2,
47
- # fp16=True, # Enable mixed precision
48
  warmup_steps=500,
49
  weight_decay=0.01,
50
  logging_dir='./logs',
@@ -61,11 +61,13 @@ def train_model(model, tokenizer, data, device):
61
  trainer.train()
62
 
63
  # Optionally clear cache if using GPU or MPS
 
 
64
  if torch.cuda.is_available():
65
  torch.cuda.empty_cache()
66
  elif torch.has_mps:
67
  torch.mps.empty_cache()
68
-
69
  # Perform any remaining steps such as logging, saving, etc.
70
  trainer.save_model()
71
 
 
44
  num_train_epochs=3,
45
  per_device_train_batch_size=1,
46
  gradient_accumulation_steps=2,
47
+ fp16=True, # Enable mixed precision
48
  warmup_steps=500,
49
  weight_decay=0.01,
50
  logging_dir='./logs',
 
61
  trainer.train()
62
 
63
  # Optionally clear cache if using GPU or MPS
64
+ print(torch.cuda.memory_summary(device=None, abbreviated=False))
65
+
66
  if torch.cuda.is_available():
67
  torch.cuda.empty_cache()
68
  elif torch.has_mps:
69
  torch.mps.empty_cache()
70
+
71
  # Perform any remaining steps such as logging, saving, etc.
72
  trainer.save_model()
73