Giter Club home page Giter Club logo

decanlp's Introduction

decaNLP Logo

Build Status

The Natural Language Decathlon is a multitask challenge that spans ten tasks: question answering (SQuAD), machine translation (IWSLT), summarization (CNN/DM), natural language inference (MNLI), sentiment analysis (SST), semantic role labeling(QA‑SRL), zero-shot relation extraction (QA‑ZRE), goal-oriented dialogue (WOZ, semantic parsing (WikiSQL), and commonsense reasoning (MWSC). Each task is cast as question answering, which makes it possible to use our new Multitask Question Answering Network (MQAN). This model jointly learns all tasks in decaNLP without any task-specific modules or parameters in the multitask setting. For a more thorough introduction to decaNLP and the tasks, see the main website, our blog post, or the paper.

While the research direction associated with this repository focused on multitask learning, the framework itself is designed in a way that should make single-task training, transfer learning, and zero-shot evaluation simple. Similarly, the paper focused on multitask learning as a form of question answering, but this framework can be easily adapted for different approaches to single-task or multitask learning.

Leaderboard

Model decaNLP SQuAD IWSLT CNN/DM MNLI SST QA‑SRL QA‑ZRE WOZ WikiSQL MWSC
MQAN(Sampling+CoVe) 609.0 77.0 21.4 24.4 74.0 86.5 80.9 40.9 84.8 70.2 48.8
MQAN(QA‑first+CoVe) 599.9 75.5 18.9 24.4 73.6 86.4 80.8 37.4 85.8 68.5 48.8
MQAN(QA‑first) 590.5 74.4 18.6 24.3 71.5 87.4 78.4 37.6 84.8 64.8 48.7
S2S 513.6 47.5 14.2 25.7 60.9 85.9 68.7 28.5 84.0 45.8 52.4

Getting Started

GPU vs. CPU

The devices argument can be used to specify the devices for training. For CPU training, specify --devices -1; for GPU training, specify --devices DEVICEID. Note that Multi-GPU training is currently a WIP, so --device is sufficient for commands below. The default will be to train on GPU 0 as training on CPU will be quite time-consuming to train on all ten tasks in decaNLP.

If you want to use CPU, then remove the nvidia- and the cuda9_ prefixes from the default commands listed in sections below. This will allow you to use Docker without CUDA.

For example, if you have CUDA and all the necessary drivers and GPUs, you you can run a command inside the CUDA Docker image using:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "COMMAND --device 0"

If you want to run the same command without CUDA:

docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:torch041 bash -c "COMMAND --device -1"

For those in the Docker know, you can look at the Dockerfiles used to build these two images in dockerfiles/.

PyTorch Version

The research associated with the original paper was done using Pytorch 0.3, but we have since migrated to 0.4. If you want to replicate results from the paper, then to be safe, you should use the code at a commit on or before 3c4f94b88768f4c3efc2fd4f015fed2f5453ebce. You should also replace toch041 with torch03 in the commands below to access a Docker image with the older version of PyTorch.

Training

For example, to train a Multitask Question Answering Network (MQAN) on the Stanford Question Answering Dataset (SQuAD) on GPU 0:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/train.py --train_tasks squad --device 0"

To multitask with the fully joint, round-robin training described in the paper, you can add multiple tasks:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/train.py --train_tasks squad iwslt.en.de --train_iterations 1 --device 0"

To train on the entire Natural Language Decathlon:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/train.py --train_tasks squad iwslt.en.de cnn_dailymail multinli.in.out sst srl zre woz.en wikisql schema --train_iterations 1 --device 0"

To pretrain on n_jump_start=1 tasks for jump_start=75000 iterations before switching to round-robin sampling of all tasks in the Natural Language Decathlon:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/train.py --n_jump_start 1 --jump_start 75000 --train_tasks squad iwslt.en.de cnn_dailymail multinli.in.out sst srl zre woz.en wikisql schema --train_iterations 1 --device 0"

This jump starting (or pretraining) on a subset of tasks can be done for any set of tasks, not only the entirety of decaNLP.

Tensorboard

If you would like to make use of tensorboard, you can add the --tensorboard flag to your training runs. This will log things in the format that Tensorboard expects.

To read those files and run the Tensorboard server, run (typically in a tmux pane or equivalent so that the process is not killed when you shut your laptop) the following command:

docker run -it --rm -p 0.0.0.0:6006:6006 -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "tensorboard --logdir /decaNLP/results"

If you are running the server on a remote machine, you can run the following on your local machine to forward to http://localhost:6006/:

ssh -4 -N -f -L 6006:127.0.0.1:6006 YOUR_REMOTE_IP

If you are having trouble with the specified port on either machine, run lsof -if:6006 and kill the process if it is unnecessary. Otherwise, try changing the port numbers in the commands above. The first port number is the port the local machine tries to bind to, and and the second port is the one exposed by the remote machine (or docker container).

Notes on Training

  • On a single NVIDIA Volta GPU, the code should take about 3 days to complete 500k iterations. These should be sufficient to approximately reproduce the experiments in the paper. Training for about 7 days should be enough to fully replicate those scores, which should be only a few points higher than what is achieved by 500k iterations.
  • The model can be resumed using stored checkpoints using --load <PATH_TO_CHECKPOINT> and --resume. By default, models are stored every --save_every iterations in the results/ folder tree.
  • During training, validation can be slow! Especially when computing ROUGE scores. Use the --val_every flag to change the frequency of validation.
  • If you run out of GPU memory, reduce --train_batch_tokens and --val_batch_size.
  • If you run out of CPU memory, make sure that you are running the most recent version of the code that interns strings; if you are still running out of CPU memory, post an issue with the command you ran and your peak memory usage.
  • The first time you run, the code will download and cache all considered datasets. Please be advised that this might take a while, especially for some of the larger datasets.

Notes on Cached Data

  • In order to make data loading much quicker for repeated experiments, datasets are cached using code in text/torchtext/datasets/generic.py.
  • If there is an update to this repository that touches any files in text/, then it might have changed the way a dataset is cached. If this is the case, then you'll need to delete all relevant cached files or you will not see the changes.
  • Paths to cached files should be printed out when a dataset is loaded, either in training or in prediction. Search the text logged to stdout for Loading cached data from or Caching data to in order to locate the relevant path names for data caches.

Evaluation

You can evaluate a model for a specific task with EVALUATION_TYPE as validation or test:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/predict.py --evaluate EVALUATION_TYPE --path PATH_TO_CHECKPOINT_DIRECTORY --device 0 --tasks squad"

or evaluate on the entire decathlon by removing any task specification:

nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/predict.py --evaluate EVALUATION_TYPE --path PATH_TO_CHECKPOINT_DIRECTORY --device 0"

For test performance, please use the original SQuAD, MultiNLI, and WikiSQL evaluation systems. For WikiSQL, there is a detailed walk-through of how to get test numbers in the section of this document concerning pretrained models.

Pretrained Models

This model is the best MQAN trained on decaNLP so far. It was trained first on SQuAD and then on all of decaNLP. It uses CoVe as well. You can obtain this model and run it on the validation sets with the following.

wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/mqan_decanlp_better_sampling_cove_cpu.tgz
tar -xvzf mqan_decanlp_better_sampling_cove_cpu.tgz
nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_decanlp_better_sampling_cove_cpu/ --checkpoint_name iteration_560000.pth --device 0 --silent"

This model is the best MQAN trained on WikiSQL alone, which established a new state-of-the-art performance by several points on that task: 73.2 / 75.4 / 81.4 (ordered test logical form accuracy, unordered test logical form accuracy, test execution accuracy).

wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/mqan_wikisql_cpu.tar.gz
tar -xvzf mqan_wikisql_cpu.tar.gz
nvidia-docker run -it --rm -v `pwd`:/decaNLP/  bmccann/decanlp:cuda9_torch041 -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_wikisql_cpu --checkpoint_name iteration_57000.pth --device 0 --tasks wikisql"
nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/predict.py --evaluate test --path /decaNLP/mqan_wikisql_cpu --checkpoint_name iteration_57000.pth --device 0 --tasks wikisql"
docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/convert_to_logical_forms.py /decaNLP/.data/ /decaNLP/mqan_wikisql_cpu/iteration_57000/validation/wikisql.txt /decaNLP/mqan_wikisql_cpu/iteration_57000/validation/wikisql.ids.txt /decaNLP/mqan_wikisql_cpu/iteration_57000/validation/wikisql_logical_forms.jsonl valid"
docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/convert_to_logical_forms.py /decaNLP/.data/ /decaNLP/mqan_wikisql_cpu/iteration_57000/test/wikisql.txt /decaNLP/mqan_wikisql_cpu/iteration_57000/test/wikisql.ids.txt /decaNLP/mqan_wikisql_cpu/iteration_57000/test/wikisql_logical_forms.jsonl test"
git clone https://github.com/salesforce/WikiSQL.git #[email protected]:salesforce/WikiSQL.git for ssh
docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/WikiSQL/evaluate.py /decaNLP/.data/wikisql/data/dev.jsonl /decaNLP/.data/wikisql/data/dev.db /decaNLP/mqan_wikisql_cpu/iteration_57000/validation/wikisql_logical_forms.jsonl" # assumes that you have data stored in .data
docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/WikiSQL/evaluate.py /decaNLP/.data/wikisql/data/test.jsonl /decaNLP/.data/wikisql/data/test.db /decaNLP/mqan_wikisql_cpu/iteration_57000/test/wikisql_logical_forms.jsonl" # assumes that you have data stored in .data

You can similarly follow the instructions above for downloading, decompressing, and loading in pretrained models for other indivual tasks (single-task models):

wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/squad_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/cnn_dailymail_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/iwslt.en.de_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/sst_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/multinli.in.out_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/woz.en_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/srl_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/zre_mqan_cove_cpu.tgz
wget https://s3.amazonaws.com/research.metamind.io/decaNLP/pretrained/schema_mqan_cove_cpu.tgz

Inference on a Custom Dataset

Using a pretrained model or a model you have trained yourself, you can run on new, custom datasets easily by following the instructions below. In this example, we use the checkpoint for the best MQAN trained on the entirety of decaNLP (see the section on Pretrained Models to see how to get this checkpoint) to run on my_custom_dataset.

mkdir -p .data/my_custom_dataset/
touch .data/my_custom_dataset/val.jsonl
echo '{"context": "The answer is answer.", "question": "What is the answer?", "answer": "answer"}' >> .data/my_custom_dataset/val.jsonl 
# TODO add your own examples line by line to val.jsonl in the form of a JSON dictionary, as demonstrated above.
# Make sure to delete the first line if you don't want the demonstrated example.
nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/predict.py --evaluate valid --path /decaNLP/mqan_decanlp_qa_first_cpu --checkpoint_name iteration_1140000.pth --tasks my_custom_dataset"

You should get output that ends with something like this:

**  /decaNLP/mqan_decanlp_qa_first_cpu/iteration_1140000/valid/my_custom_dataset.txt  already exists -- this is where predictions are stored **
**  /decaNLP/mqan_decanlp_qa_first_cpu/modeltion_1140000/valid/my_custom_dataset.gold.txt  already exists -- this is where ground truth answers are stored **
**  /decaNLP/mqan_decanlp_qa_first_cpu/modeltion_1140000/valid/my_custom_dataset.results.txt  already exists -- this is where metrics are stored **
{"em":0.0,"nf1":100.0,"nem":100.0}

{'em': 0.0, 'nf1': 100.0, 'nem': 100.0}
Prediction: the answer
Answer: answer

From this output, you can see where predictions are stored along with ground truth outputs and metrics. If you want to rerun using this model checkpoint on this particular dataset, you'll need to pass the --overwrite_predictions argument to predict.py. If you do not want predictions and answers printed to stdout, then pass the --silent argument to predict.py.

The metrics dictionary should have printed something like {'em': 0.0, 'nf1': 100.0, 'nem': 100.0}. Here em stands for exact match. This is the percentage of predictions that had every token match the ground truth answer exactly. The normalized version, nem, lowercases and strips punctuation -- all of our models are trained on lowercased data, so nem is a more accurate representation of performance than em for our models. For tasks that are typically treated as classification problems, these exact match scores should correspond to accuracy. nf1 is a normalized (lowercased; punctuation stripped) F1 score over the predicted and ground truth sequences. If you would like to add additional metrics that are already implemented you can try adding --bleu (the typical metric for machine translation) and --rouge (the typical metric for summarization). Other metrics can be implemented following the patterns in metrics.py.

Citation

If you use this in your work, please cite The Natural Language Decathlon: Multitask Learning as Question Answering.

@article{McCann2018decaNLP,
  title={The Natural Language Decathlon: Multitask Learning as Question Answering},
  author={Bryan McCann and Nitish Shirish Keskar and Caiming Xiong and Richard Socher},
  journal={arXiv preprint arXiv:1806.08730},
  year={2018}
}

Contact

Contact: [email protected] and [email protected]

decanlp's People

Contributors

bmccann avatar daminisatya avatar dfenglei avatar huangyh1108 avatar jamesward avatar keskarnitish avatar svc-scm avatar t-vi avatar todpole3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

decanlp's Issues

Runtime error: the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

Hi,
I am running the code using my own corpus with format of squad, and I did not change any other settings. But when I ran the code, I encountered this issue:

Traceback (most recent call last):
File "train.py", line 369, in
main()
File "train.py", line 365, in main
run(args, run_args, world_size=args.world_size)
File "train.py", line 313, in run
writer=writer if rank==0 else None, save_every=args.save_every, start_iteration=start_iteration)
File "train.py", line 180, in train
val_loss, metric_dict = validate(val_task, val_iter, model, logger, field, world_size, rank, num_print=args.num_print, args=args)
File "/data01/bao/decaNLP/validate.py", line 72, in validate
loss, prediction answers, results = gather_results(model, val_iter, field, world_size, optional_names=optional_names)
f sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
File "/data01/bao/decaNLP/validate.py", line 48, in gather_results
loss, predictions, answers, outputs = compute_validation_outputs(model, val_iter, field, optional_names=optional_names)
File "/data01/bao/decaNLP/validate.py", line 9, in compute_validation_outputs
l, p = model(batch)
File "/home/kaifa/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/data01/bao/decaNLP/models/multitask_question_answering_network.py", line 124, in forward
oov_to_limited_idx, rnn_state=context_rnn_state).data
File "/data01/bao/decaNLP/models/multitask_question_answering_network.py", line 196, in greedy
outs[:, t] = Variable(preds.data.cpu().apply_(self.map_to_full), volatile=True)
RuntimeError: expand(torch.LongTensor{[256, 1]}, size=[256]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

It seems that the torch need a size with two dimensions but you only offer one? Does size[256] work correctly here? Or do I need to change this?
Thank you!

running out of memory

I am trying to train a Multitask Question Answering Network (MQAN) on the Stanford Question Answering Dataset (SQuAD).
My GPU has 11GB memory.
I met such error:

process_0 - Begin Training
THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1518244421288/work/torch/lib/THC/generic/THCStorage.cu line=58 error=2 : out of memory
Traceback (most recent call last):
  File "/decaNLP/train.py", line 365, in <module>
    main()
  File "/decaNLP/train.py", line 361, in main
    run(args, run_args, world_size=args.world_size)
  File "/decaNLP/train.py", line 309, in run
    writer=writer if rank==0 else None, save_every=args.save_every, start_iteration=start_iteration)
  File "/decaNLP/train.py", line 220, in train
    loss, train_metric_dict = step(model, batch, opt, iteration, field, task, lr=lr, grad_clip=args.grad_clip, writer=writer, it=train_iter)
  File "/decaNLP/train.py", line 130, in step
    loss, predictions = model(batch)
  File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/decaNLP/models/multitask_question_answering_network.py", line 116, in forward
    oov_to_limited_idx)
  File "/decaNLP/models/multitask_question_answering_network.py", line 153, in probs
    p_question_ptr = Variable(scaled_p_vocab.data.new(*scaled_p_vocab.size()).fill_(EPSILON))
RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1518244421288/work/torch/lib/THC/generic/THCStorage.cu:58

any idea how to fix it?

cannot reproduce output for custom dataset from example

I am trying to reproduce the output using example inference code for custom dataset. Followed the shown process to generate my_custom_dataset but the output does not match.

Command:
docker run -it --rm -v pwd:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:torch041 bash -c "python /decaNLP/predict.py --evaluate valid --path /decaNLP/squad_mqan_cove_cpu --checkpoint_name iteration_39000.pth --tasks my_custom_dataset --device -1"

Here is the output I am getting, which does not show the prediction at all. It also keeps expanding the vocabulary everytime I run the above command.

39000
77.18
Arguments:
{'best_checkpoint': '/decaNLP/squad_mqan_cove_cpu/iteration_39000.pth',
 'bleu': False,
 'checkpoint_name': 'iteration_39000.pth',
 'cove': True,
 'data': '/decaNLP/.data/',
 'devices': [-1],
 'dimension': 200,
 'dropout_ratio': 0.0,
 'embeddings': '/decaNLP/.embeddings',
 'evaluate': 'valid',
 'intermediate_cove': False,
 'load': None,
 'lower': True,
 'max_generative_vocab': 50000,
 'max_output_length': 100,
 'max_val_context_length': 400,
 'model': 'MultitaskQuestionAnsweringNetwork',
 'overwrite_predictions': False,
 'path': '/decaNLP/squad_mqan_cove_cpu',
 'rnn_layers': 1,
 'rouge': False,
 'seed': 123,
 'silent': False,
 'task_to_metric': {'cnn_dailymail': 'avg_rouge',
                    'iwslt.en.de': 'bleu',
                    'multinli.in.out': 'em',
                    'schema': 'em',
                    'squad': 'nf1',
                    'srl': 'nf1',
                    'sst': 'em',
                    'wikisql': 'lfem',
                    'woz.en': 'joint_goal_em',
                    'zre': 'corpus_f1'},
 'tasks': ['my_custom_dataset'],
 'transformer_heads': 3,
 'transformer_hidden': 150,
 'transformer_layers': 2,
 'val_batch_size': [256]}
