Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dataflow/run-inference/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apache-beam[gcp]==2.49.0
torch==2.2.2
transformers==4.38.0
transformers==5.0.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Updating to transformers v5.0.0 is a major version upgrade that introduces breaking changes affecting main.py.

  • Broken Import: The import from transformers.tokenization_utils import PreTrainedTokenizer in main.py (line 31) will fail as this class has been renamed to PythonBackend and the internal module structure has changed. Use from transformers import PreTrainedTokenizerBase for type hinting instead.
  • Decoding Behavior: The tokenizer.decode method (used in main.py:58) now returns a list of strings when passed a 2D input. While RunInference typically yields 1D slices, you should verify that the output remains a string to avoid breaking downstream logic like .encode("utf-8") on line 138.

Consider updating main.py to be compatible with v5 or, if a major migration is not desired, updating to the latest v4 release (e.g., 4.53.0) which includes the security fixes.