question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DummyObjects are impeding PyCharm

See original GitHub issue

I’m subclassing StableDiffusionPipeline (because it seems like that’s the intended way to make a DiffusionPipeline that is still able to take advantage of StableDiffusionPipeline’s methods to enable attention slicing, decode latents, etc.), and I’ve noticed a distinct lack of help from the IDE when it comes to attributes and arguments that I know this class has.

I think that’s because when I hit “go to definition” of the StableDiffusionPipeline I’m using as a superclass, it brings me to this https://github.com/huggingface/diffusers/blob/0b7225e91852df668ce85a7f7a670c00272c9ed0/src/diffusers/utils/dummy_torch_and_transformers_objects.py#L127-L139

no defined arguments to the class __init__, no indication that it’s an ancestor of DiffusionPipeline, no __call__ method, none of the documentation or type hits that you’ve so diligently included in your code.

Should I be importing directly from the full path diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline instead of diffusers.StableDiffusionPipeline?

If so, please remove the diffusers.StableDiffusionPipeline stunt double so that I’m not presented with two options when autocompleting and left to probably pick the wrong one.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
anton-lcommented, Dec 2, 2022

Found the transformers solution, didn’t know it was already addressed there: https://github.com/huggingface/transformers/pull/16578 Assigning to myself as the only pycharm user on the team 😅

1reaction
sguggercommented, Dec 5, 2022

Yes, the PR mentioned above fixes all editors normally, and will make them point to the dummy objects when the framework is not installed, and the real ones when it is 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix PyCharm/VSCode static type checking for dummy objects ...
PyCharm needed an index rebuild to see the changes, closing and reopening the IDE should do the trick. Fixes #1479.
Read more >
How to make Type Checker get along with fake/mock objects?
I've got some unit tests that use fudge to mock out objects. The type checker is looking at the function calls in the...
Read more >
PyCharm Educational 183.4588.180 Release Notes
Feature PY‑5138 Link to source code from .po files Feature PY‑3454 Highlight HTTP links in reStructuredText Feature PY‑3451 Support Structure View for reStructuredText Feature PY‑2239 Custom...
Read more >
PyCharm - Step 3. Test your first Python application - JetBrains
PyCharm auto-detects a test runner that is installed on your Python interpreter and uses it to run tests. If no specific test runner...
Read more >
suppress type check for Mock : PY-10477 - JetBrains YouTrack
There is a further argument for the benefit of PyCharm checking the mock spec. Unittest can check to see if a call to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found