Skip to content

Commit

Permalink
Enable Travis, Coveralls, and prettify README
Browse files Browse the repository at this point in the history
* Add .travis.yml file
* Put Travis badge on README
* Enable coveralls
* Put coveralls badge on README
* Prettify README
  • Loading branch information
kmkurn committed Dec 30, 2017
1 parent 559221d commit 183d2ea
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
@@ -0,0 +1,13 @@
language: python
before_install:
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
- bash ~/miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda create -y -n pytorch-crf python=3.6
- source activate pytorch-crf
- conda install -y -c pytorch pytorch=0.3.0
install:
- pip install -r requirements.txt
- pip install .
script: pytest --cov
after_success: coveralls
22 changes: 16 additions & 6 deletions README.rst
@@ -1,6 +1,12 @@
pytorch-crf
+++++++++++

.. image:: https://travis-ci.org/kmkurn/pytorch-crf.svg?branch=master
:target: https://travis-ci.org/kmkurn/pytorch-crf

.. image:: https://coveralls.io/repos/github/kmkurn/pytorch-crf/badge.svg?branch=enable-travis
:target: https://coveralls.io/github/kmkurn/pytorch-crf?branch=enable-travis

Conditional random field in `PyTorch <http://pytorch.org/>`_.

Description
Expand Down Expand Up @@ -30,7 +36,9 @@ Or, you can install from Github directly ::
Examples
========

In the examples below, we will assume that these lines have been executed ::
In the examples below, we will assume that these lines have been executed

.. code-block:: python
>>> import torch
>>> from torchcrf import CRF
Expand All @@ -42,7 +50,7 @@ In the examples below, we will assume that these lines have been executed ::
Forward computation
-------------------

::
.. code-block:: python
>>> model(emissions, tags)
Variable containing:
Expand All @@ -52,7 +60,7 @@ Forward computation
Forward computation with mask
-----------------------------

::
.. code-block:: python
>>> mask = torch.autograd.Variable(torch.ByteTensor([[1, 1], [1, 1], [1, 0]])) # (seq_length, batch_size)
>>> model(emissions, tags, mask=mask)
Expand All @@ -63,15 +71,15 @@ Forward computation with mask
Decoding
--------

::
.. code-block:: python
>>> model.decode(emissions)
[[3, 1, 3], [0, 1, 0]]
Decoding with mask
------------------

::
.. code-block:: python
>>> model.decode(emissions, mask=mask)
[[3, 1, 3], [0, 1, 0]]
Expand All @@ -81,7 +89,7 @@ See ``tests/test_crf.py`` for more examples.
License
=======

MIT. See ``LICENSE.txt`` for details.
MIT. See `LICENSE`_ for details.

Contributing
============
Expand All @@ -105,3 +113,5 @@ Running linter
--------------

Run ``flake8`` in the project root directory. This will also run ``mypy``, thanks to ``flake8-mypy`` package.

.. _`LICENSE`: https://github.com/kmkurn/pytorch-crf/blob/enable-travis/LICENSE.txt
8 changes: 8 additions & 0 deletions requirements.txt
@@ -1,8 +1,11 @@
attrs==17.3.0
certifi==2017.11.5
cffi==1.10.0
chardet==3.0.4
coverage==4.0.3
flake8==3.5.0
flake8-mypy==17.8.0
idna==2.6
mccabe==0.6.1
mypy==0.550
numpy==1.13.3
Expand All @@ -12,6 +15,11 @@ pycodestyle==2.3.1
pycparser==2.18
pyflakes==1.6.0
pytest==3.2.5
pytest-cov==2.5.1
python-coveralls==2.9.1
PyYAML==3.12
requests==2.18.4
six==1.11.0
torch==0.3.0.post4
typed-ast==1.1.0
urllib3==1.22

0 comments on commit 183d2ea

Please sign in to comment.