facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.41k stars 6.4k forks source link

ImportError: cannot import name 'prune_state_dict' #3292

Open zxpan opened 3 years ago

zxpan commented 3 years ago

🐛 Bug

After git commit 569c024ae6ee3e8c37c3b9dca975a3df50f7a03 The issue was not there before git commit d3890e593398c485f6593ab8512ac51d37dedc9c

import fairseq Traceback (most recent call last): File "", line 1, in File "./fairseq/fairseq/init.py", line 32, in import fairseq.criterions # noqa File "./fairseq/fairseq/criterions/init.py", line 36, in importlib.import_module("fairseq.criterions." + file_name) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "./fairseq/fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py", line 6, in from examples.simultaneous_translation.utils.latency import LatencyTraining File ./fairseq/examples/simultaneous_translation/init.py", line 6, in from . import models # noqa File "./fairseq/examples/simultaneous_translation/models/init.py", line 14, in "examples.simultaneous_translation.models." + model_name File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "./fairseq/examples/simultaneous_translation/models/convtransformer_simul_trans.py", line 8, in from fairseq import checkpoint_utils File "./fairseq/fairseq/checkpoint_utils.py", line 23, in from fairseq.models import FairseqDecoder, FairseqEncoder File "./fairseq/fairseq/models/init.py", line 20, in from .fairseq_model import ( File "./fairseq/fairseq/models/fairseq_model.py", line 17, in from fairseq.checkpoint_utils import prune_state_dict ImportError: cannot import name 'prune_state_dict'

To Reproduce

Steps to reproduce the behavior (always include the command you ran):

  1. Run cmd 'python3` and import fairseq
  2. See error
olafthiele commented 3 years ago

There is already a PR for it. #3286

zxpan commented 3 years ago

great, you can close it now