awslabs / sockeye

Sequence-to-sequence framework with a focus on Neural Machine Translation based on PyTorch
https://awslabs.github.io/sockeye/
Apache License 2.0
1.21k stars 323 forks source link

Missing `--softmax-temperature T` #1109

Open AmitMY opened 6 months ago

AmitMY commented 6 months ago

I would like to sample from my decoder.

The docs say I can:

image

But I get an error:

usage: translate.py [-h] [--config CONFIG] [--input INPUT] [--input-factors INPUT_FACTORS [INPUT_FACTORS ...]] [--json-input] [--output OUTPUT] --models MODELS [MODELS ...]
                    [--checkpoints CHECKPOINTS [CHECKPOINTS ...]] [--nbest-size NBEST_SIZE] [--beam-size BEAM_SIZE] [--greedy] [--beam-search-stop {all,first}]
                    [--batch-size BATCH_SIZE] [--chunk-size CHUNK_SIZE] [--sample [SAMPLE]] [--seed SEED] [--ensemble-mode {linear,log_linear}] [--bucket-width BUCKET_WIDTH]
                    [--max-input-length MAX_INPUT_LENGTH] [--max-output-length-num-stds MAX_OUTPUT_LENGTH_NUM_STDS] [--max-output-length MAX_OUTPUT_LENGTH]
                    [--restrict-lexicon RESTRICT_LEXICON [RESTRICT_LEXICON ...]] [--restrict-lexicon-topk RESTRICT_LEXICON_TOPK] [--skip-nvs] [--nvs-thresh NVS_THRESH]
                    [--strip-unknown-words] [--prevent-unk] [--output-type {translation,score,translation_with_score,translation_with_factors,benchmark,json}]
                    [--length-penalty-alpha LENGTH_PENALTY_ALPHA] [--length-penalty-beta LENGTH_PENALTY_BETA] [--brevity-penalty-type {none,learned,constant}]
                    [--brevity-penalty-weight BREVITY_PENALTY_WEIGHT] [--brevity-penalty-constant-length-ratio BREVITY_PENALTY_CONSTANT_LENGTH_RATIO]
                    [--dtype {None,float32,float16,bfloat16,int8}] [--clamp-to-dtype] [--device-id DEVICE_ID] [--use-cpu] [--env ENV] [--tf32 TF32] [--quiet]
                    [--quiet-secondary-workers] [--no-logfile] [--loglevel {INFO,DEBUG,ERROR}] [--loglevel-secondary-workers {INFO,DEBUG,ERROR}] [--knn-index KNN_INDEX]
                    [--knn-lambda KNN_LAMBDA]
translate.py: error: unrecognized arguments: --softmax-temperature 2.0

Is this supported otherwise?

mjdenkowski commented 6 months ago

Hi Amit,

This was implemented in the old MXNet version of Sockeye. When we updated Sockeye to PyTorch (3.1.0), --softmax-temperature was one of the features we chose not to migrate. If you're interested in taking a look at the MXNet code for this feature, the pull request for that implementation is #869.

Best, Michael