Skip to content

Commit

Permalink
Merge pull request #14 from kajyuuen/renewal
Browse files Browse the repository at this point in the history
Add Marginal CRF
  • Loading branch information
kajyuuen authored Nov 14, 2021
2 parents c5e2ebd + 69c738f commit 6ecb915
Show file tree
Hide file tree
Showing 20 changed files with 649 additions and 46 deletions.
1 change: 0 additions & 1 deletion .coverage

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: pytest

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
pytest:
name: Run tests with pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
- name: Add path for Poetry
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install Dependencies
run: poetry install --no-interaction
- name: Run Tests
run: poetry run pytest
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: release

on:
workflow_dispatch:
inputs:
version:
description: "Next Version"
required: true
default: "x.y.z"
release_note:
description: "release note"
required: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install Poetry
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -O
python install-poetry.py --preview --version 1.2.0a1
- name: Add path for Poetry
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Add Poetry Plugin
run: |
pip install poetry-version-plugin
- name: PyPI Settings
run: |
poetry config pypi-token.pypi ${{secrets.PYPI_TOKEN}}
- name: Build Poetry
run: |
git tag v${{ github.event.inputs.version }}
poetry build
poetry publish
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: Release v${{ github.event.inputs.version }}
body: |
${{ github.event.inputs.release_note }}
draft: false
prerelease: false
- name: Get Name of Artifact
run: |
ARTIFACT_PATHNAME=$(ls dist/*.whl | head -n 1)
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: Upload Whl to Release Assets
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ARTIFACT_PATHNAME }}
asset_name: ${{ env.ARTIFACT_NAME }}
asset_content_type: application/x-wheel+zip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ pytorch_partial_crf.egg-info
.vscode
.cache
docs/_build/
.venv
.venv
.pytest_cache
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

196 changes: 196 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool.poetry]
name = "pytorch-partial-crf"
version = "0.2.0"
description = ""
authors = ["Koga Kobayashi"]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.8"
pytest = "^6.2.5"
torch = "^1.10.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
3 changes: 1 addition & 2 deletions pytorch_partial_crf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
__version__ = '0.1.2'

from pytorch_partial_crf.marginal_crf import MarginalCRF
from pytorch_partial_crf.partial_crf import PartialCRF
from pytorch_partial_crf.crf import CRF
1 change: 0 additions & 1 deletion pytorch_partial_crf/base_crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import torch
import torch.nn as nn

from pytorch_partial_crf.utils import create_possible_tag_masks
from pytorch_partial_crf.utils import log_sum_exp

from pytorch_partial_crf.utils import IMPOSSIBLE_SCORE
Expand Down
1 change: 0 additions & 1 deletion pytorch_partial_crf/crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import torch.nn as nn

from pytorch_partial_crf.base_crf import BaseCRF
from pytorch_partial_crf.utils import create_possible_tag_masks
from pytorch_partial_crf.utils import log_sum_exp

class CRF(BaseCRF):
Expand Down
Loading

0 comments on commit 6ecb915

Please sign in to comment.