This is a patch to the art.TrainableModel class to change project name logging these runs as test runs.
()
| 44 | |
| 45 | |
| 46 | def make_patch_source() -> str: |
| 47 | """ |
| 48 | This is a patch to the art.TrainableModel class to change project name logging these runs as test runs. |
| 49 | """ |
| 50 | project = "Tester" |
| 51 | return ( |
| 52 | "try:\n" |
| 53 | " import art as _art\n" |
| 54 | " import art.model as _art_model\n" |
| 55 | "except Exception:\n" |
| 56 | " pass\n" |
| 57 | "else:\n" |
| 58 | " _orig_tm_init = _art_model.TrainableModel.__init__\n" |
| 59 | " def _patched_tm_init(self, *args, **kwargs):\n" |
| 60 | f" kwargs['project'] = {project!r}\n" |
| 61 | " result = _orig_tm_init(self, *args, **kwargs)\n" |
| 62 | " return result\n" |
| 63 | " _art_model.TrainableModel.__init__ = _patched_tm_init\n" |
| 64 | " _art.TrainableModel = _art_model.TrainableModel\n" |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | def make_variable_override_source(variables: Dict[str, Any]) -> str: |
no outgoing calls