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 Distill Any Depth #36614

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

keetrap
Copy link
Contributor

@keetrap keetrap commented Mar 8, 2025

This PR add support for Distill Any Depth
Fixes #36499

  • Was this discussed/approved via a Github issue or the forum?
  • Did you read the contributor guideline,
    Pull Request section?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

cc: @qubvel

Sorry, something went wrong.

@github-actions github-actions bot marked this pull request as draft March 8, 2025 17:48
Copy link

github-actions bot commented Mar 8, 2025

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the Ready for review button (at the bottom of the PR page).

@keetrap keetrap marked this pull request as ready for review March 8, 2025 19:34
@Rocketknight1
Copy link
Member

cc @qubvel!

@qubvel qubvel self-requested a review March 13, 2025 18:11
Copy link
Member

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Hey @keetrap! Thanks for working on the model! As far as I can see from the PR, the model architecture is identical to DepthAnything. In that case, we should be able to load the model with AutoModelForDepthEstimation without adding a new model to transformers. The conversion script for DepthAnything can be adjusted to support this model as well, alternatively, you can upload the conversion script to the model repo on the Hub together with the model weights. Please let me know if anything is not clear or if you need any help.

@keetrap
Copy link
Contributor Author

keetrap commented Mar 13, 2025

@qubvel Thanks for the review.
So, should I close this PR or should I update the conversion script of DepthAnything.

@qubvel
Copy link
Member

qubvel commented Mar 14, 2025

Let's update the conversion script, but make sure we do not break the DepthAnything conversion. If it becomes too messy, we can add it as a separate file in the DepthAnything folder.

@keetrap keetrap force-pushed the Distill_Any_Depth branch from b527178 to 5362543 Compare March 15, 2025 15:43
@keetrap
Copy link
Contributor Author

keetrap commented Mar 15, 2025

@qubvel Added conversion script.
Please review the PR

Copy link
Member

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adding conversion script 🤗. Since it's added as a separate file, it would be great to refactor it to use our new standard for conversion files (see the mllama model conversion script for an example). The general idea is to have a single layers MAPPING dictionary with regex-defined substitutions. I would appreciate it if you could update it so that the new pattern is propagated throughout the repo.

keetrap and others added 3 commits March 18, 2025 02:15

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…th_to_hf.py

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@keetrap
Copy link
Contributor Author

keetrap commented Mar 17, 2025

@qubvel Script updated.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@keetrap
Copy link
Contributor Author

keetrap commented Mar 21, 2025

@qubvel Gentle reminder.

Copy link
Member

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Thanks a lot for refactoring, looks good to me 👍 Did you converted the models and uploaded them to the HF hub?

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…th_to_hf.py

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>
@keetrap
Copy link
Contributor Author

keetrap commented Mar 21, 2025

Thanks for the review. I have uploaded the models you can check small and large models.

@qubvel
Copy link
Member

qubvel commented Mar 21, 2025

Thank you! I've opened a PR to add tags to make model more discoverable (please copy them to another checkpoint as well)

https://huggingface.co/keetrap/Distill-Any-Depth-Small-hf/discussions/2

Also, can you please create more descriptive model cards? Here is an example of such a model card
https://huggingface.co/apple/DepthPro-hf

P.S. no need to make it so descriptive as for DepthPro, but some image + abstract/description + code snippet would be super nice

@keetrap
Copy link
Contributor Author

keetrap commented Mar 21, 2025

Thank you! I've opened a PR to add tags to make model more discoverable (please copy them to another checkpoint as well)

https://huggingface.co/keetrap/Distill-Any-Depth-Small-hf/discussions/2

I think it should be added in original repo https://huggingface.co/xingyang1/Distill-Any-Depth-Small-hf and https://huggingface.co/xingyang1/Distill-Any-Depth-Large-hf

@qubvel
Copy link
Member

qubvel commented Mar 21, 2025

Oh, there are originally converted models as well! Nice. Would you be so kind as to open PRs for those repos?

@keetrap
Copy link
Contributor Author

keetrap commented Mar 21, 2025

PRs opened for model cards.

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.

Support Distill Depth Anything
3 participants