Skip to content

added NeMoLogger unit tests#511

Merged
dorotat-nv merged 11 commits into
mainfrom
dorotat/nemo-logger-unit-tests
Dec 12, 2024
Merged

added NeMoLogger unit tests#511
dorotat-nv merged 11 commits into
mainfrom
dorotat/nemo-logger-unit-tests

Conversation

@dorotat-nv
Copy link
Copy Markdown
Collaborator

@dorotat-nv dorotat-nv commented Dec 9, 2024

Adding hotfix and unit tests uncovering issue with WandbLogger in https://nvidia.slack.com/archives/C074Z808N05/p1733418209959769

DETAILS

An interesting observation: this genuinely appears to be a wandb bug, since it can only be captured once it’s converted into a Lightning hook during training. Only one out of 4 new unit tests fails when probably all of them should

The error is only uncovered only after NeMoLogger setup as n https://github.com/NVIDIA/NeMo/blob/bb895bc4b28ba99d707cb907c4496297a2a7b533/nemo/collections/llm/api.py#L852C22-L856C6
and after plt.Trainer setup at the start of the training in
https://github.com/Lightning-AI/pytorch-lightning/blob/de7c28ae865b5c9fd3ff21debebb994605f7f420/src/lightning/pytorch/trainer/trainer.py#L944
which is executed in
https://github.com/Lightning-AI/pytorch-lightning/blob/caa9e1e59436913e365bf52eeb2b07e3bf67efac/src/lightning/pytorch/trainer/call.py#L94C1-L97C34

TESTING ON BROKEN MAIN BRANCH

self = Settings(allow_offline_artifacts=True, allow_val_change=False, anonymous=None, api_key=None, azure_account_url_to_acce...andb', sync_symlink_latest='/workspace/bionemo2/wandb/latest-run', timespec='', wandb_dir='/workspace/bionemo2/wandb/')
name = 'root_dir', value = PosixPath('/tmp/pytest-of-dorotat/pytest-20/test_nemo_logger_initilized0/unit-test-loggers')

    def __setattr__(self, name: str, value: Any) -> None:
        if name in self.__class_vars__:
            raise AttributeError(
                f'{name!r} is a ClassVar of `{self.__class__.__name__}` and cannot be set on an instance. '
                f'If you want to set a value on the class, use `{self.__class__.__name__}.{name} = value`.'
            )
        elif not _fields.is_valid_field_name(name):
            if self.__pydantic_private__ is None or name not in self.__private_attributes__:
                _object_setattr(self, name, value)
            else:
                attribute = self.__private_attributes__[name]
                if hasattr(attribute, '__set__'):
                    attribute.__set__(self, value)  # type: ignore
                else:
                    self.__pydantic_private__[name] = value
            return
    
        self._check_frozen(name, value)
    
        attr = getattr(self.__class__, name, None)
        if isinstance(attr, property):
            attr.__set__(self, value)
        elif self.model_config.get('validate_assignment', None):
>           self.__pydantic_validator__.validate_assignment(self, name, value)
E           pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
E           root_dir
E             Input should be a valid string [type=string_type, input_value=PosixPath('/tmp/pytest-of...zed0/unit-test-loggers'), input_type=PosixPath]
E               For further information visit https://errors.pydantic.dev/2.9/v/string_type

/usr/local/lib/python3.10/dist-packages/pydantic/main.py:881: ValidationError
image image

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

\build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

Comment thread sub-packages/bionemo-llm/src/bionemo/llm/utils/logger_utils.py Outdated
@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@skothenhill-nv
Copy link
Copy Markdown
Collaborator

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

Comment thread sub-packages/bionemo-llm/src/bionemo/llm/utils/logger_utils.py Outdated
@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv dorotat-nv enabled auto-merge (squash) December 10, 2024 12:37
@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Copy Markdown
Collaborator Author

/build-ci

@dorotat-nv dorotat-nv merged commit bd4060d into main Dec 12, 2024
@dorotat-nv dorotat-nv deleted the dorotat/nemo-logger-unit-tests branch December 12, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants