Commit 7167cf6d authored by Bohumír Zámečník's avatar Bohumír Zámečník Committed by Yuxin Wu

Fix some typos. (#752)

parent 3c4777ae
......@@ -123,7 +123,7 @@ def setup_keras_trainer(
get_model (input1, input2, ... -> keras.model.Model):
Takes tensors and returns a Keras model. Will be part of the tower function.
input (InputSource):
optimizer (tf.tarin.Optimizer):
optimizer (tf.train.Optimizer):
loss, metrics: list of strings
"""
assert isinstance(optimizer, tf.train.Optimizer), optimizer
......@@ -213,7 +213,7 @@ class KerasModel(object):
if nr_gpu <= 1:
trainer = SimpleTrainer()
else:
# the default multigpu trainer
# the default multi-gpu trainer
trainer = SyncMultiGPUTrainerParameterServer(nr_gpu)
assert isinstance(trainer, Trainer), trainer
assert not isinstance(trainer, DistributedTrainerBase)
......
......@@ -84,7 +84,7 @@ class BatchData(ProxyDataFlow):
remainder (bool): When the remaining datapoints in ``ds`` is not
enough to form a batch, whether or not to also produce the remaining
data as a smaller batch.
If set to False, all produced datapoints are guranteed to have the same batch size.
If set to False, all produced datapoints are guaranteed to have the same batch size.
If set to True, `ds.size()` must be accurate.
use_list (bool): if True, each component will contain a list
of datapoints instead of an numpy array of an extra dimension.
......@@ -706,7 +706,7 @@ class PrintData(ProxyDataFlow):
Args:
entry: the datapoint component
k (int): index of this compoennt in current datapoint
k (int): index of this component in current datapoint
depth (int, optional): recursion depth
max_depth, max_list: same as in :meth:`__init__`.
......
......@@ -191,7 +191,7 @@ class ILSVRC12(ILSVRC12Files):
dir_structure (str): One of 'original' or 'train'.
The directory structure for the 'val' directory.
'original' means the original decompressed directory, which only has list of image files (as below).
If set to 'train', it expects the same two-level directory structure simlar to 'dir/train/'.
If set to 'train', it expects the same two-level directory structure similar to 'dir/train/'.
By default, it tries to automatically detect the structure.
You probably do not need to care about this option because 'original' is what people usually have.
......
......@@ -84,8 +84,8 @@ def dump_dataflow_to_lmdb(df, lmdb_path, write_frequency=5000):
with get_tqdm(total=sz) as pbar:
idx = -1
# lmdb transaction is not exception-safe!
# although it has a contextmanager interface
# LMDB transaction is not exception-safe!
# although it has a context manager interface
txn = db.begin(write=True)
for idx, dp in enumerate(df.get_data()):
txn.put(u'{}'.format(idx).encode('ascii'), dumps(dp))
......
......@@ -242,7 +242,7 @@ def CaffeLMDB(lmdb_path, shuffle=True, keys=None):
class SVMLightData(RNGDataFlow):
""" Read X,y from a svmlight file, and produce [X_i, y_i] pairs. """
""" Read X,y from an SVMlight file, and produce [X_i, y_i] pairs. """
def __init__(self, filename, shuffle=True):
"""
......@@ -275,9 +275,9 @@ class TFRecordData(DataFlow):
def __init__(self, path, size=None):
"""
Args:
path (str): path to the tfrecord file
path (str): path to the TFRecord file
size (int): total number of records, because this metadata is not
stored in the tfrecord file.
stored in the TFRecord file.
"""
self._path = path
self._size = int(size)
......
......@@ -43,7 +43,7 @@ class Augmentor(object):
"""
Returns:
augmented data
augmentaion params
augmentation params
"""
return self._augment_return_params(d)
......@@ -84,7 +84,7 @@ class Augmentor(object):
"""
try:
argspec = inspect.getargspec(self.__init__)
assert argspec.varargs is None, "The default __repr__ doesn't work for vaargs!"
assert argspec.varargs is None, "The default __repr__ doesn't work for varargs!"
assert argspec.keywords is None, "The default __repr__ doesn't work for kwargs!"
fields = argspec.args[1:]
index_field_has_default = len(fields) - (0 if argspec.defaults is None else len(argspec.defaults))
......
......@@ -10,13 +10,13 @@ __all__ = ['ColorSpace', 'Grayscale', 'ToUint8', 'ToFloat32']
class ColorSpace(ImageAugmentor):
""" Convert into another colorspace. """
""" Convert into another color space. """
def __init__(self, mode, keepdims=True):
"""
Args:
mode: opencv colorspace conversion code (e.g., `cv2.COLOR_BGR2HSV`)
keepdims (bool): keep the dimension of image unchanged if opencv
mode: OpenCV color space conversion code (e.g., `cv2.COLOR_BGR2HSV`)
keepdims (bool): keep the dimension of image unchanged if OpenCV
changes it.
"""
self._init(locals())
......
......@@ -10,7 +10,7 @@ __all__ = ['GaussianDeform']
class GaussianMap(object):
""" Generate gaussian weighted deformation map"""
""" Generate Gaussian weighted deformation map"""
# TODO really needs speedup
def __init__(self, image_shape, sigma=0.5):
......
......@@ -10,12 +10,12 @@ __all__ = ['JpegNoise', 'GaussianNoise', 'SaltPepperNoise']
class JpegNoise(ImageAugmentor):
""" Random Jpeg noise. """
""" Random JPEG noise. """
def __init__(self, quality_range=(40, 100)):
"""
Args:
quality_range (tuple): range to sample Jpeg quality
quality_range (tuple): range to sample JPEG quality
"""
super(JpegNoise, self).__init__()
self._init(locals())
......@@ -54,7 +54,7 @@ class GaussianNoise(ImageAugmentor):
class SaltPepperNoise(ImageAugmentor):
""" Salt and pepper noise.
Randomly set some elements in img to 0 or 255, regardless of its channels.
Randomly set some elements in image to 0 or 255, regardless of its channels.
"""
def __init__(self, white_prob=0.05, black_prob=0.05):
......
......@@ -84,7 +84,7 @@ class CenterPaste(ImageAugmentor):
class RandomPaste(CenterPaste):
"""
Randomly paste the image onto a background convas.
Randomly paste the image onto a background canvas.
"""
def _get_augment_params(self, img):
......
......@@ -101,7 +101,7 @@ class _MultiProcessZMQDataFlow(DataFlow):
return
self._reset_done = True
# __del__ not guranteed to get called at exit
# __del__ not guaranteed to get called at exit
atexit.register(del_weakref, weakref.ref(self))
self._reset_once() # build processes
......@@ -134,7 +134,7 @@ class MultiProcessPrefetchData(ProxyDataFlow):
process by a Python :class:`multiprocessing.Queue`.
Note:
1. An iterator cannot run faster automatically -- what's happenning is
1. An iterator cannot run faster automatically -- what's happening is
that the underlying dataflow will be forked ``nr_proc`` times.
As a result, we have the following guarantee on the dataflow correctness:
......@@ -215,7 +215,7 @@ class PrefetchDataZMQ(_MultiProcessZMQDataFlow):
and collect datapoints from the given dataflow in each process by ZeroMQ IPC pipe.
Note:
1. An iterator cannot run faster automatically -- what's happenning is
1. An iterator cannot run faster automatically -- what's happening is
that the underlying dataflow will be forked ``nr_proc`` times.
As a result, we have the following guarantee on the dataflow correctness:
......
......@@ -104,7 +104,7 @@ class MultiThreadMapData(_ParallelMapData):
mixed with datapoints from the next pass.
You can use **strict mode**, where `MultiThreadMapData.get_data()`
is guranteed to produce the exact set which `df.get_data()`
is guaranteed to produce the exact set which `df.get_data()`
produces. Although the order of data still isn't preserved.
"""
class _Worker(StoppableThread):
......@@ -212,7 +212,7 @@ class MultiProcessMapDataZMQ(_ParallelMapData, _MultiProcessZMQDataFlow):
mixed with datapoints from the next pass.
You can use **strict mode**, where `MultiProcessMapData.get_data()`
is guranteed to produce the exact set which `df.get_data()`
is guaranteed to produce the exact set which `df.get_data()`
produces. Although the order of data still isn't preserved.
"""
class _Worker(mp.Process):
......
......@@ -119,7 +119,7 @@ class DataFromGenerator(DataFlow):
class DataFromIterable(DataFlow):
""" Wrap an iterable of datapoitns to a DataFlow"""
""" Wrap an iterable of datapoints to a DataFlow"""
def __init__(self, iterable):
"""
Args:
......
......@@ -142,7 +142,7 @@ class DistributedReplicatedBuilder(DataParallelBuilder, DistributedBuilderBase):
It is an equivalent of ``--variable_update=distributed_replicated`` in
`tensorflow/benchmarks <https://github.com/tensorflow/benchmarks>`_.
Note that the performance of this trianer is still not satisfactory.
Note that the performance of this trainer is still not satisfactory.
Check `ResNet-Horovod <https://github.com/tensorpack/benchmarks/tree/master/ResNet-Horovod>`_
for fast and correct distributed examples.
......
......@@ -111,7 +111,7 @@ class SyncMultiGPUParameterServerBuilder(DataParallelBuilder):
"""
Data-parallel training in 'ParameterServer' mode.
It builds one tower on each GPU with
shared variable scope. It synchronoizes the gradients computed
shared variable scope. It synchronizes the gradients computed
from each tower, averages them and applies to the shared variables.
It is an equivalent of ``--variable_update=parameter_server`` in
......@@ -178,7 +178,7 @@ class SyncMultiGPUReplicatedBuilder(DataParallelBuilder):
Attribute:
grads: #GPU number of lists of (g, v). Synchronized gradients on each device, available after build()
Though on different deviecs, they should contain the same value.
Though on different devices, they should contain the same value.
"""
def __init__(self, towers, average, mode):
......
......@@ -351,7 +351,7 @@ class DummyConstantInput(TensorInput):
def __init__(self, shapes):
"""
Args:
shapes (list[list]): a list of fully-sepcified shapes.
shapes (list[list]): a list of fully-specified shapes.
"""
self.shapes = shapes
logger.warn("Using dummy input for debug!")
......@@ -372,7 +372,7 @@ class DummyConstantInput(TensorInput):
class ZMQInput(TensorInput):
"""
Recv tensors from a ZMQ endpoint, with ops from https://github.com/tensorpack/zmq_ops.
Receive tensors from a ZMQ endpoint, with ops from https://github.com/tensorpack/zmq_ops.
It works with :meth:`dataflow.remote.send_dataflow_zmq(format='zmq_op')`.
"""
def __init__(self, end_point, hwm, bind=True):
......
......@@ -134,7 +134,7 @@ _EXECUTE_HISTORY = set()
def execute_only_once():
"""
Each called in the code to this function is guranteed to return True the
Each called in the code to this function is guaranteed to return True the
first time and False afterwards.
Returns:
......
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