

<https://github.com/AntixK/PyTorch-VAE>  
の説明の通り

[code]

    $ git clone https://github.com/AntixK/PyTorch-VAE
    $ cd PyTorch-VAE
    $ pip install -r requirements.txt
    
[/code]

で、インストール。

[code]

    $ cd PyTorch-VAE
    $ python run.py -c configs/<config-file-name.yaml>
    
[/code]

で、実行してみましたが、以下のようなエラーを吐かれました。

[code]

    Traceback (most recent call last):
      File "/content/PyTorch-VAE/run.py", line 7, in <module>
        from experiment import VAEXperiment
      File "/content/PyTorch-VAE/experiment.py", line 7, in <module>
        from utils import data_loader
      File "/content/PyTorch-VAE/utils.py", line 1, in <module>
        import pytorch_lightning as pl
      File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/__init__.py", line 20, in <module>
        from pytorch_lightning.callbacks import Callback  # noqa: E402
      File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/callbacks/__init__.py", line 14, in <module>
        from pytorch_lightning.callbacks.base import Callback
      File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/callbacks/base.py", line 26, in <module>
        from pytorch_lightning.utilities.types import STEP_OUTPUT
      File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/__init__.py", line 18, in <module>
        from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
      File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/apply_func.py", line 30, in <module>
        from torchtext.legacy.data import Batch
    ModuleNotFoundError: No module named 'torchtext.legacy'
    
[/code]

原因が分からないため、教えていただきたいです。


CC BY-SA 4.0
2023-04-03T06:39:58.870
94402
2023-04-03T06:40:26.400
2023-04-03T06:40:26.400
57796
57796
question
google-colaboratory pytorch pip import
torchtext におけるapply_func.py: from torchtext.legacy.data import Batchのimportエラー