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

chore: Remove attrdict from model hub #8554

Merged
merged 42 commits into from
Dec 15, 2023
Merged

Conversation

MikhailKardash
Copy link
Contributor

@MikhailKardash MikhailKardash commented Dec 6, 2023

Description

attrdict is broken since Python 3.9. Possible replacements do not meet our dependency requirements. This PR implements our own AttrDict as a utility class.

Replaces #8541

Test Plan

Unit tests pass. Also try any mmdetection and hugginface example.

Checklist

  • [C] Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

MLG-1442

@cla-bot cla-bot bot added the cla-signed label Dec 6, 2023
Copy link

netlify bot commented Dec 6, 2023

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit b6ba8fe
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/657b842d7ab13c00086b190e

Comment on lines 57 to 58
self.hparams = context.get_hparams()
self.data_config = context.get_data_config()
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this is a breaking change to MMDetTrial, since people are expected to subclass this object.

Why not just use the simplenamespace here too? Wouldn't that be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the PyTorchTrialContext, hparams is an Optional[Dict], which is what we're passing here. Are users of MMDetTrial doing an __init__, then changing hparams after the fact? My assumption was that hparams are expected to be passed as a dict or read from a file as a dict and that's the end of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also applies to data config, i.e. def get_data_config(self) -> Dict[str, Any]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change this PR to change all dict objects to SimpleNamespace, but I'm not sure what the resulting benefit is.

@MikhailKardash MikhailKardash marked this pull request as ready for review December 8, 2023 00:29
@MikhailKardash MikhailKardash marked this pull request as draft December 8, 2023 18:55
@MikhailKardash MikhailKardash marked this pull request as ready for review December 12, 2023 00:58
Copy link
Member

@rb-determined-ai rb-determined-ai left a comment

Choose a reason for hiding this comment

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

Very nice.

Rephrase the PR comment before landing. attrdict doesn't "depend on a personal fork of attrdict3", rather attrdict is broken and possible replacements do not meet our dependency requirements.

@MikhailKardash MikhailKardash merged commit 2c29f99 into main Dec 15, 2023
74 of 85 checks passed
@MikhailKardash MikhailKardash deleted the model_hub_attrdict_2 branch December 15, 2023 00:05
@dannysauer dannysauer added this to the 0.27.0 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants