facebookresearch / pytext

A natural language modeling framework based on PyTorch
https://pytext.readthedocs.io/en/master/
Other
6.34k stars 800 forks source link

When running pytest, text_model_exporter_test.py aborts #1231

Open ButteredGroove opened 4 years ago

ButteredGroove commented 4 years ago

Steps to reproduce

System: Python 3.6.7, CentOS Linux release 7.6.1810

  1. Install as per https://pytext.readthedocs.io/en/master/installation.html
    export LANG=en_US.utf8
    export LC_ALL=en_US.utf8
    git clone git@github.com:facebookresearch/pytext.git
    cd pytext
    source activation_venv
    pip install pip --upgrade
    pip install torch
    ./install_deps
  2. Install pytest
    pip install pytest
  3. Run pytest
    pytest

Observed Results

$ pytest
================================================= test session starts ==================================================
platform linux -- Python 3.6.7, pytest-5.3.2, py-1.8.1, pluggy-0.13.1
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/user/pytext/pytext/.hypothesis/examples')
rootdir: /home/user/pytext/pytext, inifile: pytest.ini
plugins: hypothesis-3.88.3
collected 226 items

pytext/config/test/component_test.py .....                                                                       [  2%]
pytext/config/test/config_adapter_test.py ...                                                                    [  3%]
pytext/config/test/pytext_config_test.py ..................                                                      [ 11%]
pytext/config/test/serialize_test.py ..                                                                          [ 12%]
pytext/data/data_structures/tests/annotation_test.py ..                                                          [ 13%]
pytext/data/test/batch_sampler_test.py ....                                                                      [ 15%]
pytext/data/test/data_test.py ..........                                                                         [ 19%]
pytext/data/test/dynamic_pooling_batcher_test.py ....                                                            [ 21%]
pytext/data/test/pandas_data_source_test.py ..                                                                   [ 22%]
pytext/data/test/round_robin_batchiterator_test.py .                                                             [ 22%]
pytext/data/test/simple_featurizer_test.py .....                                                                 [ 24%]
pytext/data/test/tensorizers_test.py .............................                                               [ 37%]
pytext/data/test/tokenizers_test.py .....                                                                        [ 39%]
pytext/data/test/tsv_data_source_test.py ............                                                            [ 45%]
pytext/data/test/utils_test.py ....                                                                              [ 46%]
pytext/exporters/test/new_text_model_exporter_test.py .                                                          [ 47%]
pytext/exporters/test/text_model_exporter_test.py Fatal Python error: Aborted

Current thread 0x00002aaaaaaebf80 (most recent call first):
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 202 in forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 525 in _slow_forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539 in __call__
  File "/home/user/pytext/pytext/pytext/models/representations/docnn.py", line 42 in conv_and_pool
  File "/home/user/pytext/pytext/pytext/models/representations/docnn.py", line 37 in <listcomp>
  File "/home/user/pytext/pytext/pytext/models/representations/docnn.py", line 37 in forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 525 in _slow_forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539 in __call__
  File "/home/user/pytext/pytext/pytext/models/representations/contextual_intent_slot_rep.py", line 71 in forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 525 in _slow_forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539 in __call__
  File "/home/user/pytext/pytext/pytext/models/model.py", line 399 in forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 525 in _slow_forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/jit/__init__.py", line 352 in forward
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/jit/__init__.py", line 275 in get_trace_graph
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/onnx/utils.py", line 206 in _trace_and_get_graph_from_model
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/onnx/utils.py", line 249 in _model_to_graph
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/onnx/utils.py", line 382 in _export
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/torch/onnx/__init__.py", line 26 in _export
  File "/home/user/pytext/pytext/pytext/utils/onnx.py", line 51 in pytorch_to_caffe2
  File "/home/user/pytext/pytext/pytext/exporters/exporter.py", line 185 in export_to_caffe2
  File "/home/user/pytext/pytext/pytext/exporters/test/text_model_exporter_test.py", line 701 in test_contextual_intent_slot_export_to_caffe2
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 516 in test
  File "/home/user/pytext/pytext/pytext/exporters/test/text_model_exporter_test.py", line 670 in test_contextual_intent_slot_export_to_caffe2
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 571 in run
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/executors.py", line 56 in default_new_style_executor
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 573 in execute
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 604 in evaluate_test_data
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 133 in test_function
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 847 in cached_test_function
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 622 in generate_new_examples
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 752 in _run
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py", line 422 in run
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 658 in run
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/hypothesis/core.py", line 1018 in wrapped_test
  File "/home/user/pytext/pytext/pytext/exporters/test/text_model_exporter_test.py", line 670 in test_contextual_intent_slot_export_to_caffe2
  File "/cm/local/apps/python3/lib/python3.6/unittest/case.py", line 605 in run
  File "/cm/local/apps/python3/lib/python3.6/unittest/case.py", line 653 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/unittest.py", line 207 in runtest
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 131 in pytest_runtest_call
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 207 in <lambda>
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 234 in from_call
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 207 in call_runtest_hook
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 182 in call_and_report
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 96 in runtestprotocol
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/runner.py", line 81 in pytest_runtest_protocol
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/main.py", line 270 in pytest_runtestloop
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/main.py", line 246 in _main
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/main.py", line 196 in wrap_session
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/main.py", line 239 in pytest_cmdline_main
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 87 in <lambda>
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/user/pytext/pytext/pytext_venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 92 in main
  File "/home/user/pytext/pytext/pytext_venv/bin/pytest", line 8 in <module>
Aborted

Expected Results

Successful test

ButteredGroove commented 4 years ago

If I install the nightly version of PyTorch (currently 1.5) the pytest tests complete without aborting, but with errors. PyTorch Linux-GPU install: pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html

pytest run: pytext_pytest.txt