CompressAI icon indicating copy to clipboard operation
CompressAI copied to clipboard

error when trying to use entropy bottleneck of compressai in my code

Open takhtardeshirsoheib opened this issue 1 year ago • 1 comments

error as below:

python train.py Traceback (most recent call last): File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\train.py", line 165, in main() File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\train.py", line 41, in main model = CombinedVAE(latent_channels=latent_channels, pre_trained_spatial_path='./Spatial_checkpoints/vae_model_FT_epoch_200.pth') File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\model.py", line 13, in init self.entropy_bottleneck = EntropyBottleneck(latent_channels_s) File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\compressai\compressai\entropy_models\entropy_models.py", line 351, in init super().init(*args, **kwargs) File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\compressai\compressai\entropy_models\entropy_models.py", line 118, in init entropy_coder = default_entropy_coder() File "C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\compressai\compressai\entropy_models\entropy_models.py", line 84, in default_entropy_coder from compressai import get_entropy_coder ImportError: cannot import name 'get_entropy_coder' from 'compressai' (unknown location)

takhtardeshirsoheib avatar Jun 05 '24 12:06 takhtardeshirsoheib

That says the module compressai is not available in Python's paths.

Try installing CompressAI using the instructions in https://github.com/InterDigitalInc/CompressAI?tab=readme-ov-file#installation. In your case, this means creating a virtual environment, activating the virtual environment, and then pip install -e C:\Users\sohtak\Ph.D-Sweden-France\Sweden\Phase2\Python-Codes\The_Final_versions\VAE_05062024_Bestversion\compressai.

Note that CompressAI is not officially supported on Windows. However, some users have figured out how to get it running by installing the relevant compilers.

YodaEmbedding avatar Jun 06 '24 02:06 YodaEmbedding