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

Add GLPN #16199

Merged
merged 21 commits into from
Mar 22, 2022
Merged

Add GLPN #16199

merged 21 commits into from
Mar 22, 2022

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Mar 16, 2022

What does this PR do?

This PR implements GLPN, Global Local Path Networks, for state-of-the-art depth estimation (number 2 on paperswithcode for KITTI and NYUv2 benchmarks).

To do:

  • transfer weights to author's username
  • add tests for GLPNFeatureExtractor
  • rename in_index to something better
  • define DepthEstimatorOutput

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 16, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! LGTM! There are comments about variable names and design choice that we may take to simplify the code

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for adding this new model!

docs/source/model_doc/glpn.mdx Outdated Show resolved Hide resolved
src/transformers/__init__.py Outdated Show resolved Hide resolved
src/transformers/__init__.py Outdated Show resolved Hide resolved
src/transformers/__init__.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/configuration_glpn.py Outdated Show resolved Hide resolved
Comment on lines +412 to +414
return BaseModelOutput(
last_hidden_state=hidden_states,
hidden_states=all_hidden_states,
attentions=all_self_attentions,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return BaseModelOutput(
last_hidden_state=hidden_states,
hidden_states=all_hidden_states,
attentions=all_self_attentions,
)
return BaseModelOutput(
last_hidden_state=hidden_states, hidden_states=all_hidden_states, attentions=all_self_attentions
)

Comment on lines +534 to +536
return BaseModelOutput(
last_hidden_state=sequence_output,
hidden_states=encoder_outputs.hidden_states,
attentions=encoder_outputs.attentions,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return BaseModelOutput(
last_hidden_state=sequence_output,
hidden_states=encoder_outputs.hidden_states,
attentions=encoder_outputs.attentions,
)
return BaseModelOutput(
last_hidden_state=hidden_states, hidden_states=all_hidden_states, attentions=all_self_attentions
)

src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/test.py Outdated Show resolved Hide resolved
tests/glpn/test_modeling_glpn.py Outdated Show resolved Hide resolved
@NielsRogge
Copy link
Contributor Author

Ok I've addressed all comments. Waiting for the author to respond such that I can transfer the weights to his name.

Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of comments :)

src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/modeling_glpn.py Show resolved Hide resolved
src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
src/transformers/models/glpn/modeling_glpn.py Outdated Show resolved Hide resolved
@NielsRogge NielsRogge merged commit 0c55d47 into huggingface:master Mar 22, 2022
FrancescoSaverioZuppichini pushed a commit that referenced this pull request Mar 24, 2022
* First draft

* Fix logits calculation

* Improve tests

* Add copied from statements

* Fix base_model_prefix

* Improve implementation, upload new models

* Update design

* Fix integration test

* Add model to README and toctree

* Add document image

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Add decoder_hidden_size attribute

* Update design of decoder

* Add DepthEstimatorOutput class

* Rename in_index to head_in_index and add feature extractor tests

* Apply suggestions from code review

* Apply suggestions from code review

* Update pretrained model name and add to doc tests

* Remove test.py script

* Update copied from statements and clean up

Co-authored-by: Niels Rogge <nielsrogge@Nielss-MacBook-Pro.local>
Co-authored-by: Sylvain Gugger <35901082+sgugger@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.

4 participants