huggingface / transformers

πŸ€— Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.18k stars 26.33k forks source link

Pipeline error when creating a model without a model card json file (on Windows) #2625

Closed AlecS12 closed 4 years ago

AlecS12 commented 4 years ago

πŸ› Bug

Model I am using (Bert, XLNet....): Bert Language I am using the model on (English, Chinese....): English The problem arise when using:

if name == 'main': print("start") nlp_ft = pipeline('question-answering', model=r'C:\Users\a652726\PycharmProjects\src\data\raw\qa\wwm-bert-uncased-finetuned-squad', tokenizer='bert-large-uncased')


Results in the ValueError: no modelcard.json file (which i do not have)
My  fix (hack):
In modelcard.py replace (line 164):

```python
        except EnvironmentError:
            if pretrained_model_name_or_path in ALL_PRETRAINED_CONFIG_ARCHIVE_MAP:

with

        except (EnvironmentError, ValueError):
            if pretrained_model_name_or_path in ALL_PRETRAINED_CONFIG_ARCHIVE_MAP:

This results in:

            logger.warning("Creating an empty model card.")

And everything works fine after this.

The tasks I am working on is:

To Reproduce

Steps to reproduce the behavior:

1. 2. 3.

Expected behavior

Environment

Additional context

BramVanroy commented 4 years ago

Please format your post correctly by using code blocks. https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.