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

[NLP] ArtifactItem with init=True to make it debuggable #7980

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

janekl
Copy link
Collaborator

@janekl janekl commented Dec 6, 2023

What does this PR do ?

When debugging artifact items I struggled with ArtifactItem as it is defined with init=False which results in issues when printing an instance of this class.

The following minimal example illustrates the problem - this code

from dataclasses import dataclass


@dataclass(init=False)
class Point:
    x: int
    y: int

p = Point()
print(p)

results in AttributeError: 'Point' object has no attribute 'x'. So it doesn't make it easier to check what's going on.

Collection: [NLP]

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • Improvement

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

@github-actions github-actions bot added the core Changes to NeMo Core label Dec 6, 2023
@janekl janekl changed the title ArtifactItem with init=True to make it debuggable [NLP] ArtifactItem with init=True to make it debuggable Dec 6, 2023
@@ -359,8 +359,6 @@ def register_artifact(self, model, config_path: str, src: str, verify_src_exists
"""
app_state = AppState()

artifact_item = model_utils.ArtifactItem()
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about keeping the instantiation here, with dummy default values of "" and type of local by default ? Then the remainder of the code doesn't need to be changed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good suggestion, adopted it. Now changes boil down to removing init=False and setting dummy defaults

@github-actions github-actions bot removed the core Changes to NeMo Core label Dec 12, 2023
@janekl janekl force-pushed the jlasek/artifact_item_printable branch from f9b5a68 to e53a491 Compare December 12, 2023 10:52
Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

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

Thanks LGTM

@titu1994
Copy link
Collaborator

jenkins

janekl and others added 3 commits December 18, 2023 09:14
@janekl janekl force-pushed the jlasek/artifact_item_printable branch from e53a491 to 1a389bf Compare December 18, 2023 08:14
@janekl
Copy link
Collaborator Author

janekl commented Dec 18, 2023

Thanks LGTM

Thanks! I've just rebased it, I'll merge once pipeline completes.

@janekl janekl merged commit 6b40e62 into main Dec 18, 2023
15 checks passed
@janekl janekl deleted the jlasek/artifact_item_printable branch December 18, 2023 11:21
pzelasko pushed a commit to pzelasko/NeMo that referenced this pull request Jan 3, 2024
* ArtifactItem with init=True to make it debuggable

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Initialize ArtifactItem with dummy values to keep changes minimal

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Piotr Żelasko <petezor@gmail.com>
ssh-meister pushed a commit to ssh-meister/NeMo that referenced this pull request Feb 15, 2024
* ArtifactItem with init=True to make it debuggable

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Initialize ArtifactItem with dummy values to keep changes minimal

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Sasha Meister <ameister@nvidia.com>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
* ArtifactItem with init=True to make it debuggable

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Initialize ArtifactItem with dummy values to keep changes minimal

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

2 participants