|
| 1 | +import copy |
1 | 2 | import json |
2 | 3 | import os |
3 | 4 | import re |
|
22 | 23 |
|
23 | 24 |
|
24 | 25 | if is_nanotron_available(): |
25 | | - from nanotron.config import Config, get_config_from_dict |
| 26 | + from nanotron.config import Config |
26 | 27 |
|
27 | 28 |
|
28 | 29 | class EnhancedJSONEncoder(json.JSONEncoder): |
@@ -116,8 +117,14 @@ def save( |
116 | 117 |
|
117 | 118 | hlog(f"Saving results to {output_results_file} and {output_results_in_details_file}") |
118 | 119 |
|
| 120 | + config_general = copy.deepcopy(self.general_config_logger) |
| 121 | + config_general.config = ( |
| 122 | + config_general.config.as_dict() if is_dataclass(config_general.config) else config_general.config |
| 123 | + ) |
| 124 | + config_general = asdict(config_general) |
| 125 | + |
119 | 126 | to_dump = { |
120 | | - "config_general": asdict(self.general_config_logger), |
| 127 | + "config_general": config_general, |
121 | 128 | "results": self.metrics_logger.metric_aggregated, |
122 | 129 | "versions": self.versions_logger.versions, |
123 | 130 | "config_tasks": self.task_config_logger.tasks_configs, |
@@ -485,7 +492,7 @@ def push_results_to_tensorboard( # noqa: C901 |
485 | 492 | if not is_nanotron_available(): |
486 | 493 | hlog_warn("You cannot push results to tensorboard with having nanotron installed. Skipping") |
487 | 494 | return |
488 | | - config: Config = get_config_from_dict(self.general_config_logger.config, config_class=Config) |
| 495 | + config: Config = self.general_config_logger.config |
489 | 496 | lighteval_config = config.lighteval |
490 | 497 | try: |
491 | 498 | global_step = config.general.step |
|
0 commit comments