Tonic commited on
Commit
d1f29b8
·
verified ·
1 Parent(s): 34b58cd

add debuging and logging

Browse files
Files changed (1) hide show
  1. model.py +15 -3
model.py CHANGED
@@ -124,6 +124,10 @@ class SmolLM3Model:
124
  if self.config is None:
125
  raise ValueError("Config is required to get training arguments")
126
 
 
 
 
 
127
  # Merge config with kwargs
128
  training_args = {
129
  "output_dir": output_dir,
@@ -155,8 +159,8 @@ class SmolLM3Model:
155
  "ignore_data_skip": False,
156
  "seed": 42,
157
  "data_seed": 42,
158
- "dataloader_num_workers": 4,
159
- "max_grad_norm": 1.0,
160
  "optim": self.config.optimizer,
161
  "lr_scheduler_type": self.config.scheduler,
162
  "warmup_ratio": 0.1,
@@ -168,7 +172,15 @@ class SmolLM3Model:
168
  # Override with kwargs
169
  training_args.update(kwargs)
170
 
171
- return TrainingArguments(**training_args)
 
 
 
 
 
 
 
 
172
 
173
  def save_pretrained(self, path: str):
174
  """Save model and tokenizer"""
 
124
  if self.config is None:
125
  raise ValueError("Config is required to get training arguments")
126
 
127
+ # Debug: Print config attributes to identify the issue
128
+ logger.info(f"Config type: {type(self.config)}")
129
+ logger.info(f"Config attributes: {[attr for attr in dir(self.config) if not attr.startswith('_')]}")
130
+
131
  # Merge config with kwargs
132
  training_args = {
133
  "output_dir": output_dir,
 
159
  "ignore_data_skip": False,
160
  "seed": 42,
161
  "data_seed": 42,
162
+ "dataloader_num_workers": getattr(self.config, 'dataloader_num_workers', 4),
163
+ "max_grad_norm": getattr(self.config, 'max_grad_norm', 1.0),
164
  "optim": self.config.optimizer,
165
  "lr_scheduler_type": self.config.scheduler,
166
  "warmup_ratio": 0.1,
 
172
  # Override with kwargs
173
  training_args.update(kwargs)
174
 
175
+ # Debug: Print training args before creating TrainingArguments
176
+ logger.info(f"Training arguments keys: {list(training_args.keys())}")
177
+
178
+ try:
179
+ return TrainingArguments(**training_args)
180
+ except Exception as e:
181
+ logger.error(f"Failed to create TrainingArguments: {e}")
182
+ logger.error(f"Training arguments: {training_args}")
183
+ raise
184
 
185
  def save_pretrained(self, path: str):
186
  """Save model and tokenizer"""