Loading from /decaNLP/squad_mqan_cove_cpu/iteration_39000.pth
Initializing Model
Loading my_custom_dataset
Caching data to /decaNLP/.data/my_custom_dataset/.cache/val.jsonl/None
Vocabulary has 87176 tokens from training
Vocabulary has expanded to 87176 tokens
100%|█████████████████████████████████████████████████████████████████████████████████████| 874474/874474 [00:30<00:00, 28815.11it/s]

I am running this on Macbook Pro with Anaconda. Here is the output for conda list:


# packages in environment at /Users/MY_USER_NAME/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py36_0
alabaster                 0.7.12                   py36_0
anaconda                  5.0.1            py36h6e48e2d_1
anaconda-client           1.7.2                    py36_0
anaconda-navigator        1.9.2                    py36_0
anaconda-project          0.8.2                    py36_0
appnope                   0.1.0            py36hf537a9a_0
appscript                 1.0.1            py36h1de35cc_1
asn1crypto                0.24.0                   py36_0
astroid                   2.1.0                    py36_0
astropy                   3.0.5            py36h1de35cc_0
atomicwrites              1.2.1                    py36_0
attrs                     18.2.0           py36h28b3542_0
babel                     2.6.0                    py36_0
backcall                  0.1.0                    py36_0
backports                 1.0                      py36_1
backports.os              0.1.1                    py36_0
backports.shutil_get_terminal_size 1.0.0                    py36_2
beautifulsoup4            4.6.3                    py36_0
bitarray                  0.8.3            py36h1de35cc_0
bkcharts                  0.2              py36h073222e_0
blas                      1.0                         mkl
blaze                     0.11.3           py36h02e7a37_0
bleach                    3.0.2                    py36_0
blosc                     1.14.4               hd9629dc_0
bokeh                     1.0.2                    py36_0
boto                      2.49.0                   py36_0
bottleneck                1.2.1            py36h1d22016_1
bzip2                     1.0.6                h1de35cc_5
ca-certificates           2019.1.23                     0
certifi                   2018.11.29               py36_0
cffi                      1.11.5           py36h6174b99_1
chardet                   3.0.4                    py36_1
click                     7.0                      py36_0
cloudpickle               0.6.1                    py36_0
clyent                    1.2.2                    py36_1
colorama                  0.4.0                    py36_0
conda                     4.6.3                    py36_0
conda-build               3.17.1                   py36_0
conda-env                 2.6.0                         1
conda-verify              3.1.1                    py36_0
contextlib2               0.5.5            py36hd66e5e7_0
cryptography              2.5              py36ha12b0ac_0
curl                      7.63.0            ha441bb4_1000
cycler                    0.10.0           py36hfc81398_0
cython                    0.29             py36h0a44026_0
cytoolz                   0.9.0.1          py36h1de35cc_1
dask                      1.0.0                    py36_0
dask-core                 1.0.0                    py36_0
datashape                 0.5.4                    py36_1
dbus                      1.13.2               h760590f_1
decorator                 4.3.0                    py36_0
distributed               1.25.0                   py36_0
docutils                  0.14             py36hbfde631_0
entrypoints               0.2.3                    py36_2
et_xmlfile                1.0.1            py36h1315bdc_0
expat                     2.2.6                h0a44026_0
fastcache                 1.0.2            py36h1de35cc_2
filelock                  3.0.10                   py36_0
flake8                    3.6.0                    py36_0
flask                     1.0.2                    py36_1
flask-cors                3.0.7                    py36_0
freetype                  2.9.1                hb4e5f40_0
future                    0.17.1                   py36_0
get_terminal_size         1.0.0                h7520d66_0
gettext                   0.19.8.1             h15daf44_3
gevent                    1.3.7            py36h1de35cc_1
glib                      2.56.2               hd9629dc_0
glob2                     0.6                      py36_1
gmp                       6.1.2                hb37e062_1
gmpy2                     2.0.8            py36h6ef4df4_2
greenlet                  0.4.15           py36h1de35cc_0
h5py                      2.8.0            py36h878fce3_3
hdf5                      1.10.2               hfa1e0ec_1
heapdict                  1.0.0                    py36_2
html5lib                  1.0.1                    py36_0
icu                       58.2                 h4b95b61_1
idna                      2.7                      py36_0
imageio                   2.4.1                    py36_0
imagesize                 1.1.0                    py36_0
importlib_metadata        0.6                      py36_0
intel-openmp              2019.1                      144
ipykernel                 5.1.0            py36h39e3cac_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h241746c_0
ipywidgets                7.4.2                    py36_0
isort                     4.3.4                    py36_0
itsdangerous              1.1.0                    py36_0
jbig                      2.1                  h4d881f8_0
jdcal                     1.4                      py36_0
jedi                      0.13.1                   py36_0
jinja2                    2.10                     py36_0
jpeg                      9b                   he5867d9_2
jsonschema                2.6.0            py36hb385e00_0
jupyter                   1.0.0                    py36_7
jupyter_client            5.2.3                    py36_0
jupyter_console           6.0.0                    py36_0
jupyter_core              4.4.0                    py36_0
jupyterlab                0.35.3                   py36_0
jupyterlab_launcher       0.13.1                   py36_0
jupyterlab_server         0.2.0                    py36_0
keyring                   16.1.1                   py36_0
kiwisolver                1.0.1            py36h0a44026_0
krb5                      1.16.1               hddcf347_7
lazy-object-proxy         1.3.1            py36h1de35cc_2
libarchive                3.3.3                he8b1da1_2
libcurl                   7.63.0            h051b688_1000
libcxx                    4.0.1                hcfea43d_1
libcxxabi                 4.0.1                hcfea43d_1
libedit                   3.1.20170329         hb402a30_2
libffi                    3.2.1                h475c297_4
libgfortran               3.0.1                h93005f0_2
libiconv                  1.15                 hdd342a3_7
liblief                   0.9.0                h2a1bed3_0
libpng                    1.6.35               ha441bb4_0
libsodium                 1.0.16               h3efe00b_0
libssh2                   1.8.0                ha12b0ac_4
libtiff                   4.0.9                hcb84e12_2
libxml2                   2.9.8                hab757c2_1
libxslt                   1.1.32               hb819dd2_0
llvmlite                  0.26.0           py36h8c7ce04_0
locket                    0.2.0            py36hca03003_1
lxml                      4.2.5            py36hef8c89e_0
lz4-c                     1.8.1.2              h1de35cc_0
lzo                       2.10                 h362108e_2
markupsafe                1.1.0            py36h1de35cc_0
matplotlib                3.0.1            py36h54f8f79_0
mccabe                    0.6.1                    py36_1
mistune                   0.8.4            py36h1de35cc_0
mkl                       2018.0.3                      1
mkl-service               1.1.2            py36h6b9c3cc_5
mkl_fft                   1.0.6            py36hb8a8100_0
mkl_random                1.0.1            py36h5d10147_1
more-itertools            4.3.0                    py36_0
mpc                       1.1.0                h6ef4df4_1
mpfr                      4.0.1                h3018a27_3
mpmath                    1.0.0                    py36_2
msgpack-python            0.5.6            py36h04f5b5a_1
multipledispatch          0.6.0                    py36_0
navigator-updater         0.2.1                    py36_0
nbconvert                 5.3.1                    py36_0
nbformat                  4.4.0            py36h827af21_0
ncurses                   6.1                  h0a44026_1
networkx                  2.2                      py36_1
ninja                     1.8.2            py36h04f5b5a_1
nltk                      3.3.0                    py36_0
nose                      1.3.7                    py36_2
notebook                  5.7.2                    py36_0
numba                     0.35.0              np113py36_6
numexpr                   2.6.8            py36h1dc9127_0
numpy                     1.15.4           py36h6a91979_0
numpy-base                1.15.4           py36h8a80b8c_0
numpydoc                  0.8.0                    py36_0
odo                       0.5.1            py36hc1af34a_0
olefile                   0.46                     py36_0
openpyxl                  2.5.11                   py36_0
openssl                   1.1.1a               h1de35cc_0
packaging                 18.0                     py36_0
pandas                    0.23.4           py36h6440ff4_0
pandoc                    2.2.3.2                       0
pandocfilters             1.4.2                    py36_1
parso                     0.3.1                    py36_0
partd                     0.3.9                    py36_0
path.py                   11.5.0                   py36_0
pathlib2                  2.3.2                    py36_0
patsy                     0.5.1                    py36_0
pcre                      8.42                 h378b8a2_0
pep8                      1.7.1                    py36_0
pexpect                   4.6.0                    py36_0
pickleshare               0.7.5                    py36_0
pillow                    5.3.0            py36hb68e598_0
pip                       18.1                     py36_0
pkginfo                   1.4.2                    py36_1
pluggy                    0.8.0                    py36_0
ply                       3.11                     py36_0
prometheus_client         0.4.2                    py36_0
prompt_toolkit            2.0.7                    py36_0
psutil                    5.4.8            py36h1de35cc_0
ptyprocess                0.6.0                    py36_0
py                        1.7.0                    py36_0
py-lief                   0.9.0            py36hd4eaf27_0
pycodestyle               2.4.0                    py36_0
pycosat                   0.6.3            py36h1de35cc_0
pycparser                 2.19                     py36_0
pycrypto                  2.6.1            py36h1de35cc_9
pycurl                    7.43.0.2         py36ha12b0ac_0
pyflakes                  2.0.0                    py36_0
pygments                  2.2.0            py36h240cd3f_0
pylint                    2.2.2                    py36_0
pyodbc                    4.0.24           py36h0a44026_0
pyopenssl                 18.0.0                   py36_0
pyparsing                 2.3.0                    py36_0
pyqt                      5.9.2            py36h655552a_2
pysocks                   1.6.8                    py36_0
pytables                  3.4.4            py36h13cba08_0
pytest                    4.0.1                    py36_0
pytest-arraydiff          0.2              py36h39e3cac_0
pytest-astropy            0.4.0                    py36_0
pytest-doctestplus        0.2.0                    py36_0
pytest-openfiles          0.3.1                    py36_0
pytest-remotedata         0.3.1                    py36_0
python                    3.6.7                haf84260_0
python-dateutil           2.7.5                    py36_0
python-libarchive-c       2.8                      py36_6
python.app                2                        py36_9
pytorch                   0.4.1           py36_cuda0.0_cudnn0.0_1    pytorch
pytz                      2018.7                   py36_0
pywavelets                1.0.1            py36h1d22016_0
pyyaml                    3.13             py36h1de35cc_0
pyzmq                     17.1.2           py36h1de35cc_0
qt                        5.9.6                h45cd832_2
qtawesome                 0.5.3                    py36_0
qtconsole                 4.4.2                    py36_0
qtpy                      1.5.2                    py36_0
readline                  7.0                  h1de35cc_5
requests                  2.20.1                   py36_0
rope                      0.11.0                   py36_0
ruamel_yaml               0.15.46          py36h1de35cc_0
scikit-image              0.14.0           py36h0a44026_1
scikit-learn              0.20.1           py36h4f467ca_0
scipy                     1.1.0            py36h28f7352_1
seaborn                   0.9.0                    py36_0
send2trash                1.5.0                    py36_0
setuptools                40.6.2                   py36_0
simplegeneric             0.8.1                    py36_2
singledispatch            3.4.0.3          py36hf20db9d_0
sip                       4.19.8           py36h0a44026_0
six                       1.11.0                   py36_1
snappy                    1.1.7                he62c110_3
snowballstemmer           1.2.1            py36h6c7b616_0
sortedcollections         1.0.1                    py36_0
sortedcontainers          2.1.0                    py36_0
sphinx                    1.8.2                    py36_0
sphinxcontrib             1.0                      py36_1
sphinxcontrib-websupport  1.1.0                    py36_1
spyder                    3.3.2                    py36_0
spyder-kernels            0.3.0                    py36_0
sqlalchemy                1.2.14           py36h1de35cc_0
sqlite                    3.25.3               ha441bb4_0
statsmodels               0.9.0            py36h1d22016_0
sympy                     1.3                      py36_0
tblib                     1.3.2            py36hda67792_0
terminado                 0.8.1                    py36_1
testpath                  0.4.2                    py36_0
tk                        8.6.8                ha441bb4_0
toolz                     0.9.0                    py36_0
torchvision               0.2.1                    py36_1    pytorch
tornado                   5.1.1            py36h1de35cc_0
tqdm                      4.28.1           py36h28b3542_0
traitlets                 4.3.2            py36h65bd3ce_0
typed-ast                 1.1.0            py36h1de35cc_0
typing                    3.6.4                    py36_0
unicodecsv                0.14.1           py36he531d66_0
unixodbc                  2.3.7                h1de35cc_0
urllib3                   1.23                     py36_0
wcwidth                   0.1.7            py36h8c6ec74_0
webencodings              0.5.1                    py36_1
werkzeug                  0.14.1                   py36_0
wheel                     0.32.3                   py36_0
widgetsnbextension        3.4.2                    py36_0
wrapt                     1.10.11          py36h1de35cc_2
wurlitzer                 1.0.2                    py36_0
xlrd                      1.1.0                    py36_1
xlsxwriter                1.1.2                    py36_0
xlwings                   0.15.0                   py36_0
xlwt                      1.2.0            py36h5ad1178_0
xz                        5.2.4                h1de35cc_4
yaml                      0.1.7                hc338f04_2
zeromq                    4.2.5                h0a44026_1
zict                      0.1.3                    py36_0
zlib                      1.2.11               h1de35cc_3
zstd                      1.3.3                h2a6be3a_0

is there a way to run this project without using CUDA?

I have installed docker image of decaNLP on my local and want to try custom dataset(Json dict file: context, questions, answers). I don't have Nvidia hardware to install CUDA. so using docker instead of Nvidia-docker (( docker run -it --rm -v pwd:/decaNLP/ decanlp bash -c "python /decaNLP/predict.py --evaluate valid --path /decaNLP/mqan_decanlp_qa_first --checkpoint_name model.pth --tasks my_custom_dataset" ))

Is there a possibility to try model.pth (pre-trained model) to predict on the custom dataset without CUDA dependency?

something wrong

when I run sst, [errno 2] no such file or directory: '/decaNLP/.data/sst/train_binary_sent.csv'
second when I run multinli.in.out [errno 2] no such file or directory'/decaNLP/.data/multinli/multinli_1.0/train.jsonl' third ,missing ‘/decaNLP/.data/multinli/multinli_1.0/train.jsonl’ at last, Can you tell me the download address code of these data sets? thank you

Issue with running commands with the docker image provided

Hi,

I'm trying to run validation on the pretrained model provided with this command:
nvidia-docker run -it --rm -v pwd:/decaNLP/ bmccann/decanlp:cuda9_torch041 -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_decanlp_qa_first_cpu --checkpoint_name iteration_1140000.pth --device 0"

After the docker image is downloaded and installed, it gives this error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"-c\": executable file not found in $PATH": unknown.

Trying to run the command above again produces this same error. May I know the solution for this?

Thank you!

What Chinese dataset are available for training decaNLP?

It's a little difficult to find Chinese dataset suitable for training decaNLP. Right now, all I have is: 1, douban movie review for sentiment analysis; 2, webqa from baidu. Is there any other data which can be used for training?

Memory requirements

Could you comment on how much CPU RAM does training this needs in the README?
For a single task I seem to get by easily, but for the full training, that 32GB RAM doesn't seem to cut the mustard. If you have any advice beyond "don't do that" and "buy more RAM", I think it would make a good inclusion in the documentation, too.

Thank you!

NaN loss and only OOV in the greedy output

The loss initially was decreasing until it reach nan's for a while. I am running it on the squad dataset and the exact argument used for running it is:

python train.py --train_tasks squad --device 0 --data ./.data --save ./results/ --embeddings ./.embeddings/ --train_batch_tokens 2000

So the only change is the train batch tokens to 2000 since my GPU was running out of memory. I am attaching a screenshot. Is there anything I am missing? Should I try something else?

screenshot 2018-11-02 14 35 47

Could not resolve host: developer.download.nvidia.com

mldl@mldlUB1604:~/ub16_prj/decaNLP/dockerfiles$ sudo docker build -t decanlp .
[sudo] password for mldl:
Sending build context to Docker daemon 3.584kB
Step 1/22 : FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
---> 222eeacc095c
Step 2/22 : RUN apt-get update && apt-get install -y --no-install-recommends git ssh build-essential locales ca-certificates curl unzip
---> Running in 6c3f7128c405
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
Could not resolve host: developer.download.nvidia.com
Err:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 InRelease
Could not resolve host: developer.download.nvidia.com

Training on custom dataset and answer is always "o"

I am trying to train on a custom WOZ dataset. I have 2 jsonl files, train.jsonl and val.jsonl as suggested.

A sample line from my dataset is {"context": "no, i just need to make sure it's cheap. oh, and i need parking", "question": "What is the change in state?", "answer": "name: not mentioned, area: not mentioned, parking: yes, pricerange: cheap, stars: not mentioned, internet: not mentioned, type: hotel;"}

This should be the correct format for the dataset training tuple. The problem is when I run the training process, when it tries to run validation after 1000 iterations (--val_every 1000), the output for the answer is always "o". As shown below:

greedy: 'food: chinese, pricerange: expensive, name: not mentioned, area: centre;'

answer: 'o'

context: 'how about the centre?'

question: 'what is the change in state?'

May I know what I'm doing wrongly? The wrong answer "o" is causing all the metrics like joint goal em, nf1 and nem to be zero.

Thank you.

Some observations

I would like to make a contribution to this nice project:

(1) You must not download the code as "zip" file. You have to do it by "git clone" (since ".git" folder is needed during training.)
(2) I did add something like "-v .../runtime:/runtime/" to "nvidia-docker run .." so that (4 GB of) test data is not downloaded again and again when one runs the container.
(3) The description for parameter "--gpus DEVICE_ID" seems a little vague. If you have a single GPU, set this to "--gpus 0".

Best wishes
BlackRedGold

connection error for /research.metamind.io/cove/wmtlstm-8f474287.pth

Docker fails to find /research.metamind.io/cove/wmtlstm-8f474287.pth and keeps returning Temporary failure in name resolution error. When I paste research.metamind.io in browser, it fails to resolve the IP. When I paste metamind.io, it goes to https://einstein.ai/. How do I sove this?

Other information:

I am inside /home/documents/some_other_folders/decalnlp directory. The declanlp folder was created by git clone.

Command yielding error:

 sudo docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:torch041 bash -c "python decaNLP/predict.py --evaluate validation --path decaNLP/mqan_decanlp_better_sampling_cove_cpu/ --checkpoint_name iteration_560000.pth --device -1 --silent"

Error:

Arguments:
{'best_checkpoint': 'decaNLP/mqan_decanlp_better_sampling_cove_cpu/iteration_560000.pth',
 'bleu': False,
 'checkpoint_name': 'iteration_560000.pth',
 'cove': True,
 'data': '/decaNLP/.data/',
 'devices': [-1],
 'dimension': 200,
 'dropout_ratio': 0.0,
 'elmo': [-1],
 'embeddings': '/decaNLP/.embeddings',
 'evaluate': 'validation',
 'glove_and_char': True,
 'intermediate_cove': False,
 'load': None,
 'lower': True,
 'max_generative_vocab': 50000,
 'max_output_length': 100,
 'max_val_context_length': 400,
 'model': 'MultitaskQuestionAnsweringNetwork',
 'overwrite': False,
 'path': 'decaNLP/mqan_decanlp_better_sampling_cove_cpu/',
 'rnn_layers': 1,
 'rouge': False,
 'seed': 123,
 'silent': True,
 'task_to_metric': {'cnn_dailymail': 'avg_rouge',
                    'iwslt.en.de': 'bleu',
                    'multinli.in.out': 'em',
                    'schema': 'em',
                    'squad': 'nf1',
                    'srl': 'nf1',
                    'sst': 'em',
                    'wikisql': 'lfem',
                    'woz.en': 'joint_goal_em',
                    'zre': 'corpus_f1'},
 'tasks': ['squad',
           'iwslt.en.de',
           'cnn_dailymail',
           'multinli.in.out',
           'sst',
           'srl',
           'zre',
           'woz.en',
           'wikisql',
           'schema'],
 'transformer_heads': 3,
 'transformer_hidden': 150,
 'transformer_layers': 2,
 'val_batch_size': [256, 256, 256, 256, 256, 256, 256, 256, 256, 256]}
Loading from decaNLP/mqan_decanlp_better_sampling_cove_cpu/iteration_560000.pth
Initializing Model
Downloading: "https://s3.amazonaws.com/research.metamind.io/cove/wmtlstm-8f474287.pth" to /decaNLP/.embeddings/wmtlstm-8f474287.pth
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connection.py", line 171, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/opt/conda/lib/python3.6/site-packages/urllib3/util/connection.py", line 56, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/opt/conda/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
    conn.connect()
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connection.py", line 314, in connect
    conn = self._new_conn()
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connection.py", line 180, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f0396c401d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/opt/conda/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/opt/conda/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='s3.amazonaws.com', port=443): Max retries exceeded with url: /research.metamind.io/cove/wmtlstm-8f474287.pth (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f0396c401d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "decaNLP/predict.py", line 297, in <module>
    model = Model(field, args)
  File "/decaNLP/models/multitask_question_answering_network.py", line 33, in __init__
    self.cove = MTLSTM(model_cache=args.embeddings, layer0=args.intermediate_cove, layer1=args.cove)
  File "/src/cove/cove/encoder.py", line 45, in __init__
    state_dict = model_zoo.load_url(model_urls['wmt-lstm'], model_dir=model_cache)
  File "/opt/conda/lib/python3.6/site-packages/torch/utils/model_zoo.py", line 65, in load_url
    _download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/opt/conda/lib/python3.6/site-packages/torch/utils/model_zoo.py", line 71, in _download_url_to_file
    u = urlopen(url, stream=True)
  File "/opt/conda/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/conda/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/requests/adapters.py", line 513, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='s3.amazonaws.com', port=443): Max retries exceeded with url: /research.metamind.io/cove/wmtlstm-8f474287.pth (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f0396c401d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

System details:

>> lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

>> uname -r
4.15.0-43-generic

Training on Custom Dataset

I have a dataset in the format of context, question, and answer. Besides being able to run Inference on a Custom Dataset, is it possible to train a new model on our own dataset as well?

Thank you.

test

I want to make an example to test this model, what should I do?

Permission Error when training

I've followed instructions in README, up to the point of training a model on the decathlon.

Traceback (most recent call last):
  File "/decaNLP/train.py", line 340, in <module>
    args = arguments.parse()
  File "/decaNLP/arguments.py", line 112, in parse
    save_args(args)
  File "/decaNLP/arguments.py", line 18, in save_args
    os.makedirs(args.log_dir, exist_ok=args.exist_ok)
  File "/opt/conda/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/opt/conda/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/opt/conda/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  [Previous line repeated 4 more times]
  File "/opt/conda/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/runtime'

Apparently at some point the code tries to create some directories under /runtime without having the right permissions. I tried running the whole command with sudo, tinkering with setting os.umask() in the save_args code, but I'm not familiar with permissions and docker-nvidia.

Any pointers as to how to avoid permissions issues while running this code?

Question about the paper: Why is answer representation needed for training?

Hi, I am confused about the input of training and testing.

It's reasonable for me that the output distribution is the answers prediction, and we train it with minimizing the negative log loss between output distribution and the ground truth answer. But what I'm confused is that the answer is fed into the model for computing answer representation mentioned in the paper. Why is this? Aren't the answers unknown in testing phase?

By the way, there's a typo in your paper. In equation (10), the ℝ^n for p_c should be ℝ^l. Right?

Thanks.

Loading datasets

While running this command as suggested in the repo:
nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) decanlp bash -c "python /decaNLP/train.py --train_tasks squad iwslt.en.de cnn_dailymail multinli.in.out sst srl zre woz.en wikisql schema --train_iterations 1 --gpu 1"
It can download and process all the following datasets: squad iwslt.en.de cnn_dailymail multinli.in.out sst srl zre.
Once it arrives to woz.en I have the following error:

process_main - zre has 840000 training examples
process_main - Loading woz.en
process_main - Adding woz.en to training datasets
downloading woz_train_en.json
downloading woz_test_de.json
downloading woz_test_en.json
downloading woz_train_de.json
downloading woz_validate_de.json
downloading woz_validate_en.json
Traceback (most recent call last):
File "/decaNLP/train.py", line 365, in
main()
File "/decaNLP/train.py", line 352, in main
field, train_sets, val_sets = prepare_data(args, field, logger)
File "/decaNLP/train.py", line 67, in prepare_data
split = get_splits(args, task, FIELD, **kwargs)[0]
File "/decaNLP/util.py", line 138, in get_splits
fields=FIELD, root=args.data, **kwargs)
File "/decaNLP/text/torchtext/datasets/generic.py", line 976, in splits
os.path.join(path, f'{train}.jsonl'), fields, **kwargs)
File "/decaNLP/text/torchtext/datasets/generic.py", line 897, in init
ex = data.Example.fromlist([context, question, answer, CONTEXT_SPECIAL, QUESTION_SPECIAL, context_question, woz_id], fields)
File "/decaNLP/text/torchtext/data/example.py", line 62, in fromlist
setattr(ex, name, [sys.intern(x) for x in field.preprocess(val)])
TypeError: 'int' object is not iterable

Thanks in advance

Andrea

Error during training

By any chance do you have any idea why I received following error during training?
I'm running the docker file on some RTX 2080 ti and the last version of CUDA.

Thank you.

process_0 - Initializing MultitaskQuestionAnsweringNetwork
process_0 - MultitaskQuestionAnsweringNetwork has 14,469,902 trainable parameters
Traceback (most recent call last):
File "/decaNLP/train.py", line 374, in
main()
File "/decaNLP/train.py", line 370, in main
run(args, run_args, world_size=args.world_size)
File "/decaNLP/train.py", line 299, in run
model = init_model(args, field, logger, world_size, device)
File "/decaNLP/train.py", line 327, in init_model
model.to(device)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 379, in to
return self._apply(convert)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 185, in _apply
module._apply(fn)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 185, in _apply
module._apply(fn)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/rnn.py", line 112, in _apply
self.flatten_parameters()
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/rnn.py", line 105, in flatten_parameters
self.batch_first, bool(self.bidirectional))
RuntimeError: CuDNN error: CUDNN_STATUS_SUCCESS

Recent work?

Is there recent work on this (the lead board hasn't changed since 2018)?

Error while validating models.

Hi,

Whenever I try to validate my models or the pretrained models provided, I run into this error:

Example: nvidia-docker run -it --rm -v pwd:/decaNLP/ decanlp bash -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_decanlp_qa_first --checkpoint_name model.pth --gpu 0"

.
.
.
Loading from /decaNLP/mqan_decanlp_qa_first/model.pth
Initializing Model
Traceback (most recent call last):
File "/decaNLP/predict.py", line 262, in
model = Model(field, args)
File "/decaNLP/models/multitask_question_answering_network.py", line 32, in init
if self.args.cove or self.args.intermediate_cove:
AttributeError: 'Namespace' object has no attribute 'intermediate_cove'

Is there a way to resolve this? Training the decaNLP Model runs win but validation throws this error.

Thank you!

Fine-tuning pretrained model

I'm trying to fine-tune the pretrained model provided with my custom dataset. The command is nvidia-docker run -it --rm -v pwd:/decaNLP/ -u $(id -u):$(id -g) bmccann/decanlp:cuda9_torch041 bash -c "python /decaNLP/train.py --load /decaNLP/mqan_decanlp_better_sampling_cove_cpu/iteration_560000.pth --resume --train_tasks mwo

While trying to initialise the MQAN model, it throws up this error:
RuntimeError: Error(s) in loading state_dict for MultitaskQuestionAnsweringNetwork: Missing key(s) in state_dict: "encoder_embeddings.projection.linear.weight", "encoder_embeddings.projection.linear.bias". Unexpected key(s) in state_dict: "cove.rnn1.weight_ih_l0", "cove.rnn1.weight_hh_l0", "cove.rnn1.bias_ih_l0", "cove.rnn1.bias_hh_l0", "cove.rnn1.weight_ih_l0_reverse", "cove.rnn1.weight_hh_l0_reverse", "cove.rnn1.bias_ih_l0_reverse", "cove.rnn1.bias_hh_l0_reverse", "cove.rnn1.weight_ih_l1", "cove.rnn1.weight_hh_l1", "cove.rnn1.bias_ih_l1", "cove.rnn1.bias_hh_l1", "cove.rnn1.weight_ih_l1_reverse", "cove.rnn1.weight_hh_l1_reverse", "cove.rnn1.bias_ih_l1_reverse", "cove.rnn1.bias_hh_l1_reverse", "project_cove.linear.weight", "project_cove.linear.bias".

Kindly advise how to go about fine-tuning the model. Thank you.

Exception while processing wikisql dataset

$ nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) decanlp bash -c "python /decaNLP/train.py --train_tasks wikisql --gpu 0"

process_main - Adding wikisql to training datasets
Traceback (most recent call last):
  File "/decaNLP/train.py", line 366, in <module>
    main()
  File "/decaNLP/train.py", line 353, in main
    field, train_sets, val_sets = prepare_data(args, field, logger)
  File "/decaNLP/train.py", line 67, in prepare_data
    split = get_splits(args, task, FIELD, **kwargs)[0]
  File "/decaNLP/util.py", line 129, in get_splits
    fields=FIELD, root=args.data, **kwargs)
  File "/decaNLP/text/torchtext/datasets/generic.py", line 568, in splits
    os.path.join(path, train), fields, **kwargs)
  File "/decaNLP/text/torchtext/datasets/generic.py", line 540, in __init__
    ex = data.Example.fromlist([context, question, answer, CONTEXT_SPECIAL, QUESTION_SPECIAL, context_question, idx], fields)
  File "/decaNLP/text/torchtext/data/example.py", line 62, in fromlist
    setattr(ex, name, [sys.intern(x) for x in field.preprocess(val)])
TypeError: 'int' object is not iterable

Multi GPU

Sorry when is it planned to have multi-GPU? On my 1080 it takes apprx. 20min per epoch and it's almost impossible to train it for real use in current tasks =( I have two more GPU's that might help.. may be I can somehow help to enforce the implementation?

the model suddenly predict many useless word during training, and scores dropped down to 0

i use Chinese dataset, the log is as follow, what is wrong:

greedy: 'similar'
answer: 'similar'
context: 'premise: "花 呗 商 家 扣 费 么"'
question: 'hypothesis: "怎 么 成 为 花 呗 商 家" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "信 用 卡 可 以 办 吗"'
question: 'hypothesis: "我 的 借 呗 可 以 用 银 行 卡 还 钱 吗" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'dissimilar'
context: 'premise: "花 呗 , 怎 么 退 款"'
question: 'hypothesis: "蚂 蚁 花 呗 怎 么 退 款" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "能 从 新 开 花 呗 吗"'
question: 'hypothesis: "补 全 身 份 信 息 就 能 开 通 花 呗 吗" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'similar'
context: 'premise: "花 呗 怎 么 查 明 细"'
question: 'hypothesis: "怎 样 查 花 呗 上 买 的 快 递" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'dissimilar'
context: 'premise: "蚂 蚁 借 呗 钱 少 了"'
question: 'hypothesis: "我 能 问 下 我 还 借 呗 的 钱 怎 么 少 了" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "商 户 花 呗 收 款 码"'
question: 'hypothesis: "收 钱 码 花 呗 信 用 卡 额 度" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "花 呗 是 不 是 没 还"'
question: 'hypothesis: "我 的 花 呗 , 没 有 还 款 , 但 是 为 啥 没 有 还 款 的 页 面" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "信 用 守 护 有 借 呗"'
question: 'hypothesis: "芝 麻 信 用 的 信 用 守 护 出 现 了 借 呗 为 什 么 不 可 以 用" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'similar'
context: 'premise: "花 呗 多 久 可 以 用"'
question: 'hypothesis: "什 么 时 候 花 呗 可 以 使 用" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'similar'
context: 'premise: "花 呗 开 开 通 不 了"'
question: 'hypothesis: "怎 么 我 不 能 开 通 花 呗 收 款" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "借 呗 关 闭 的 理 由"'
question: 'hypothesis: "我 的 借 呗 总 额" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "双 十 一 借 呗 免 息"'
question: 'hypothesis: "借 呗 免 息 * * * 天" -- similar, or dissimilar?'

greedy: 'similar'
answer: 'similar'
context: 'premise: "什 么 还 花 呗 还 款"'
question: 'hypothesis: "花 呗 , 是 干 什 么 的" -- similar, or dissimilar?'

greedy: 'dissimilar'
answer: 'dissimilar'
context: 'premise: "花 呗 标 示 的 商 品"'
question: 'hypothesis: "花 呗 识 别 的 商 品" -- similar, or dissimilar?'

process_0 - 18/09/11/17/16/46.736412:00:00:49:38:iteration_9000:train_ali:val_ali:em_68.73:nf1_68.73:nem_68.73
process_0 - 18/09/11/17/16/46.736412:00:00:49:38:iteration_9000:train_ali:avbatch_322_25_3:loss_0.2458
process_0 - 18/09/11/17/16/46.736412:00:00:50:11:iteration_9100:train_ali:avbatch_317_26_3:loss_0.2419
process_0 - 18/09/11/17/16/46.736412:00:00:50:45:iteration_9200:train_ali:avbatch_325_25_3:loss_0.2464
process_0 - 18/09/11/17/16/46.736412:00:00:51:18:iteration_9300:train_ali:avbatch_315_26_3:loss_0.2404
process_0 - 18/09/11/17/16/46.736412:00:00:51:52:iteration_9400:train_ali:avbatch_325_25_3:loss_0.2435
process_0 - 18/09/11/17/16/46.736412:00:00:52:25:iteration_9500:train_ali:avbatch_315_26_3:loss_0.2386
process_0 - 18/09/11/17/16/46.736412:00:00:52:59:iteration_9600:train_ali:avbatch_320_25_3:loss_0.2396
process_0 - 18/09/11/17/16/46.736412:00:00:53:31:iteration_9700:train_ali:avbatch_321_25_3:loss_0.2450
process_0 - 18/09/11/17/16/46.736412:00:00:54:02:iteration_9800:train_ali:avbatch_321_25_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:54:31:iteration_9900:train_ali:avbatch_321_25_3:loss_nan

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "花 呗 商 家 扣 费 么"'
question: 'hypothesis: "怎 么 成 为 花 呗 商 家" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "信 用 卡 可 以 办 吗"'
question: 'hypothesis: "我 的 借 呗 可 以 用 银 行 卡 还 钱 吗" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'dissimilar'
context: 'premise: "花 呗 , 怎 么 退 款"'
question: 'hypothesis: "蚂 蚁 花 呗 怎 么 退 款" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "能 从 新 开 花 呗 吗"'
question: 'hypothesis: "补 全 身 份 信 息 就 能 开 通 花 呗 吗" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "花 呗 怎 么 查 明 细"'
question: 'hypothesis: "怎 样 查 花 呗 上 买 的 快 递" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'dissimilar'
context: 'premise: "蚂 蚁 借 呗 钱 少 了"'
question: 'hypothesis: "我 能 问 下 我 还 借 呗 的 钱 怎 么 少 了" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "商 户 花 呗 收 款 码"'
question: 'hypothesis: "收 钱 码 花 呗 信 用 卡 额 度" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "花 呗 是 不 是 没 还"'
question: 'hypothesis: "我 的 花 呗 , 没 有 还 款 , 但 是 为 啥 没 有 还 款 的 页 面" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "信 用 守 护 有 借 呗"'
question: 'hypothesis: "芝 麻 信 用 的 信 用 守 护 出 现 了 借 呗 为 什 么 不 可 以 用" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "花 呗 多 久 可 以 用"'
question: 'hypothesis: "什 么 时 候 花 呗 可 以 使 用" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "花 呗 开 开 通 不 了"'
question: 'hypothesis: "怎 么 我 不 能 开 通 花 呗 收 款" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "借 呗 关 闭 的 理 由"'
question: 'hypothesis: "我 的 借 呗 总 额" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "双 十 一 借 呗 免 息"'
question: 'hypothesis: "借 呗 免 息 * * * 天" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'similar'
context: 'premise: "什 么 还 花 呗 还 款"'
question: 'hypothesis: "花 呗 , 是 干 什 么 的" -- similar, or dissimilar?'

