-
Notifications
You must be signed in to change notification settings - Fork 10
feat: added carboncode for full pipeline with logging #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
|
|
||
| import numpy as np | ||
| import yaml | ||
| from codecarbon import OfflineEmissionsTracker | ||
| from typing_extensions import assert_never | ||
|
|
||
| from autointent import Context, Dataset, OptimizationConfig | ||
|
|
@@ -144,15 +145,32 @@ def _fit(self, context: Context, sampler: SamplerType) -> None: | |
| """ | ||
| self.context = context | ||
| self._logger.info("starting pipeline optimization...") | ||
|
|
||
| tracker = None | ||
| if context.logging_config.track_emissions: | ||
| tracker = OfflineEmissionsTracker( | ||
| country_iso_code=context.logging_config.country_iso_code or "USA", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а нету russia?)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Мб просто на |
||
| output_dir=context.logging_config.dirpath, | ||
| ) | ||
| tracker.start_task() | ||
|
|
||
| self.context.callback_handler.start_run( | ||
| run_name=self.context.logging_config.get_run_name(), | ||
| dirpath=self.context.logging_config.dirpath, | ||
| log_interval_time=self.context.logging_config.log_interval_time, | ||
| ) | ||
| for node_type in NodeType: | ||
| node_optimizer = self.nodes.get(node_type, None) | ||
| if node_optimizer is not None: | ||
| node_optimizer.fit(context, sampler) # type: ignore[union-attr] | ||
|
|
||
| try: | ||
| for node_type in NodeType: | ||
| node_optimizer = self.nodes.get(node_type, None) | ||
| if node_optimizer is not None: | ||
| node_optimizer.fit(context, sampler) # type: ignore[union-attr] | ||
| finally: | ||
| if tracker is not None: | ||
| emissions_data = tracker.stop_task() | ||
| emissions_data_dict = json.loads(emissions_data.toJSON()) | ||
| context.callback_handler.log_emissions(emissions_data_dict) | ||
|
Comment on lines
+169
to
+172
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Мб логировать в end_run?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. как-то нелогинчо получается, в end_run придется делать wandb.init и завершать таску + передавать условие-аргумент track_emissions и emissions_data
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно просто залогировать там дополнительно, без создания отдельного рана
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. возможно действительно стоит как-то обойтись имеющимися методами у колбеков, а то интерфейсы нагружаются |
||
|
|
||
| self.context.callback_handler.end_run() | ||
|
|
||
| def _is_inference(self) -> bool: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я посмотрел wandb логи которые ты прикрепила, мне кажется надо бы как-то отделить эти логи в отдельную подгруппу, чтобы они не смешивались с основными логами