MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / get_config

Function get_config

examples/ImageNetModels/vgg16.py:109–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108
109def get_config():
110 nr_tower = max(get_num_gpu(), 1)
111 batch = args.batch
112 total_batch = batch * nr_tower
113 assert total_batch >= 256 # otherwise the learning rate warmup is wrong.
114 BASE_LR = 0.01 * (total_batch / 256.)
115
116 logger.info("Running on {} towers. Batch size per tower: {}".format(nr_tower, batch))
117 dataset_train = get_data('train', batch)
118 dataset_val = get_data('val', batch)
119
120 infs = [ClassificationError('wrong-top1', 'val-error-top1'),
121 ClassificationError('wrong-top5', 'val-error-top5')]
122 callbacks = [
123 ModelSaver(),
124 GPUUtilizationTracker(),
125 EstimatedTimeLeft(),
126 ScheduledHyperParamSetter(
127 'learning_rate',
128 [(0, 0.01), (3, max(BASE_LR, 0.01))], interp='linear'),
129 ScheduledHyperParamSetter(
130 'learning_rate',
131 [(30, BASE_LR * 1e-1), (60, BASE_LR * 1e-2), (80, BASE_LR * 1e-3)]),
132 DataParallelInferenceRunner(
133 dataset_val, infs, list(range(nr_tower))),
134 ]
135
136 input = QueueInput(dataset_train)
137 input = StagingInput(input, nr_stage=1)
138 return TrainConfig(
139 model=Model(),
140 data=input,
141 callbacks=callbacks,
142 steps_per_epoch=1281167 // total_batch,
143 max_epoch=100,
144 )
145
146
147if __name__ == '__main__':

Callers 1

vgg16.pyFile · 0.70

Calls 13

get_num_gpuFunction · 0.90
ClassificationErrorClass · 0.85
ModelSaverClass · 0.85
EstimatedTimeLeftClass · 0.85
QueueInputClass · 0.85
StagingInputClass · 0.85
TrainConfigClass · 0.85
formatMethod · 0.80
get_dataFunction · 0.70

Tested by

no test coverage detected