Skip to content

fix(backend): replace deprecated pad_to_max_length with modern padding parameter#516

Open
metaloozee wants to merge 1 commit intoAOSSIE-Org:mainfrom
metaloozee:511
Open

fix(backend): replace deprecated pad_to_max_length with modern padding parameter#516
metaloozee wants to merge 1 commit intoAOSSIE-Org:mainfrom
metaloozee:511

Conversation

@metaloozee
Copy link

@metaloozee metaloozee commented Mar 3, 2026

Addressed Issues:

Fixes #511

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

AI Usage Disclosure

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have tested the code locally and I am responsible for it.

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Chores
    • Updated backend processing modules to align with current framework standards, improving code maintainability while preserving existing functionality and output consistency.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc3bf1a and f090114.

📒 Files selected for processing (2)
  • backend/Generator/main.py
  • backend/Generator/mcq.py

📝 Walkthrough

Walkthrough

This update replaces the deprecated pad_to_max_length=True parameter with the current Transformers API format padding="max_length" and adds truncation=True in tokenization calls across the Generator module to resolve deprecation warnings.

Changes

Cohort / File(s) Summary
Tokenizer API Updates
backend/Generator/main.py, backend/Generator/mcq.py
Replaced deprecated pad_to_max_length=True with padding="max_length" and added truncation=True in tokenization calls to align with current HuggingFace Transformers API and eliminate deprecation warnings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 With whiskers twitching, I hop with glee,
Old tokenizer parameters set finally free!
Padding and truncation, now modern and bright,
HuggingFace warnings fade into the night! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing the deprecated pad_to_max_length parameter with the modern padding parameter in the backend code.
Linked Issues check ✅ Passed The pull request fully addresses issue #511 by replacing pad_to_max_length=True with padding='max_length' and adding truncation=True across the tokenization pipeline in both main.py and mcq.py.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to replacing deprecated tokenizer arguments in two files, directly addressing issue #511 with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Update deprecated pad_to_max_length argument in tokenization pipeline

1 participant