aeb516494daa207720b428072ab49eeea7bfff75,scripts/text_generation/sequence_sampling.py,,,#,33

Before Change


parser.add_argument("--temperature", type=float, default=1.0,
                    help="Softmax temperature used in sampling.")
args = parser.parse_args()
if not args.use_beam_search and not args.use_sampling:
    parser.error("No decoding option specified. Add one of --use-sampling and --use-beam-search.")

print(args)
if args.gpu is None:
    ctx = mx.cpu()
else:

After Change


// beam search sampler options
subparsers = parser.add_subparsers(help="Sequence generation methods.",
                                   dest="command")
subparsers.required = True
beam_search_parser = subparsers.add_parser("beam-search", help="Use beam search for decoding.")
beam_search_parser.add_argument("--alpha", type=float, default=0.0,
                                help="Alpha in the length penalty term.")
beam_search_parser.add_argument("--k", type=int, default=5, help="K in the length penalty term.")

// random sampler options
random_sample_parser = subparsers.add_parser("random-sample",
                                             help="Use random sampling for decoding.")
random_sample_parser.add_argument("--temperature", type=float, default=1.0,
                                  help="Softmax temperature used in sampling.")
random_sample_parser.add_argument("--use-top-k", type=int, required=False,
                                  help="Sample only from the top-k candidates.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: dmlc/gluon-nlp
Commit Name: aeb516494daa207720b428072ab49eeea7bfff75
Time: 2019-06-13
Author: xshiab@ust.hk
File Name: scripts/text_generation/sequence_sampling.py
Class Name:
Method Name:


Project Name: danforthcenter/plantcv
Commit Name: 86ac6632c5c84d1b5a0018d395542d649d27ca6a
Time: 2017-05-03
Author: noahfahlgren@gmail.com
File Name: plantcv-train.py
Class Name:
Method Name: options


Project Name: kubeflow/kubeflow
Commit Name: 4b64702c794b18b443a1f2a2042641114c0a122a
Time: 2018-02-12
Author: jeremy@lewi.us
File Name: testing/test_deploy.py
Class Name:
Method Name: main