Skip to content

Conversation

@JulianneKnott
Copy link
Contributor

Updating Fastseq for compatibility with huggingface transformers v4.12.0.
Benchmarks (samples/sec):

Bart       13.0 (2.9x)
DistilBart 19.1 (3.5x)
T5         29.2 (2.0x)
GPT2       20.3 (5.1x)
ProphetNet TBD

Copy link
Contributor

@feihugis feihugis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JulianneKnott Thanks for updating HF models! I did a pass and left some minor comments. Did you check if all the changed code have been used during the inference?

#https://github.com/huggingface/transformers.git \
export BASELINE_REPO=$CACHE_DIR/transformers_v4.12.0
git_clone_if_not_in_cache \
https://github.com/JiushengChen/transformers.git \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some context about this forked repo, it is to add param "no_repeat_ngram_size", see
JiushengChen/Transformers@db97043

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, this is no longer needed since fastseq uses it's own run_eval_hf.py for the baseline?

Comment on lines +529 to +533
is_greedy_gen_mode = (num_beams == 1) and (num_beam_groups == 1) and do_sample is False
is_sample_gen_mode = (num_beams == 1) and (num_beam_groups == 1) and do_sample is True
is_beam_gen_mode = (num_beams > 1) and (num_beam_groups == 1) and do_sample is False
is_beam_sample_gen_mode = (num_beams > 1) and (num_beam_groups == 1) and do_sample is True
is_group_beam_gen_mode = (num_beams > 1) and (num_beam_groups > 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are our changes compatible with all these generation modes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The beam search updates are only applied for is_beam_gen_mode. The model-specific updates (ie attention) are applied in all cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it also work with is_group_beam_gen_mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no is_group_beam_gen_mode does not use the updates. Should that be added?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the optimizations can also work for group_beam_gen_mode, we can add it. We can support it in the another PR later if it will take some time to support it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will take some time to make it work for both, so I think it's best if group_beam_gen_mode goes in another pr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

Copy link
Contributor

@feihugis feihugis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JulianneKnott for the revisions! The PR looks good to me!

@JulianneKnott JulianneKnott merged commit df98314 into main Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants