Prepare model dir. Args: **kwargs: Additional keyword arguments.
(**kwargs)
| 107 | |
| 108 | |
| 109 | def prepare_model_dir(**kwargs): |
| 110 | |
| 111 | """Prepare model dir. |
| 112 | |
| 113 | Args: |
| 114 | **kwargs: Additional keyword arguments. |
| 115 | """ |
| 116 | os.makedirs(kwargs.get("output_dir", "./"), exist_ok=True) |
| 117 | |
| 118 | yaml_file = os.path.join(kwargs.get("output_dir", "./"), "config.yaml") |
| 119 | OmegaConf.save(config=kwargs, f=yaml_file) |
| 120 | logging.info(f"kwargs: {kwargs}") |
| 121 | logging.info("config.yaml is saved to: %s", yaml_file) |
| 122 | |
| 123 | model_path = kwargs.get("model_path", None) |
| 124 | if model_path is not None: |
| 125 | config_json = os.path.join(model_path, "configuration.json") |
| 126 | if os.path.exists(config_json): |
| 127 | shutil.copy( |
| 128 | config_json, os.path.join(kwargs.get("output_dir", "./"), "configuration.json") |
| 129 | ) |
| 130 | |
| 131 | |
| 132 | def extract_filename_without_extension(file_path): |