Skip to content
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

clearml offline mode #363

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fuse/data/ops/ops_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def __init__(
:param key_index: name of value in sample_dict which will be used as the key/index
:param key_column: name of the column which use as key/index. In case of None, the original dataframe index will be used to extract the values for a single sample.
"""
super().__init__()
# store input
self._data_filename = data_filename
self._columns_to_extract = columns_to_extract
Expand All @@ -146,7 +147,7 @@ def __init__(
self._h5 = h5py.File(self._data_filename, "r")

if self._columns_to_extract is None:
self._columns_to_extract = self._h5.keys()
self._columns_to_extract = list(self._h5.keys())

self._num_samples = len(self._h5[self._columns_to_extract[0]])

Expand Down
5 changes: 5 additions & 0 deletions fuse/dl/lightning/pl_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def start_clearml_logger(
auto_resource_monitoring: bool = True,
auto_connect_streams: Union[bool, Mapping[str, bool]] = True,
deferred_init: bool = False,
offline_mode: bool = False,
) -> TaskInstance:
"""
Just a fuse function to quickly start the clearml logger. It sets up patches to pytorch lightning logging hooks so it doesn't need to be passed to any lightning logger.
Expand Down Expand Up @@ -86,6 +87,10 @@ def start_clearml_logger(
bool_start_logger = True

if bool_start_logger:
if offline_mode: # Use the set_offline class method before initializing a Task
Task.set_offline(offline_mode=True)
os.environ["CLEARML_OFFLINE_MODE"] = "1"

task = Task.init(
project_name=project_name,
task_name=task_name,
Expand Down
3 changes: 3 additions & 0 deletions fuse/dl/lightning/pl_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def __init__(

## forward
def forward(self, batch_dict: NDict) -> NDict:
# workaround for fsdp
if not isinstance(batch_dict, NDict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a point to run some assertion that it's at least a dictionary? or do you think that NDict covers that enough already anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be ok

batch_dict = NDict(batch_dict)
return self._model(batch_dict)

## Step
Expand Down
Loading