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

Explicitly specify full package for more modules, as shown in #2001 #2077

Merged
merged 2 commits into from
Sep 22, 2023

Conversation

BjarneHerland
Copy link
Contributor

Explicitly specify full package-name for several methods upon registering as serialisable.

Fixes #2070

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue? Please add a link
    to it if that's the case.
  • Did you write any new necessary tests?
  • If this adds a new model, can you run a few training steps on TPU in Colab to ensure that no XLA incompatible OP are used?

Copy link
Contributor

@ianstenbit ianstenbit left a comment

Choose a reason for hiding this comment

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

Thank you for this fix!

@ianstenbit
Copy link
Contributor

Hi @BjarneHerland -- please take a look at the linter error

./keras_cv/datasets/imagenet/load.py:60:17: E128 continuation line under-indented for visual indent
./keras_cv/datasets/pascal_voc/segmentation.py:46[9](https://github.com/keras-team/keras-cv/actions/runs/6199600190/job/16905705278?pr=2077#step:8:10):17: E128 continuation line under-indented for visual indent
./keras_cv/keypoint/converters.py:64:17: E128 continuation line under-indented for visual indent

Thanks again for the fix!

@jbischof
Copy link
Contributor

Thanks @BjarneHerland. What behavior does this change?

@BjarneHerland
Copy link
Contributor Author

Thanks @BjarneHerland. What behavior does this change?

No problem 👍 It resolves the issue seen in #2070 by following the lead from #2001

On a clean checkout master without this fix, running e.g.

python -c "import keras_cv"

bombs out with naming collisions. (It puzzles me why registration is done like this though, but #2001 was accepted, so I follow... 🤷 We could probably fix maybe_register_serializable() to extract and use the package-part from symbol, with some fallback if necessary, to avoid specifying the package explicit for lots of modules.)

@BjarneHerland
Copy link
Contributor Author

/gcbrun

@BjarneHerland
Copy link
Contributor Author

On a clean checkout master without this fix, running e.g.

python -c "import keras_cv"

bombs out with naming collisions

Something seems to have changed recently (improved lazy-loading?) but this import still triggers the issue for me

python -c "import keras_cv.datasets.imagenet"

@ianstenbit
Copy link
Contributor

/gcbrun

@ianstenbit
Copy link
Contributor

Looks like we've still got some linter errors:

./keras_cv/datasets/load_test.py:21:9: F401 'keras_cv.datasets' imported but unused
./keras_cv/datasets/load_test.py:24:[9](https://github.com/keras-team/keras-cv/actions/runs/6247561832/job/17046212537?pr=2077#step:8:10): F401 'keras_cv.datasets.imagenet' imported but unused
./keras_cv/datasets/load_test.py:28:5: F821 undefined name 'tf'

You can run the linter locally by running sh shell/lint.sh from the base directory of the keras_cv repo 😀

@BjarneHerland
Copy link
Contributor Author

You can run the linter locally by running sh shell/lint.sh from the base directory of the keras_cv repo 😀

Yeah - forgot to do that for the test 😒 Sorry!

@ianstenbit ianstenbit merged commit e5cd24a into keras-team:master Sep 22, 2023
6 of 9 checks passed
ghost pushed a commit to y-vectorfield/keras-cv that referenced this pull request Nov 16, 2023
…eam#2001 (keras-team#2077)

* Test to demonstrate failures in import

* Explicitly specify full package for more modules, as shown in keras-team#2001
yuvraj-wale pushed a commit to yuvraj-wale/keras-cv that referenced this pull request Feb 8, 2024
…eam#2001 (keras-team#2077)

* Test to demonstrate failures in import

* Explicitly specify full package for more modules, as shown in keras-team#2001
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.

keras_cv 0.6.3 fails on import due to conflicting "load" functions
3 participants