dmlc / gluon-nlp

NLP made easy
https://nlp.gluon.ai/
Apache License 2.0
2.56k stars 538 forks source link

[usability] Add proper error msg to dataset_name=None #1149

Closed eric-haibin-lin closed 4 years ago

eric-haibin-lin commented 4 years ago

Description

Add proper error message when loading pretrained model with dataset_name=None.

Traceback (most recent call last):
  File "convert.py", line 104, in <module>
    pretrained=True) #, use_classifier=False, use_decoder=False)
  File "/home/ubuntu/src/squad/src/gluonnlp/model/__init__.py", line 155, in get_model
    return models[name](**kwargs)
  File "/home/ubuntu/src/squad/src/gluonnlp/model/bert.py", line 1189, in bert_12_768_12
    hparam_allow_override=hparam_allow_override, **kwargs)
  File "/home/ubuntu/src/squad/src/gluonnlp/model/bert.py", line 1646, in get_bert_model
    allow_missing=pretrained_allow_missing)
  File "/home/ubuntu/src/squad/src/gluonnlp/model/utils.py", line 279, in _load_pretrained_params
    path = '_'.join([model_name, dataset_name])
TypeError: sequence item 1: expected str instance, NoneType found

Checklist

Essentials

Changes

Comments

cc @dmlc/gluon-nlp-team

codecov[bot] commented 4 years ago

Codecov Report

Merging #1149 into master will decrease coverage by 0.07%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1149      +/-   ##
==========================================
- Coverage   87.42%   87.34%   -0.08%     
==========================================
  Files          81       80       -1     
  Lines        7345     7366      +21     
==========================================
+ Hits         6421     6434      +13     
- Misses        924      932       +8
Impacted Files Coverage Δ
src/gluonnlp/model/utils.py 80.15% <100%> (+0.15%) :arrow_up:
src/gluonnlp/data/baidu_ernie_data.py 85.96% <100%> (+0.25%) :arrow_up:
src/gluonnlp/utils/files.py 42.62% <0%> (-1.02%) :arrow_down:
src/gluonnlp/data/transforms.py 83.05% <0%> (-0.8%) :arrow_down:
src/gluonnlp/data/conll.py 100% <0%> (ø) :arrow_up:
src/gluonnlp/data/question_answering.py 100% <0%> (ø) :arrow_up:
src/gluonnlp/data/corpora/wikitext.py 100% <0%> (ø) :arrow_up:
src/gluonnlp/data/translation.py 100% <0%> (ø) :arrow_up:
src/gluonnlp/model/info.py
src/gluonnlp/data/glue.py 99.09% <0%> (ø) :arrow_up:
... and 7 more
mli commented 4 years ago

Job PR-1149/1 is complete. Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-1149/1/index.html

mli commented 4 years ago

Job PR-1149/3 is complete. Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-1149/3/index.html

mli commented 4 years ago

Job PR-1149/9 is complete. Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-1149/9/index.html

mli commented 4 years ago

Job PR-1149/10 is complete. Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-1149/10/index.html

mli commented 4 years ago

Job PR-1149/11 is complete. Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-1149/11/index.html