Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.1

working_directory: ~/repo

steps:
- checkout

- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
- v1-dependencies-

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

- run:
name: run tests
command: |
. venv/bin/activate
python -m unittest test.py
- store_artifacts:
path: test-reports
destination: test-reports

deploy:
docker:
- image: circleci/python:3.6.1

working_directory: ~/repo

steps:
- checkout

- restore_cache:
key: v1-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "Makefile" }}

- run:
name: verify git tag vs. version
command: |
python3 -m venv venv
. venv/bin/activate
python setup.py verify
pip install twine
- save_cache:
key: v1-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "Makefile" }}
paths:
- "venv"

# Deploying to PyPI
# for pip install kor2vec
- run:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = codertimo" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: create packages
command: |
make package
- run:
name: upload to pypi
command: |
. venv/bin/activate
twine upload dist/*
workflows:
version: 2
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- deploy:
requires:
- build
filters:
tags:
only: /.*/
branches:
ignore: /.*/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package:
python setup.py sdist
python setup.py bdist_wheel
4 changes: 2 additions & 2 deletions bert_pytorch/model/bert.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch.nn as nn

from model.transformer import TransformerBlock
from model.embedding import BERTEmbedding
from .transformer import TransformerBlock
from .embedding import BERTEmbedding


class BERT(nn.Module):
Expand Down
3 changes: 2 additions & 1 deletion bert_pytorch/model/language_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .bert import BERT
import torch.nn as nn

from .bert import BERT


class BERTLM(nn.Module):
"""
Expand Down
2 changes: 1 addition & 1 deletion bert_pytorch/trainer/pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from torch.optim import Adam
from torch.utils.data import DataLoader

from model import BERTLM, BERT
from ..model import BERTLM, BERT

import tqdm

Expand Down
6 changes: 6 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest
from bert_pytorch import BERT


class BERTTestCase(unittest.TestCase):
pass