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

bug #6

Closed
Wangpeiyi9979 opened this issue Sep 4, 2021 · 7 comments
Closed

bug #6

Wangpeiyi9979 opened this issue Sep 4, 2021 · 7 comments

Comments

@Wangpeiyi9979
Copy link

Wangpeiyi9979 commented Sep 4, 2021

Hi, thanks for your nice work.
However, I meet a problem when I run the code following the readme.

allennlp.common.checks.ConfigurationError: huggingface not in acceptable choices for dataset_reader.type: ['conll2003', 'interleaving', 'sequence_tagging', 'sharded', 'babi', 'text_classification_json']. You should either use the --include-package flag to make sure the correct module is loaded, or use a fully qualified class name in your config file like {"model": "my_module.models.MyModel"} to have it imported automatically.

I do not use the allennlp before, could you help me?

@tamohannes
Copy link
Member

Hi, @Wangpeiyi9979. Would you please show us exactly what you are trying to run?

@Wangpeiyi9979
Copy link
Author

Hi, I just run the script as follows,

for DATASET in 'cola' 'sst2' 'mrpc' 'qqp' 'stsb' 'mnli' 'rte' 'wnli' 'qnli'
do
    export HPARAMS='{
        "dataset": "'$DATASET'",
        "lr": 0.0001,
        "num_epochs": 20,
        "prompts": [],
        "reorder_optimized": false,
        "max_batch_size": 8,
        "max_tokens_sq": 262144, "on_logits":  false, "pooling_index":  null, "seed":  1}'
    python -m allennlp train \
    -s .aim/baseline-linear-${DATASET} configs/warp.jsonnet
done
'''

@tamohannes
Copy link
Member

@Wangpeiyi9979 can you please put here the full traceback of the error? Does it start downloading the dataset? Or you get the error straight away.

@tamohannes
Copy link
Member

@Wangpeiyi9979 I suspect you didn't install allennlp the way it's required. Please take a look at the Setup section once again. You need to checkout to the branch warp then pip install ..

@Wangpeiyi9979
Copy link
Author

Wangpeiyi9979 commented Sep 5, 2021

Hi, I am sorry that I did not clearly describe the problem before, I did the steps as follows,

git clone https://github.com/YerevaNN/allennlp
cd allennlp
git checkout warp
pip install .
cd ..

I run git checkout warp and pip install . in the allennlp file, since I can not run them in the WARP file.
Then, I run,

for DATASET in 'cola' 'sst2' 'mrpc' 'qqp' 'stsb' 'mnli' 'rte' 'wnli' 'qnli'
do
    export HPARAMS='{
        "dataset": "'$DATASET'",
        "lr": 0.0001,
        "num_epochs": 20,
        "prompts": [],
        "reorder_optimized": false,
        "max_batch_size": 8,
        "max_tokens_sq": 262144, "on_logits":  false, "pooling_index":  null, "seed":  1}'
    python -m allennlp train \
    -s .aim/baseline-linear-${DATASET} configs/warp.jsonnet
done

And the full traceback of the error is as follows,

2021-09-05 15:50:08,480 - INFO - allennlp.common.plugins - Plugin arp available
2021-09-05 15:50:08,530 - INFO - allennlp.common.params - include_in_archive = None
2021-09-05 15:50:08,531 - INFO - allennlp.common.params - random_seed = 170
2021-09-05 15:50:08,531 - INFO - allennlp.common.params - numpy_seed = 17
2021-09-05 15:50:08,531 - INFO - allennlp.common.params - pytorch_seed = 1
2021-09-05 15:50:08,532 - INFO - allennlp.common.checks - Pytorch version: 1.7.1
2021-09-05 15:50:08,532 - INFO - allennlp.common.params - type = default
2021-09-05 15:50:08,533 - INFO - allennlp.common.params - dataset_reader.type = huggingface
2021-09-05 15:50:08,533 - CRITICAL - root - Uncaught exception
Traceback (most recent call last):
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/__main__.py", line 38, in <module>
    run()
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/__main__.py", line 34, in run
    main(prog="allennlp")
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/commands/__init__.py", line 118, in main
    args.func(args)
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/commands/train.py", line 110, in train_model_from_args
    train_model_from_file(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/commands/train.py", line 170, in train_model_from_file
    return train_model(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/commands/train.py", line 236, in train_model
    model = _train_worker(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/commands/train.py", line 453, in _train_worker
    train_loop = TrainModel.from_params(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 595, in from_params
    return retyped_subclass.from_params(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 627, in from_params
    kwargs = create_kwargs(constructor_to_inspect, cls, params, **extras)
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 198, in create_kwargs
    constructed_arg = pop_and_construct_arg(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 305, in pop_and_construct_arg
    return construct_arg(class_name, name, popped_params, annotation, default, **extras)
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 339, in construct_arg
    return annotation.from_params(params=popped_params, **subextras)
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/from_params.py", line 576, in from_params
    choice = params.pop_choice(
  File "/home/wpy/miniconda3/envs/warp3.8/lib/python3.8/site-packages/allennlp/common/params.py", line 352, in pop_choice
    raise ConfigurationError(message)
allennlp.common.checks.ConfigurationError: huggingface not in acceptable choices for dataset_reader.type: ['conll2003', 'interleaving', 'sequence_tagging', 'sharded', 'babi', 'text_classification_json']. You should either use the --include-package flag to make sure the correct module is loaded, or use a fully qualified class name in your config file like {"model": "my_module.models.MyModel"} to have it imported automatically.

@tamohannes
Copy link
Member

@Wangpeiyi9979 can you please check on your allennlp dir if you have such file "allennlp/allennlp/data/dataset_readers/huggingface.py"? If you don't, then you are clearly on another (main) branch.

@Wangpeiyi9979
Copy link
Author

I apologize for my oversight, and thank you for your patient answer!

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