Commit 0aa7446f authored by Yuxin Wu's avatar Yuxin Wu

start using pip to install

parent 8553816b
...@@ -6,19 +6,15 @@ cache: ...@@ -6,19 +6,15 @@ cache:
pip: true pip: true
apt: true apt: true
addons:
apt:
sources:
ubuntu-toolchain-r-test
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- os: linux - os: linux
python: 2.7 python: 2.7
env: TF_VERSION=1.0.0rc0 TF_TYPE=release env: TF_VERSION=1.0.0rc1 TF_TYPE=release
- os: linux - os: linux
python: 3.5 python: 3.5
env: TF_VERSION=1.0.0rc0 TF_TYPE=release env: TF_VERSION=1.0.0rc1 TF_TYPE=release
- os: linux - os: linux
python: 2.7 python: 2.7
env: TF_VERSION=0.12.1 TF_TYPE=nightly env: TF_VERSION=0.12.1 TF_TYPE=nightly
...@@ -34,8 +30,9 @@ install: ...@@ -34,8 +30,9 @@ install:
# Here we use opencv-python to overcome some travis probelms. # Here we use opencv-python to overcome some travis probelms.
# Users are not recommended to use opencv-python because it brings issues working on GPU # Users are not recommended to use opencv-python because it brings issues working on GPU
# together with tensorflow. # together with tensorflow.
- if [ -e requirements.txt ]; then pip install -r requirements.txt;else pip install -r requirements.pip;fi # - if [ -e requirements.txt ]; then pip install -r requirements.txt;else pip install -r requirements.pip;fi
- ./tests/install-tensorflow.sh - ./tests/install-tensorflow.sh
- pip install .
before_script: before_script:
- flake8 --version - flake8 --version
...@@ -45,7 +42,7 @@ before_script: ...@@ -45,7 +42,7 @@ before_script:
script: script:
- flake8 . - flake8 .
- cd examples && flake8 . - cd examples && flake8 .
- export PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR # - export PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR && python tests/test_examples.py - cd $TRAVIS_BUILD_DIR && python tests/test_examples.py
notifications: notifications:
......
...@@ -54,20 +54,17 @@ With the above components defined, tensorpack trainer will run the training iter ...@@ -54,20 +54,17 @@ With the above components defined, tensorpack trainer will run the training iter
Multi-GPU training is off-the-shelf by simply switching the trainer. Multi-GPU training is off-the-shelf by simply switching the trainer.
You can also define your own trainer for non-standard training (e.g. GAN). You can also define your own trainer for non-standard training (e.g. GAN).
## Dependencies: ## Install:
Dependencies:
+ Python 2 or 3 + Python 2 or 3
+ TensorFlow >= 1.0.0rc0 + TensorFlow >= 1.0.0rc0
+ Python bindings for OpenCV + Python bindings for OpenCV
+ other requirements: + (optional) use tcmalloc if running with large data
```
pip install --user -r requirements.txt
pip install --user -r opt-requirements.txt # (some optional dependencies required by certain submodule, you can install later if needed)
```
+ Enable `import tensorpack`:
``` ```
export PYTHONPATH=$PYTHONPATH:`readlink -f path/to/tensorpack` git clone https://github.com/ppwwyyxx/tensorpack/ && cd tensorpack
pip install --user --upgrade .
pip install --user -r opt-requirements.txt # (some optional dependencies required by certain submodules, you can install later if prompted)
``` ```
(or use `greadlink` from `coreutils` brew package if you're on OSX)
+ Use tcmalloc if running with large data
termcolor termcolor
numpy numpy
tqdm tqdm
nltk
decorator decorator
Sphinx==1.5.1 Sphinx==1.5.1
recommonmark==0.4.0 recommonmark==0.4.0
...@@ -39,5 +39,5 @@ To view the loss curve: ...@@ -39,5 +39,5 @@ To view the loss curve:
```bash ```bash
cat train_log/hed/stat.json | jq '.[] | cat train_log/hed/stat.json | jq '.[] |
"\(.xentropy1)\t\(.xentropy2)\t\(.xentropy3)\t\(.xentropy4)\t\(.xentropy5)\t\(.xentropy6)"' -r | \ "\(.xentropy1)\t\(.xentropy2)\t\(.xentropy3)\t\(.xentropy4)\t\(.xentropy5)\t\(.xentropy6)"' -r | \
../../scripts/plot-point.py --legend 1,2,3,4,5,final --decay 0.8 tpk-plot-point --legend 1,2,3,4,5,final --decay 0.8
``` ```
...@@ -48,6 +48,7 @@ for s in scripts: ...@@ -48,6 +48,7 @@ for s in scripts:
setup( setup(
version=__version__, version=__version__,
install_requires=req, install_requires=req,
tests_require=['flake8']
extras_require={ extras_require={
'all': extra_req 'all': extra_req
}, },
......
...@@ -7,6 +7,7 @@ from contextlib import contextmanager ...@@ -7,6 +7,7 @@ from contextlib import contextmanager
import numpy as np import numpy as np
# this function exists for backwards-compatibilty
def prediction_incorrect(logits, label, topk=1, name='incorrect_vector'): def prediction_incorrect(logits, label, topk=1, name='incorrect_vector'):
""" """
Args: Args:
......
...@@ -155,9 +155,12 @@ class Trainer(object): ...@@ -155,9 +155,12 @@ class Trainer(object):
@property @property
def global_step(self): def global_step(self):
return self._starting_step + \ try:
self.config.steps_per_epoch * (self.epoch_num - 1) + \ return self._starting_step + \
self.local_step + 1 self.config.steps_per_epoch * (self.epoch_num - 1) + \
self.local_step + 1
except AttributeError:
return get_global_step_value()
def main_loop(self): def main_loop(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment