MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / parseArgs

Function parseArgs

quantization/train_mnist.js:31–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29import {createModel as createFashionMnistModel} from './model_fashion_mnist';
30
31function parseArgs() {
32 const parser = new argparse.ArgumentParser({
33 description: 'TensorFlow.js Quantization Example: Training an MNIST Model',
34 addHelp: true
35 });
36 parser.addArgument('dataset', {
37 type: 'string',
38 help: 'Name of the dataset ({mnist, fashion-mnist}).'
39 });
40 parser.addArgument('--epochs', {
41 type: 'int',
42 defaultValue: 100,
43 help: 'Number of epochs to train the model for.'
44 });
45 parser.addArgument('--batchSize', {
46 type: 'int',
47 defaultValue: 128,
48 help: 'Batch size to be used during model training.'
49 });
50 parser.addArgument('--validationSplit', {
51 type: 'float',
52 defaultValue: 0.15,
53 help: 'Validation split used for training.'
54 });
55 parser.addArgument('--modelSavePath', {
56 type: 'string',
57 defaultValue: './models/',
58 help: 'Path to which the model will be saved after training.'
59 });
60 parser.addArgument('--gpu', {
61 action: 'storeTrue',
62 help: 'Use tfjs-node-gpu for training (requires CUDA-enabled ' +
63 'GPU and supporting drivers and libraries.'
64 });
65 return parser.parseArgs();
66}
67
68async function main() {
69 const args = parseArgs();

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected