Tonic commited on
Commit
41e9e02
Β·
verified Β·
1 Parent(s): 2f866e6

solves model card formatting bug

Browse files
recover_model.py CHANGED
@@ -236,7 +236,7 @@ class ModelRecoveryPipeline:
236
 
237
  logger.info(f"πŸ“Š Quantization summary: {success_count}/{total_count} successful")
238
  return success_count > 0
239
-
240
  except Exception as e:
241
  logger.error(f"❌ Error during quantization: {e}")
242
  return False
@@ -324,8 +324,8 @@ def main():
324
  return 0
325
  else:
326
  logger.error("❌ Model recovery and deployment failed!")
327
- return 1
328
-
329
  except Exception as e:
330
  logger.error(f"❌ Error during model recovery: {e}")
331
  return 1
 
236
 
237
  logger.info(f"πŸ“Š Quantization summary: {success_count}/{total_count} successful")
238
  return success_count > 0
239
+
240
  except Exception as e:
241
  logger.error(f"❌ Error during quantization: {e}")
242
  return False
 
324
  return 0
325
  else:
326
  logger.error("❌ Model recovery and deployment failed!")
327
+ return 1
328
+
329
  except Exception as e:
330
  logger.error(f"❌ Error during model recovery: {e}")
331
  return 1
scripts/model_tonic/push_to_huggingface.py CHANGED
@@ -156,50 +156,9 @@ class HuggingFacePusher:
156
  return True
157
 
158
  def create_model_card(self, training_config: Dict[str, Any], results: Dict[str, Any]) -> str:
159
- """Create a comprehensive model card using the unified template"""
160
- try:
161
- # Import the model card generator
162
- import sys
163
- sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
164
- from scripts.model_tonic.generate_model_card import ModelCardGenerator
165
-
166
- # Create variables for the template
167
- variables = {
168
- "model_name": f"{self.repo_name.split('/')[-1]} - Fine-tuned SmolLM3",
169
- "model_description": self.model_description or "A fine-tuned version of SmolLM3-3B for improved text generation and conversation capabilities.",
170
- "repo_name": self.repo_name,
171
- "base_model": "HuggingFaceTB/SmolLM3-3B",
172
- "dataset_name": training_config.get('dataset_name', 'OpenHermes-FR'),
173
- "training_config_type": training_config.get('training_config_type', 'Custom Configuration'),
174
- "trainer_type": training_config.get('trainer_type', 'SFTTrainer'),
175
- "batch_size": str(training_config.get('per_device_train_batch_size', 8)),
176
- "gradient_accumulation_steps": str(training_config.get('gradient_accumulation_steps', 16)),
177
- "learning_rate": str(training_config.get('learning_rate', '5e-6')),
178
- "max_epochs": str(training_config.get('num_train_epochs', 3)),
179
- "max_seq_length": str(training_config.get('max_seq_length', 2048)),
180
- "hardware_info": self._get_hardware_info(),
181
- "experiment_name": self.experiment_name or "smollm3-experiment",
182
- "trackio_url": self.trackio_url or "https://trackio.space/experiment",
183
- "dataset_repo": self.dataset_repo,
184
- "dataset_size": training_config.get('dataset_size', '~80K samples'),
185
- "dataset_format": training_config.get('dataset_format', 'Chat format'),
186
- "author_name": self.author_name or training_config.get('author_name', 'Your Name'),
187
- "model_name_slug": self.repo_name.split('/')[-1].lower().replace('-', '_'),
188
- "quantized_models": False, # Will be updated if quantized models are added
189
- "dataset_sample_size": training_config.get('dataset_sample_size'),
190
- "training_loss": results.get('train_loss', 'N/A'),
191
- "validation_loss": results.get('eval_loss', 'N/A'),
192
- "perplexity": results.get('perplexity', 'N/A')
193
- }
194
-
195
- # Create generator and generate model card
196
- generator = ModelCardGenerator()
197
- return generator.generate_model_card(variables)
198
-
199
- except Exception as e:
200
- logger.error(f"Failed to generate model card from template: {e}")
201
- # Fallback to simple model card
202
- return self._create_simple_model_card(training_config, results)
203
 
204
  def _create_simple_model_card(self, training_config: Dict[str, Any], results: Dict[str, Any]) -> str:
205
  """Create a simple model card without complex YAML to avoid formatting issues"""
 
156
  return True
157
 
158
  def create_model_card(self, training_config: Dict[str, Any], results: Dict[str, Any]) -> str:
159
+ """Create a comprehensive model card using the simple method to avoid YAML issues"""
160
+ # Always use the simple model card to avoid YAML formatting issues
161
+ return self._create_simple_model_card(training_config, results)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  def _create_simple_model_card(self, training_config: Dict[str, Any], results: Dict[str, Any]) -> str:
164
  """Create a simple model card without complex YAML to avoid formatting issues"""