preprocess/sm_inference_asum.py [277:309]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    hypotheses_batch, score_batch, unnormalized_score_batch, pos_score_batch, tokens_batch = \
                        _sample_wrapper(
                            bart,
                            sentences=slines,
                            beam=args.beam,
                            lenpen=1.0,
                            max_len_b=args.max_len,
                            min_len=args.min_len,
                            sampling=args.sampling,
                            sampling_topk=args.sampling_topk,
                            sampling_topp=args.sampling_topp,
                            return_all=args.return_all,
                            input_is_bpe=False,
                            return_token_scores=args.return_token_scores,
                            diverse_beam_groups=args.diverse_beam_groups,
                            diverse_beam_strength=args.diverse_beam_strength,
                        )
                    assert len(hypotheses_batch) == len(score_batch) == len(unnormalized_score_batch), \
                        "lens not equal: {} and {} and {}".format(
                        len(hypotheses_batch), len(score_batch), len(unnormalized_score_batch)
                    )
                    assert len(hypotheses_batch) == len(slines), "slines={}, generated_score length={}".format(
                        slines, len(hypotheses_batch)
                    )
                    if args.return_token_scores:
                        for t, s, unnormalized_s, pos_s, toks, sline in zip(hypotheses_batch, score_batch,
                                                                           unnormalized_score_batch,
                                                                           pos_score_batch, tokens_batch, slines):
                            qa_item = [{
                                'context': sline,
                                'qa': t if type(t) is list else [t, ],
                                'norm_scores': s if type(s) is list else [s, ],
                                'unnorm_scores': unnormalized_s if type(unnormalized_s) is list else [unnormalized_s, ],
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



preprocess/sm_inference_asum.py [338:371]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                hypotheses_batch, score_batch, unnormalized_score_batch, pos_score_batch, tokens_batch = \
                    _sample_wrapper(
                        bart,
                        sentences=slines,
                        beam=args.beam,
                        lenpen=1.0,
                        max_len_b=args.max_len,
                        min_len=args.min_len,
                        sampling=args.sampling,
                        sampling_topk=args.sampling_topk,
                        sampling_topp=args.sampling_topp,
                        return_all=args.return_all,
                        input_is_bpe=False,
                        return_token_scores=args.return_token_scores,
                        diverse_beam_groups=args.diverse_beam_groups,
                        diverse_beam_strength=args.diverse_beam_strength,
                    )
                assert len(hypotheses_batch) == len(score_batch) == len(unnormalized_score_batch), \
                    "lens not equal: {} and {} and {}".format(
                        len(hypotheses_batch), len(score_batch), len(unnormalized_score_batch)
                    )
                assert len(hypotheses_batch) == len(slines), "slines={}, generated_score length={}".format(
                    slines, len(hypotheses_batch)
                )

                if args.return_token_scores:
                    for t, s, unnormalized_s, pos_s, toks, sline in zip(hypotheses_batch, score_batch,
                                                                        unnormalized_score_batch,
                                                                        pos_score_batch, tokens_batch, slines):
                        qa_item = [{
                            'context': sline,
                            'qa': t if type(t) is list else [t, ],
                            'norm_scores': s if type(s) is list else [s, ],
                            'unnorm_scores': unnormalized_s if type(unnormalized_s) is list else [unnormalized_s, ],
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



