Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install warp-ctc from PyPI #1196

Merged
merged 1 commit into from Sep 23, 2019
Merged

Conversation

@ysk24ok
Copy link
Contributor

ysk24ok commented Sep 14, 2019

Overview

This pull request enables installing warp-ctc from PyPI when PyTorch version is 1.0.
Currently following wheels are served at pypi.org in both Python 3.6 and 3.7.

Test

First, save this script as ctc_example.py.

import torch
from warpctc_pytorch import CTCLoss
ctc_loss = CTCLoss()
# expected shape of seqLength x batchSize x alphabet_size
probs = torch.FloatTensor([[[0.1, 0.6, 0.1, 0.1, 0.1], [0.1, 0.1, 0.6, 0.1, 0.1]]]).transpose(0, 1).contiguous()
labels = torch.IntTensor([1, 2])
label_sizes = torch.IntTensor([2])
probs_sizes = torch.IntTensor([2])
probs.requires_grad_(True)  # tells autograd to compute gradients for probs
cost = ctc_loss(probs, labels, probs_sizes, label_sizes)
cost.backward()

After each case below is done, run check_install.py and ctc_example.py

# confirm installation and version check pass
$ python check_install.py
# confirm no error occurs
$ python ctc_example.py
  1. When PyTorch is 1.0 and CUPY_VERSION is specified
$ pip install torch==1.0.1
# Install warpctc-pytorch10-cudaXXX
$ make warp-ctc.done
  1. When PyTorch is 1.0 and CUPY_VERSION is not specified
$ pip install torch==1.0.1
# Install warpctc-pytorch10-cpu
$ make CUPY_VERSION="" warp-ctc.done
  1. When PyTorch is 0.4
$ pip install torch==0.4.1
# Install warp-ctc from source
$ make warp-ctc.done
@codecov

This comment has been minimized.

Copy link

codecov bot commented Sep 14, 2019

Codecov Report

Merging #1196 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1196   +/-   ##
=======================================
  Coverage   78.16%   78.16%           
=======================================
  Files         101      101           
  Lines        9306     9306           
=======================================
  Hits         7274     7274           
  Misses       2032     2032

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c961b3...8047741. Read the comment docs.

elif . venv/bin/activate && python -c 'import torch as t;assert t.__version__[0] == "0"' &> /dev/null; then \
cd warp-ctc; git checkout -b pytorch-0.4.0 remotes/origin/pytorch-0.4; \
if . venv/bin/activate && python -c 'import torch as t;major=t.__version__.split(".")[0];assert major == "1"' &> /dev/null; then \
if [ ! -z "$(strip $(CUPY_VERSION))" ]; then \

This comment has been minimized.

Copy link
@sw005320

sw005320 Sep 14, 2019

Contributor
Suggested change
if [ ! -z "$(strip $(CUPY_VERSION))" ]; then \
if [ ! -z "$(strip $(CUDA_VERSION))" ]; then \

???

This comment has been minimized.

Copy link
@ysk24ok

ysk24ok Sep 14, 2019

Author Contributor

https://github.com/espnet/espnet/blob/master/README.md#step-2-c-installation-for-cpu-only
This section says CUPY version should be cleared in CPU-only environment.

@sw005320

This comment has been minimized.

Copy link
Contributor

sw005320 commented Sep 23, 2019

Thanks a lot!
(Sorry for our late action...)

@sw005320 sw005320 merged commit e0b9b58 into espnet:master Sep 23, 2019
7 checks passed
7 checks passed
ci/circleci: test-centos7 Your tests passed on CircleCI!
Details
ci/circleci: test-debian9 Your tests passed on CircleCI!
Details
ci/circleci: test-ubuntu16 Your tests passed on CircleCI!
Details
ci/circleci: test-ubuntu18 Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected when comparing 2c961b3...8047741
Details
codecov/project 78.16% remains the same compared to 2c961b3
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.