Skip to content

Commit

Permalink
Support PyTorch 1.3 (#249)
Browse files Browse the repository at this point in the history
* Support PyTorch 1.3

* Add codecov yaml file

* Refactor data module

* Fix mypy error

* Update comments in .travis.yml
  • Loading branch information
gpengzhi authored Nov 21, 2019
1 parent c2d3c73 commit 53d8ead
Show file tree
Hide file tree
Showing 11 changed files with 641 additions and 386 deletions.
27 changes: 27 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

status:
project:
default:
threshold: 1%
patch: yes
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
- TORCH_VER="1.0.1"
- TORCH_VER="1.1.0"
- TORCH_VER="1.2.0"
- TORCH_VER="1.3.0"

matrix:
fast_finish: true
Expand All @@ -19,12 +20,14 @@ matrix:
env: TORCH_VER="1.0.1"
- python: "3.6"
env: TORCH_VER="1.2.0"
- python: "3.6"
env: TORCH_VER="1.3.0"

install:
- pip install --upgrade pip
- pip install --progress-bar off torch==$TORCH_VER
- pip install --progress-bar off .[extras]
- if [[ $TORCH_VER == "1.2.0" ]]; then
- if [[ $TORCH_VER == "1.3.0" ]]; then
pip install pylint==2.3.1 flake8==3.7.7;
fi
- if [[ $TORCH_VER != "1.0.1" ]]; then
Expand All @@ -34,14 +37,14 @@ install:
- pip install coverage codecov

script:
# Linting (only for PyTorch version 1.2.0 to save time)
- if [[ $TORCH_VER == "1.2.0" ]]; then
# Linting (only for PyTorch version 1.3.0 to save time)
- if [[ $TORCH_VER == "1.3.0" ]]; then
pylint texar/ examples/;
fi
- if [[ $TORCH_VER == "1.2.0" ]]; then
- if [[ $TORCH_VER == "1.3.0" ]]; then
flake8 texar/ examples/;
fi
# Type-checking (only for PyTorch version 1.1.0 & 1.2.0)
# Type-checking (only for PyTorch version 1.1.0 & 1.2.0 & 1.3.0)
- if [[ $TORCH_VER != "1.0.1" ]]; then
mypy .;
fi
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Many more examples are available [here](./examples).
Texar-PyTorch requires:

* `python == 3.6` or `3.7`
* `torch >= 1.0.0 (but < 1.3.0)`. Please follow the [official instructions](https://pytorch.org/get-started/locally/#start-locally) to install the appropriate version.
* `torch >= 1.0.0`. Please follow the [official instructions](https://pytorch.org/get-started/locally/#start-locally) to install the appropriate version.

After `torch` is installed, install Texar from PyPI:
```bash
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torch >= 1.0.0, < 1.3.0
torch >= 1.0.0
funcsigs >= 1.0.2
numpy >= 1.15.4
mypy_extensions >= 0.4.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'packaging>=19.0'
],
extras_require={
'torch': ['torch>=1.0.0,<1.3.0'],
'torch': ['torch>=1.0.0'],
'examples': [],
'extras': ['Pillow>=3.0', 'tensorboardX>=1.8'],
},
Expand Down
1 change: 1 addition & 0 deletions texar/torch/data/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
from texar.torch.data.data.multi_aligned_data import *
from texar.torch.data.data.paired_text_data import *
from texar.torch.data.data.record_data import *
from texar.torch.data.data.sampler import *
from texar.torch.data.data.scalar_data import *
from texar.torch.data.data.text_data_base import *
Loading

0 comments on commit 53d8ead

Please sign in to comment.