I have a Python virtual environment (venv) with several external libraries/packages installed, such as torch, gradio, and HuggingFace's transformers. I use the interpreter inside the venv to indicate VSCode of code coloring.
It works well with torch and gradio, but not transformers. It's just whited out (the image below).
Code linting and autocompleting still work well. As shown in the image below, VSCode correctly suggested the function signature and docstring for pipeline.
I am using the Dark+ color theme. And my guess is this cannot be fixed by changing the theme as I tried and it didn't help.
Why does it happen? And how to fix it? Thanks a lot!


importwithout()(unusual syntax), maybe use 2 or moreimportlines (Python doesn't matter)from transformers.pipelines import pipelineandfrom transformers.models.speecht5 import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5ProcessorSatisfyingly, both syntax highlighting and Pylance's unknown import symbol are solved. (Sorry for the multiple edits, I'm new on Stackoverflow as a user).__init__.pyfile of thetransformersmodule, it does some strange importing of the modules likepipeline, maybe pylance can't handle that method