Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepcopy added in pipeline, breaks anything that worked before that used Rlock etc. like streaming generation #23785

Closed
2 of 4 tasks
pseudotensor opened this issue May 26, 2023 · 4 comments

Comments

@pseudotensor
Copy link

pseudotensor commented May 26, 2023

System Info

transformers==4.29.2
python 3.10

Who can help?

@gante @Narsil

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. Pass streamer instance of TextIteratorStreamer(), which includes thread, to TextGenerationPipeline as generator kwargs.
  2. See pickle error due to new copy.deepcopy() added.

Due to this change by @gante:

b369e50

This is a fully blocking change for me. I cannot upgrade to new transformers since this change because this breaks streaming scenario.

Expected behavior

I don't think copy.deepcopy() is appropriate. The dictionary itself is passed in as **generate_kwargs and any mutation to the dictionary itself has no effect on the parent dictionary or items passed in.

Additionally, the modifications made to the dictionary in that changed code only involve entries within the dictionary, not to mutable items inside the dictionary, so none of those changes would have any effect to any other block of code.

A simple shallow copy is sufficient.

But additionally, I can't see any reason for any copy at all. Changes to the dictionary locally have no effect anywhere else.

@Narsil
Copy link
Contributor

Narsil commented Jun 5, 2023

@pseudotensor you closed this without a comment. Is this issue still relevant ?

@pseudotensor pseudotensor reopened this Jun 5, 2023
@pseudotensor
Copy link
Author

Github trying to be too smart with separate issue in another repo

@gante
Copy link
Member

gante commented Jun 12, 2023

@pseudotensor 👋

TIL "The dictionary itself is passed in as **generate_kwargs and any mutation to the dictionary itself has no effect on the parent dictionary or items passed in."

In that case you're right, no copy is needed at all!

@gante
Copy link
Member

gante commented Jun 13, 2023

@pseudotensor should be fixed now (closing the issue, but feel free to reopen if you find further related issues)

@gante gante closed this as completed Jun 13, 2023
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

No branches or pull requests

3 participants