Skip to content

Commit

Permalink
Merge branch 'master' into imjoy
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe authored Feb 26, 2020
2 parents 1b0ac50 + f9ed14f commit 41e9c2f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 20.2.0-alpha.5
current_version = 20.2.0-alpha.6
parse = (?P<year>\d+)\.(?P<month>\d+)\.(?P<number>\d+)(\-(?P<release>[a-z]+)(\.(?P<build>\d+))?)?
serialize =
{year}.{month}.{number}-{release}.{build}
Expand Down
46 changes: 18 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
# tiktorch
[![CircleCI](https://circleci.com/gh/ilastik/tiktorch.svg?style=svg)](https://circleci.com/gh/ilastik/tiktorch)
[![CircleCI](https://circleci.com/gh/ilastik/tiktorch.svg?style=shield)](https://circleci.com/gh/ilastik/tiktorch)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Wrappers for Pytorch
## Installation
To install tiktorch and start server run:
```
conda create -n tiktorch-server-env -c ilastik-forge -c conda-forge -c pytorch tiktorch
## tiktorch specification
conda activate tiktorch-server-env
Models saved for tiktorch must follow this specification:
tiktorch-server
```

A folder containing the files
## Development environment

- `model.py`: python file that defines the model.
- `state.nn`: state dict of the model, as obtained by `torch.save(model.state_dict(), 'state.nn')`
- `tiktorch_config.yml`: yaml file with metadata
To create development environment run:

The config must contain the following keys:
```
conda env create --name tiktorch-env --file ./environment.yml
```

- `input_shape`: shape of valid network input, must be either CHW (2D) or CDHW (3D)
- `output_shape`: shape of network output given input with `input_shape`; same format
- `dynamic_input_shape`: TODO explain
- `model_class_name`: name of the model class in `model.py`
- `model_init_kwargs`: keyword arguments to build model
- `torch_version`: torch version used to train this model

In addition, the config may contain the following keys:

- `description`: Description of the pre-trained model
- `data_source`: URL of the data used for pre-training

TODO explain how to generate with tiktorch.

Possible extensions:

- specification for training set-up
- specifiying additional python modules necessary to run the model
- load model saved via `torch.save(model, path)` instead of state dict
Run tests:
```
pytest
```
4 changes: 3 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
script: python -m pip install --no-deps --ignore-installed .
string: np{{CONDA_NPY}}py{{CONDA_PY}}_{{PKG_BUILDNUM}}_h{{PKG_HASH}}_g{{GIT_FULL_HASH[:7]}}
entrypoints:
entry_points:
- tiktorch-server = tiktorch.server.base:main

requirements:
Expand All @@ -29,6 +29,8 @@ requirements:
- numpy >=1.14
- python-bioimage-io
- pytorch-bioimage-io
- grpcio=1.16.0
- protobuf=3.11.4
- pyyaml
- paramiko
- inferno
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- conda-build
- anaconda-client
- bump2version
- pre_commit
- pip:
- pytest-grpc==0.7.0
- git+https://github.com/bioimage-io/python-bioimage-io#egg=pybio # bump
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name="tiktorch",
version="20.2.0-alpha.5",
version="20.2.0-alpha.6",
description="Tiktorch client/server",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 41e9c2f

Please sign in to comment.