MCPcopy Create free account
hub / github.com/pytorch/pytorch / main

Function main

caffe2/python/examples/char_rnn.py:246–271  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244
245@utils.debug
246def main():
247 parser = argparse.ArgumentParser(
248 description="Caffe2: Char RNN Training"
249 )
250 parser.add_argument("--train_data", type=str, default=None,
251 help="Path to training data in a text file format",
252 required=True)
253 parser.add_argument("--seq_length", type=int, default=25,
254 help="One training example sequence length")
255 parser.add_argument("--batch_size", type=int, default=1,
256 help="Training batch size")
257 parser.add_argument("--iters_to_report", type=int, default=500,
258 help="How often to report loss and generate text")
259 parser.add_argument("--hidden_size", type=int, default=100,
260 help="Dimension of the hidden representation")
261 parser.add_argument("--gpu", action="store_true",
262 help="If set, training is going to use GPU 0")
263
264 args = parser.parse_args()
265
266 device = core.DeviceOption(
267 workspace.GpuDeviceType if args.gpu else caffe2_pb2.CPU, 0)
268 with core.DeviceScope(device):
269 model = CharRNN(args)
270 model.CreateModel()
271 model.TrainModel()
272
273
274if __name__ == '__main__':

Callers 1

char_rnn.pyFile · 0.70

Calls 4

CreateModelMethod · 0.95
TrainModelMethod · 0.95
CharRNNClass · 0.85
parse_argsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…