Tonic commited on
Commit
2f866e6
·
verified ·
1 Parent(s): 22bb04c

solves model card formatting bug

Browse files
scripts/model_tonic/push_to_huggingface.py CHANGED
@@ -199,7 +199,11 @@ class HuggingFacePusher:
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 f"""---
 
 
 
 
203
  language:
204
  - en
205
  - fr
@@ -209,6 +213,8 @@ tags:
209
  - fine-tuned
210
  - causal-lm
211
  - text-generation
 
 
212
  ---
213
 
214
  # {self.repo_name.split('/')[-1]}
@@ -222,6 +228,7 @@ This is a fine-tuned SmolLM3 model based on the HuggingFaceTB/SmolLM3-3B archite
222
  - **Training Date**: {datetime.now().strftime('%Y-%m-%d')}
223
  - **Model Size**: {self._get_model_size():.1f} GB
224
  - **Dataset Repository**: {self.dataset_repo}
 
225
 
226
  ## Training Configuration
227
 
 
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"""
206
+ return f"""---
207
  language:
208
  - en
209
  - fr
 
213
  - fine-tuned
214
  - causal-lm
215
  - text-generation
216
+ pipeline_tag: text-generation
217
+ base_model: HuggingFaceTB/SmolLM3-3B
218
  ---
219
 
220
  # {self.repo_name.split('/')[-1]}
 
228
  - **Training Date**: {datetime.now().strftime('%Y-%m-%d')}
229
  - **Model Size**: {self._get_model_size():.1f} GB
230
  - **Dataset Repository**: {self.dataset_repo}
231
+ - **Hardware**: {self._get_hardware_info()}
232
 
233
  ## Training Configuration
234
 
templates/model_card.md CHANGED
@@ -98,7 +98,7 @@ trackio_url: {{trackio_url}}
98
  dataset_repo: {{dataset_repo}}
99
  {{/if}}
100
  {{#if hardware_info}}
101
- hardware: {{hardware_info}}
102
  {{/if}}
103
  {{#if training_config_type}}
104
  training_config: {{training_config_type}}
 
98
  dataset_repo: {{dataset_repo}}
99
  {{/if}}
100
  {{#if hardware_info}}
101
+ hardware: "{{hardware_info}}"
102
  {{/if}}
103
  {{#if training_config_type}}
104
  training_config: {{training_config_type}}