Commit 7af96dea authored by Yuxin Wu's avatar Yuxin Wu

Use static hacks on if False (#656)

parent afa11399
Potential Bugs/Feature Requests/Usage Questions Only: Potential Bugs/Feature Requests/Usage Questions Only:
Any unexpected problems: PLEASE always include Any unexpected problems: __PLEASE ALWAYS INCLUDE__:
1. What you did: 1. What you did:
+ If you're using examples: + If you're using examples:
+ What's the command you run: + What's the command you run:
+ Have you made any changes to code? Post them if any: + Have you made any changes to code? Paste them if any:
+ If not, describe what you did that may be relevant. + If not, tell us what you did that may be relevant.
But we may not be able to resolve it since there is no reproducible code. But we may not be able to resolve it if there is no reproducible code.
2. What you observed, e.g. as much as logs possible. + Better to paste what you did instead of describing them.
2. What you observed, e.g. as much logs as possible.
+ Better to paste what you observed instead of describing them.
3. What you expected, if not obvious. 3. What you expected, if not obvious.
4. Your environment (TF version, tensorpack version, cudnn version, number & type of GPUs), if it matters. 4. Your environment:
+ Python version.
+ TF version: `python -c 'import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)'`.
+ Tensorpack version: `python3 -c 'import tensorpack; print(tensorpack.__version__)'`. You can install Tensorpack master by `pip install -U git+https://github.com/ppwwyyxx/tensorpack.git`.
5. About efficiency, PLEASE first read http://tensorpack.readthedocs.io/en/latest/tutorial/performance-tuning.html 5. About efficiency, PLEASE first read http://tensorpack.readthedocs.io/en/latest/tutorial/performance-tuning.html
Feature Requests: Feature Requests:
......
...@@ -147,7 +147,7 @@ class BinaryILSVRC12(dataset.ILSVRC12Files): ...@@ -147,7 +147,7 @@ class BinaryILSVRC12(dataset.ILSVRC12Files):
jpeg = f.read() jpeg = f.read()
jpeg = np.asarray(bytearray(jpeg), dtype='uint8') jpeg = np.asarray(bytearray(jpeg), dtype='uint8')
yield [jpeg, label] yield [jpeg, label]
ds0 = BinaryILSVRC12() ds0 = BinaryILSVRC12('/path/to/ILSVRC/', 'train')
ds1 = PrefetchDataZMQ(ds0, nr_proc=1) ds1 = PrefetchDataZMQ(ds0, nr_proc=1)
dftools.dump_dataflow_to_lmdb(ds1, '/path/to/ILSVRC-train.lmdb') dftools.dump_dataflow_to_lmdb(ds1, '/path/to/ILSVRC-train.lmdb')
``` ```
......
...@@ -10,7 +10,12 @@ from tensorpack.utils import * ...@@ -10,7 +10,12 @@ from tensorpack.utils import *
from tensorpack.dataflow import * from tensorpack.dataflow import *
# dataflow can be used alone without installing tensorflow # dataflow can be used alone without installing tensorflow
if _HAS_TF: # TODO maybe separate dataflow to a new project if it's good enough
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = _HAS_TF
if STATICA_HACK:
from tensorpack.models import * from tensorpack.models import *
from tensorpack.callbacks import * from tensorpack.callbacks import *
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .base import * from .base import *
from .concurrency import * from .concurrency import *
from .graph import * from .graph import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .base import * from .base import *
from .common import * from .common import *
from .format import * from .format import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .bsds500 import * from .bsds500 import *
from .cifar import * from .cifar import *
from .ilsvrc import * from .ilsvrc import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .base import * from .base import *
from .convert import * from .convert import *
from .crop import * from .crop import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .model_desc import * from .model_desc import *
from .training import * from .training import *
from .distributed import * from .distributed import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .input_source_base import * from .input_source_base import *
from .input_source import * from .input_source import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .batch_norm import * from .batch_norm import *
from .common import * from .common import *
from .conv2d import * from .conv2d import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .base import * from .base import *
from .concurrency import * from .concurrency import *
from .config import * from .config import *
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
from .tower import get_current_tower_context, TowerContext from .tower import get_current_tower_context, TowerContext
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .common import * from .common import *
from .sessinit import * from .sessinit import *
from .argscope import * from .argscope import *
......
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: __init__.py # File: __init__.py
if False: # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .base import * from .base import *
from .config import * from .config import *
from .interface import * from .interface import *
......
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