Open
Conversation
grzegorz-roboflow
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes truncated GLM OCR responses by addressing the token-limit path in both direct GLM inference and workflow remote execution.
What changed
max_new_tokensbehavior when requests arrive withmax_new_tokens=None.max_new_tokensto the GLM OCR workflow block and forwarded it in both local and remote execution modes.max_new_tokensandenable_thinkingso remote workflow execution can pass generation parameters through to/infer/lmm.Root cause
There were two gaps working together:
LMMInferenceRequestcan legitimately carrymax_new_tokens=None, but the GLM-OCR wrapper forwarded thatNonedirectly into generation instead of restoring the model default.max_new_tokens, and the shared LMM SDK helper did not serialize that field either.That combination made serverless workflow execution especially likely to use an unintended shorter generation limit.
Impact
Validation
python -m py_compile inference_models/inference_models/models/glm_ocr/glm_ocr_hf.py inference_sdk/http/client.py inference/core/workflows/core_steps/models/foundation/glm_ocr/v1.py inference/core/workflows/core_steps/models/foundation/qwen3_5vl/v1.py tests/workflows/unit_tests/core_steps/models/foundation/test_vlm_remote_execution.py tests/inference_sdk/unit_tests/http/test_client.py inference_models/tests/unit_tests/models/test_glm_ocr_hf.pygit diff --checkNotes
pytestcould not be run in this environment because the current Python environment does not havepytestinstalled (python -m pytestreportedNo module named pytest).