question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to pass encoder_outputs to generate calls

See original GitHub issue

Environment info

  • transformers version: Github Main branch

Who can help

TextGeneration: @TevenLeScao

Information

Model I am using (Bert, XLNet …): T5

I’m unable to pass preconputed encoder_outputs to the .generate() method.

I’ve tried defining:

model_kwargs = {"encoder_outputs": encoder_outputs}
output = model.generate(model_kwargs)

But I’ve noticed some validation errors for input_ids. Even if I replace input_ids with dummy values, I’ve noticed the model_kwargs is always replaced here:

https://github.com/huggingface/transformers/blob/master/src/transformers/generation_utils.py#L448

I think it can be fixed (without optimization) by just replacing:

model_kwargs["encoder_outputs"] = encoder_outputs

with:

model_kwargs.setdefault("encoder_outputs", encoder_outputs)

If you agree I can try to open a PR to fix this.

Best,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
patrickvonplatencommented, Oct 7, 2020

Hey @gabisurita - I understand that one might want to forward encoder_outputs in the generate function. However, adding such a possibility opens the door for many problems in case beam_search is chosen. We are currently working on a bigger refactor that should solve this problem by a better design choice of generate(). I’m afraid that this will still take ~3,4 weeks to complete though.

0reactions
github-actions[bot]commented, Apr 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encoder Signal Overview & Troubleshooting Common Issues
Encoder Signal Overview & How to Troubleshoot Common Issues. Encoder signal outputs are generated by a rotary encoder when the shaft or bore...
Read more >
Four Steps to End Encoder Problems - YouTube
Your browser can't play this video. Learn more.
Read more >
6 Simple Tips for Encoder Repair and Troubleshooting
1.Incorrect Output – Getting the wrong or distorted output? Random faults? This can be caused by several things including: loose wiring, ...
Read more >
Unable to feed decoder output to encoder input using ...
Here I'm just ignoring the encoder output until I get this bunch of code error free. private boolean doEncoderOutput(MediaCodec.BufferInfo ...
Read more >
Processing Data in the Encoder - Win32 apps - Microsoft Learn
The encoder starts processing and the data and produces one or more output media samples that must be retrieved by ProcessOutput as long...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found