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

reportAttributeAccessIssue on Hugging Face transformers top-level attributes only in Pre-Release #6966

Closed
ringohoffman opened this issue Feb 20, 2025 · 3 comments
Assignees
Labels
bug Something isn't working fixed in next version (release) A fix has been implemented and will appear in an upcoming version regression

Comments

@ringohoffman
Copy link

ringohoffman commented Feb 20, 2025

Environment data

  • Pylance version: 2025.2.100
  • OS and version: Mac OS Sonoma 14.6.1 (23G93) & Ubuntu 22.04.5 LTS (remote)
  • Python version (& distribution if applicable, e.g. Anaconda): Miniconda, Python 3.10.16

Code Snippet

import transformers

transformers.PreTrainedModel  # "PreTrainedModel" is not a known attribute of module "transformers" Pylance[reportAttributeAccessIssue]

Repro Steps

  1. pip install transformers==4.47.1
  2. Install pre-release version of Pylance (I'm on 2025.2.100)
  3. Python: Clear Cache and Reload Window

Expected behavior

  1. Compare this with the release version 2025.2.1 which does not show this behavior

Actual behavior

  1. "PreTrainedModel" is not a known attribute of module "transformers" Pylance[reportAttributeAccessIssue]
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 20, 2025
@debonte debonte added bug Something isn't working regression and removed needs repro Issue has not been reproduced yet labels Feb 21, 2025
@debonte
Copy link
Contributor

debonte commented Feb 21, 2025

Works in Pyright 1.1.394, so this seems to be a Pylance-specific issue.

Strangely, hover shows info about PreTrainedModel despite the diagnostic:

Image

There's also something weird going on with environment selection. Every time I reload the window, I need to respecify the environment path even if the path shown in the status bar looks correct.

@StellaHuang95
Copy link
Contributor

StellaHuang95 commented Feb 21, 2025

Deleting the partial stubs here seems to resolve the issue, still need to invesigate what the root cause is. pyrx/packages/pylance-internal/bundled/stubs/transformers-stubs at main · microsoft/pyrx

Here're more findings using Pylance preview:

with bundled stubs + without manually copied stubs -> repro
with bundled stubs + with manually copied stubs -> repro
without bundled stubs + without manually copied stubs -> not repro
without bundled stubs + with manually copied stubs -> not repro

Rich thinks it's a linking issue.

@bschnurr bschnurr added the fixed in next version (release) A fix has been implemented and will appear in an upcoming version label Feb 26, 2025
@debonte
Copy link
Contributor

debonte commented Feb 27, 2025

This issue has been fixed in prerelease version 2025.2.102, which we've just released. You can find the changelog here: CHANGELOG.md

@debonte debonte closed this as completed Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (release) A fix has been implemented and will appear in an upcoming version regression
Projects
None yet
Development

No branches or pull requests

4 participants