Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to run pretrained model #20

Closed
amiyamandal-dev opened this issue Oct 5, 2020 · 1 comment
Closed

unable to run pretrained model #20

amiyamandal-dev opened this issue Oct 5, 2020 · 1 comment

Comments

@amiyamandal-dev
Copy link

facing issue with every pre-trained model.

[2020-10-05 22:36:49,902] ERROR in app: Exception on /api/predict/ [POST]
Traceback (most recent call last):
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/gradio/networking.py", line 109, in predict
    prediction, durations = app.interface.process(raw_input)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/gradio/interface.py", line 254, in process
    predictions, durations = self.run_prediction(processed_input, return_duration=True)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/gradio/interface.py", line 216, in run_prediction
    prediction = predict_fn(*processed_input)
  File "predictions_website.py", line 11, in summarize_text
    summarizer = ExtractiveSummarizer.load_from_checkpoint(model_choice)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/pytorch_lightning/core/saving.py", line 153, in load_from_checkpoint
    model = cls._load_model_state(checkpoint, *args, strict=strict, **kwargs)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/pytorch_lightning/core/saving.py", line 192, in _load_model_state
    model.load_state_dict(checkpoint['state_dict'], strict=strict)
  File "/media/amiya/hdd/miniconda/envs/transformersum/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1044, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ExtractiveSummarizer:
	Missing key(s) in state_dict: "word_embedding_model.embeddings.position_ids".
HHousen added a commit that referenced this issue Oct 5, 2020
@HHousen
Copy link
Owner

HHousen commented Oct 5, 2020

@amiyamandal-dev See #12 and #15. Essentially, this is a problem with the update from 3.0.2 to 3.1.0 of huggingface/transformers. The problem is being discussed at huggingface/transformers#6882. While they work on a fix, you can install the previous version of huggingface/transformers by running pip install -U transformers==3.0.2. I've updated the environment.yaml to install version 3.0.2 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants