Skip to content

Commit 6ecb915

Browse files
authored
Merge pull request #14 from kajyuuen/renewal
Add Marginal CRF
2 parents c5e2ebd + 69c738f commit 6ecb915

20 files changed

+649
-46
lines changed

.coverage

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/pytest.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: pytest
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
pytest:
13+
name: Run tests with pytest
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.8, 3.9]
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install Poetry
25+
run: |
26+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
27+
- name: Add path for Poetry
28+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
29+
- name: Install Dependencies
30+
run: poetry install --no-interaction
31+
- name: Run Tests
32+
run: poetry run pytest

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Next Version"
8+
required: true
9+
default: "x.y.z"
10+
release_note:
11+
description: "release note"
12+
required: false
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: 3.9
22+
- name: Install Poetry
23+
run: |
24+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -O
25+
python install-poetry.py --preview --version 1.2.0a1
26+
- name: Add path for Poetry
27+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
28+
- name: Add Poetry Plugin
29+
run: |
30+
pip install poetry-version-plugin
31+
- name: PyPI Settings
32+
run: |
33+
poetry config pypi-token.pypi ${{secrets.PYPI_TOKEN}}
34+
- name: Build Poetry
35+
run: |
36+
git tag v${{ github.event.inputs.version }}
37+
poetry build
38+
poetry publish
39+
- name: Create Release
40+
id: create_release
41+
uses: actions/create-release@v1
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
tag_name: v${{ github.event.inputs.version }}
46+
release_name: Release v${{ github.event.inputs.version }}
47+
body: |
48+
${{ github.event.inputs.release_note }}
49+
draft: false
50+
prerelease: false
51+
- name: Get Name of Artifact
52+
run: |
53+
ARTIFACT_PATHNAME=$(ls dist/*.whl | head -n 1)
54+
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
55+
echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
56+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
57+
- name: Upload Whl to Release Assets
58+
id: upload-release-asset
59+
uses: actions/[email protected]
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.create_release.outputs.upload_url }}
64+
asset_path: ${{ env.ARTIFACT_PATHNAME }}
65+
asset_name: ${{ env.ARTIFACT_NAME }}
66+
asset_content_type: application/x-wheel+zip

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ pytorch_partial_crf.egg-info
66
.vscode
77
.cache
88
docs/_build/
9-
.venv
9+
.venv
10+
.pytest_cache

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

poetry.lock

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tool.poetry]
2+
name = "pytorch-partial-crf"
3+
version = "0.2.0"
4+
description = ""
5+
authors = ["Koga Kobayashi"]
6+
license = "MIT"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.8"
10+
pytest = "^6.2.5"
11+
torch = "^1.10.0"
12+
13+
[tool.poetry.dev-dependencies]
14+
15+
[build-system]
16+
requires = ["poetry-core>=1.0.0"]
17+
build-backend = "poetry.core.masonry.api"

pytorch_partial_crf/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
__version__ = '0.1.2'
2-
1+
from pytorch_partial_crf.marginal_crf import MarginalCRF
32
from pytorch_partial_crf.partial_crf import PartialCRF
43
from pytorch_partial_crf.crf import CRF

pytorch_partial_crf/base_crf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import torch
55
import torch.nn as nn
66

7-
from pytorch_partial_crf.utils import create_possible_tag_masks
87
from pytorch_partial_crf.utils import log_sum_exp
98

109
from pytorch_partial_crf.utils import IMPOSSIBLE_SCORE

pytorch_partial_crf/crf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import torch.nn as nn
55

66
from pytorch_partial_crf.base_crf import BaseCRF
7-
from pytorch_partial_crf.utils import create_possible_tag_masks
87
from pytorch_partial_crf.utils import log_sum_exp
98

109
class CRF(BaseCRF):

0 commit comments

Comments
 (0)