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

Adding Depth Anything V2 to Transformers #31803

Closed

Conversation

MackinationsAi
Copy link

@MackinationsAi MackinationsAi commented Jul 5, 2024

What does this PR do?

This version of transformers v4.44.1 has the depth_anything_v2 models added in for use w/ sd-webui-controlnet, as well as forge. In addition it has all of the necessary additions for the huggingface transformers library/page. I have tested it, using the transformers-4.44.1-py3-none-any.whl I built & it works for both a1111 & forge, in addition it passed the test you have us run w/ no errors.

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 or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

MackinationsAi and others added 12 commits June 30, 2024 19:27
	modified:   README.md
	modified:   docs/source/en/model_doc/depth_anything_v2.md
	modified:   setup.py
	modified:   src/transformers/__init__.py
	modified:   src/transformers/models/__init__.py
	modified:   src/transformers/models/depth_anything_v2/__init__.py
	modified:   src/transformers/models/depth_anything_v2/configuration_depth_anything_v2.py
	modified:   src/transformers/models/depth_anything_v2/convert_depth_anything_v2_to_hf.py
	modified:   src/transformers/models/depth_anything_v2/modeling_depth_anything_v2.py
	modified:   tests/models/depth_anything_v2/test_modeling_depth_anything_v2.py
	modified:   tests/models/depth_anything_v2/test_modeling_depth_anything_v2.py
@MackinationsAi MackinationsAi changed the title Depth anything v2 Adding Depth Anything V2 to Transformers Jul 5, 2024
@MackinationsAi
Copy link
Author

MackinationsAi commented Jul 5, 2024

The test_torch failed is w/ the main repo (I didn't touch this script), has nothing to do w/ my additions. FAILED tests/trainer/test_trainer_seq2seq.py::Seq2seqTrainerTester::test_bad_generation_config_fail_early - AssertionError: ValueError not raised =========== 1 failed, 2824 passed, 4025 skipped in 145.18s (0:02:25) =========== My version of this - tests/trainer/test_trainer_seq2seq.py is identical to your main. I would pass the run_tests is this was fixed.

@MackinationsAi
Copy link
Author

Not sure how to fix this - Would reformat: tests/models/depth_anything_v2/test_modeling_depth_anything_v2.py 1 file would be reformatted, 2703 files already formatted Exited with code exit status 1

@MackinationsAi
Copy link
Author

MackinationsAi commented Jul 5, 2024

tests_pipelines_tf failed also has nothing to do w/ my pull request & stems from the main repo. FAILED tests/models/roberta/test_modeling_tf_roberta.py::TFRobertaModelTest::test_pipeline_text_classification - requests.exceptions.ReadTimeout: (ReadTimeoutError("HTTPSConnectionPool(host='huggingface.co', port=443): Read timed out. (read timeout=10)"), '(Request ID: 4c671cea-c951-4a22-9703-0fb0a2fb9d85)') =========== 1 failed, 207 passed, 7848 skipped in 276.69s (0:04:36) ============

@MackinationsAi
Copy link
Author

Tired to fix this but the suggested fix didn't work. Traceback (most recent call last): File "/root/transformers/utils/check_dummies.py", line 237, in <module> check_dummies(args.fix_and_overwrite) File "/root/transformers/utils/check_dummies.py", line 225, in check_dummies raise ValueError( ValueError: The main __init__ has objects that are not present in transformers.utils.dummy_pt_objects.py. Run `make fix-copies` to fix this. Exited with code exit status 1

@MackinationsAi
Copy link
Author

Other than the reformatted portion, my additions aren't throwing up any errors or failures. Please help me make any other necessary changes to get Depth Anything V2 added to Transformers!

@amyeroberts
Copy link
Collaborator

Hi @MackinationsAi, thanks for opening a PR!
There's a PR already opened for this model addition #31522

@MackinationsAi
Copy link
Author

MackinationsAi commented Jul 5, 2024

Hi @MackinationsAi, thanks for opening a PR! There's a PR already opened for this model addition #31522

Hi @amyeroberts, thank you for reaching out. I haven't seen anything that works for Depth Anything V2 on the HF - transformers page. I built a preprocessor in sd-webui-controlnet for depth anything v2 that is working off of the transformer .whl connected to this PR. Mikubill/sd-webui-controlnet#2977. If I'm wrong & transformers already supports Depth Anything V2 then my apologies!

@amyeroberts
Copy link
Collaborator

Hi @MackinationsAi, thanks for sharing your work!

The PR #31522 is still open, so the model isn't available yet in transformers but should be soon. Looking at the comments and the relevant org on the hub it seems it's pending a transfer of converted checkpoints.

@MackinationsAi
Copy link
Author

Hi @MackinationsAi, thanks for sharing your work!

The PR #31522 is still open, so the model isn't available yet in transformers but should be soon. Looking at the comments and the relevant org on the hub it seems it's pending a transfer of converted checkpoints.

Gotcha, I'm glad to hear that it will be in transformers soon. If you all need anything that's already functional & formatted to your guidelines checkout the 11 file changes above. Otherwise seems like you can close this PR then. Appreciate your time @amyeroberts!

@amyeroberts amyeroberts closed this Jul 5, 2024
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