greedy: '鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁 鲁'
answer: 'dissimilar'
context: 'premise: "花 呗 标 示 的 商 品"'
question: 'hypothesis: "花 呗 识 别 的 商 品" -- similar, or dissimilar?'

process_0 - 18/09/11/17/16/46.736412:00:00:55:21:iteration_10000:train_ali:val_ali:em_0.00:nf1_0.00:nem_0.00
process_0 - 18/09/11/17/16/46.736412:00:00:55:21:iteration_10000:train_ali:avbatch_321_26_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:55:50:iteration_10100:train_ali:avbatch_321_25_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:56:21:iteration_10200:train_ali:avbatch_314_26_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:56:53:iteration_10300:train_ali:avbatch_326_25_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:57:24:iteration_10400:train_ali:avbatch_311_27_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:57:58:iteration_10500:train_ali:avbatch_323_25_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:58:31:iteration_10600:train_ali:avbatch_316_26_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:59:04:iteration_10700:train_ali:avbatch_315_26_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:00:59:35:iteration_10800:train_ali:avbatch_323_25_3:loss_nan
process_0 - 18/09/11/17/16/46.736412:00:01:00:05:iteration_10900:train_ali:avbatch_327_25_3:loss_nan

schema.txt

Hi,

congrats on the awesome results!

If you allow me to ask

mv local_data/schema.txt .data/schema/

should I expect to find schema.txt in local_data?

Best regards

Thomas

What is the format for the input of text summarization?

I am running the pretrained model of decaNLP and in the mentioned inference file you are passing three things namely "Context, Question and real Answer". What should be the input in the inference file if I want to use the text summarization task of cnn dailymail?

How to install pytorch and tensorflow

I have installed pytorch and tensorflow in python
However,when I run the comman 'docker build -t decanlp . && cd -', it would install the pytorch and tensorflow. Because of the network speed, it would be interuppted.
I don't know why I have installed the pytorch and tensorflow but it still needs to download and install it.

Thank you for your answer.

UnboundLocalError: local variable 'wikisql_ids' referenced before assignment

An UnboundLocalError occurred when executing the following command.
nvidia-docker run -it --rm -v pwd:/decaNLP/ decanlp bash -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_wikisql --checkpoint_name model.pth --gpu 0 --tasks wikisql"

Arguments:
{'best_checkpoint': '/decaNLP/mqan_wikisql/model.pth',
'bleu': False,
'checkpoint_name': 'model.pth',
'cove': None,
'data': '/decaNLP/.data/',
'dimension': 200,
'dropout_ratio': 0.0,
'embeddings': '/decaNLP/.embeddings',
'evaluate': 'validation',
'gpus': 0,
'intermediate_cove': None,
'load': None,
'lower': True,
'max_generative_vocab': 50000,
'max_output_length': 100,
'max_val_context_length': 400,
'model': 'MultitaskQuestionAnsweringNetwork',
'overwrite_predictions': False,
'path': '/decaNLP/mqan_wikisql',
'rnn_layers': 1,
'rouge': False,
'seed': 123,
'silent': False,
'task_to_metric': {'cnn_dailymail': 'avg_rouge',
'iwslt.en.de': 'bleu',
'multinli.in.out': 'em',
'schema': 'em',
'squad': 'nf1',
'srl': 'nf1',
'sst': 'em',
'wikisql': 'lfem',
'woz.en': 'joint_goal_em',
'zre': 'corpus_f1'},
'tasks': ['wikisql'],
'transformer_heads': 3,
'transformer_hidden': 150,
'transformer_layers': 2,
'val_batch_size': [256]}
Loading from /decaNLP/mqan_wikisql/model.pth
Initializing Model
Loading wikisql
Loading cached data from /decaNLP/.data/wikisql/data/.cache/query_as_context/dev.jsonl/None
Vocabulary has 33414 tokens from training
Vocabulary has expanded to 33414 tokens
100% 2196017/2196017 [03:05<00:00, 11823.34it/s]
Loading wikisql
Loading cached data from /decaNLP/.data/wikisql/data/.cache/query_as_context/dev.jsonl/None
device: 0
Preparing iterators
MultitaskQuestionAnsweringNetwork has 11,136,116 parameters
** /decaNLP/mqan_wikisql/model/validation/wikisql.txt already exists -- this is where predictions are stored **
** /decaNLP/mqan_wikisql/model/validation/wikisql.gold.txt already exists -- this is where ground truth answers are stored **
** /decaNLP/mqan_wikisql/model/validation/wikisql.results.txt already exists -- this is where metrics are stored **
{"lfem":76.0954755967,"em":73.4829592685,"nf1":97.4454620976,"nem":74.2192138701}

Traceback (most recent call last):
File "/decaNLP/predict.py", line 267, in
run(args, field, splits, model)
File "/decaNLP/predict.py", line 123, in run
for i in wikisql_ids:
UnboundLocalError: local variable 'wikisql_ids' referenced before assignment
test@ubuntu:~/decaNLP$

Unable to load cnn_dailymail

I ran the following command just to train on cnn_dailymail:
nvidia-docker run -it --rm -v `pwd`:/decaNLP/ -u $(id -u):$(id -g) decanlp bash -c "python /decaNLP/train.py --train_tasks cnn_dailymail --train_iterations 1 --gpu 0"

and I got the following error message:

process_main - Loading cnn_dailymail
process_main - Adding cnn_dailymail to training datasets
Traceback (most recent call last):
  File "/decaNLP/train.py", line 365, in <module>
    main()
  File "/decaNLP/train.py", line 352, in main
    field, train_sets, val_sets = prepare_data(args, field, logger)
  File "/decaNLP/train.py", line 67, in prepare_data
    split = get_splits(args, task, FIELD, **kwargs)[0]
  File "/decaNLP/util.py", line 161, in get_splits
    fields=FIELD, root=args.data, **kwargs)
  File "/decaNLP/text/torchtext/datasets/generic.py", line 426, in splits
    os.path.join(path, 'training.jsonl'), fields, **kwargs)
  File "/decaNLP/text/torchtext/datasets/generic.py", line 353, in __init__
    examples = torch.load(cache_name)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 267, in load
    return _load(f, map_location, pickle_module)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 420, in _load
    result = unpickler.load()
EOFError: Ran out of input

I tried running cnn only without any issue. However, when I train for dailymail only, I ran out of RAM (I have 32GB). So the 2 questions I have are:

  1. How much RAM do we need to load dailymail alone?
  2. How to load the cnn_dailymail data without EOFError?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.