Skip to content

chore: Add type hints to import_utils.py module#39994

Closed
wirthual wants to merge 11 commits intohuggingface:mainfrom
wirthual:main
Closed

chore: Add type hints to import_utils.py module#39994
wirthual wants to merge 11 commits intohuggingface:mainfrom
wirthual:main

Conversation

@wirthual
Copy link
Copy Markdown
Contributor

@wirthual wirthual commented Aug 7, 2025

What does this PR do?

Add type hints to import_utils.py

Based on these docs, this change should avoid errors like:

infinity_emb/inference/loading_strategy.py:10: error: Skipping analyzing "transformers.utils.import_utils": module is installed, but missing library stubs or py.typed marker  [import-untyped]

Before submitting

Who can review?

@stevhliu

@wirthual
Copy link
Copy Markdown
Contributor Author

wirthual commented Aug 7, 2025

Failed image download reason for test failure.

See #40000

@stevhliu
Copy link
Copy Markdown
Member

stevhliu commented Aug 7, 2025

cc @Rocketknight1

Copy link
Copy Markdown
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

Yep, changes LGTM!

@Rocketknight1
Copy link
Copy Markdown
Member

Very confused about why the tests are failing - it seems to consistently be the convert_slow_tokenizer test. @ydshieh is that test failing on main?

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Aug 19, 2025

@Rocketknight1 The job (of scheduled daily CI) running tests/utils errors out at the beginning of pytest launching. We don't see the report as no test being run there.

But other CircleCI runs also failing this test?

OK, it does fail when I run it, even with several previous commits.

Can ignore it in this PR as unrelated. I will check

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Aug 19, 2025

actually, it starts to show up on circleci since

https://app.circleci.com/pipelines/github/huggingface/transformers/142539/workflows/dfa78853-c05b-4d18-a2d4-a4ff7a937514/jobs/1885341/tests

(@Rocketknight1 ) but there is no 3rd party lib changes compared to the run just before it ...

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Aug 19, 2025

ok, unrelated warning maybe

{message : DeprecationWarning('builtin type SwigPyPacked has no module attribute'), category : 'DeprecationWarning', filename : '', lineno : 241, line : None}

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Aug 19, 2025

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Aug 20, 2025

i'm not sure why this tests continues to fail on this PR but not on all PRs .

@wirthual
Copy link
Copy Markdown
Contributor Author

Also not sure. I opened a new one as a test here: #40319

If that does not work I can also start the process from the start to make sure it works.

@Rocketknight1
Copy link
Copy Markdown
Member

Closing since we've merged #40319, and thank you for the PR!

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