Skip to content

Fix HunyuanVideo 1.5 modular glyph regex for curly quotes - #13523

Closed
Ricardo-M-L wants to merge 1 commit into
huggingface:mainfrom
Ricardo-M-L:fix-hunyuan-video15-modular-glyph-regex
Closed

Fix HunyuanVideo 1.5 modular glyph regex for curly quotes#13523
Ricardo-M-L wants to merge 1 commit into
huggingface:mainfrom
Ricardo-M-L:fix-hunyuan-video15-modular-glyph-regex

Conversation

@Ricardo-M-L

Copy link
Copy Markdown
Contributor

What does this PR do?

extract_glyph_texts in the HunyuanVideo 1.5 modular pipeline had a copy-paste typo in its regex:

# src/diffusers/modular_pipelines/hunyuan_video1_5/encoders.pypattern=r"\"(.*?)\"|\"(.*?)\""

Both alternatives match ASCII double quotes. The second branch is redundant, and any text quoted with Chinese / smart curly quotes (“…”) is silently dropped — no glyph extraction happens, so the model never receives the formatted Text "..." instruction.

The canonical, non-modular pipeline has the intended pattern (https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py#L93):

pattern=r"\"(.*?)\"|“(.*?)”"

HunyuanVideo 1.5 is a bilingual Tencent model, so Chinese prompts that use “…” to mark on-screen text are a realistic and documented input shape. Under the modular path they currently skip glyph extraction entirely and produce mis-rendered poster/caption text.

Reproduction

importrebuggy=r"\"(.*?)\"|\"(.*?)\""# modular path todayfixed=r"\"(.*?)\"|“(.*?)”"# non-modular path / this fixprompt='A poster with “你好”'print(re.findall(buggy, prompt)) # -> [] (silently ignored)print(re.findall(fixed, prompt)) # -> [('', '你好')]

Fix

Align the modular pipeline's pattern with the existing, correct non-modular pattern. One-character change.

Before submitting

  • This PR fixes a typo or improves the docs.
  • Did you read the contributor guideline?
  • Did you make sure to update the documentation with your changes? (N/A — internal helper, no doc references)
  • Did you write any new necessary tests? (N/A — trivially verifiable regex constant)

Who can review?

@DN6@yiyixuxu

The `extract_glyph_texts` helper in the HunyuanVideo 1.5 modular pipeline
had a copy-paste typo: both alternatives of the pattern matched ASCII
double quotes (`\"(.*?)\"|\"(.*?)\"`), making the second branch redundant
and silently dropping any text wrapped in the Chinese/smart curly quotes
`“…”`.
The non-modular counterpart in
`src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py`
uses the correct pattern `\"(.*?)\"|“(.*?)”`, which is what the model
expects for glyph rendering — HunyuanVideo 1.5 is a bilingual model, so
Chinese prompts that quote text with `“…”` would skip glyph extraction
entirely under the modular path and produce mis-rendered poster text.
This aligns the modular pipeline's pattern with the canonical one.
@Ricardo-M-L

Copy link
Copy Markdown
ContributorAuthor

Polite bump — the original `extract_glyph_texts` regex `r"\"(.?)\"|\"(.?)\""` has two identical alternatives (both match straight `"`), so the second branch is dead code and curly-quoted glyphs (`"…"`) never match. The fix changes the second branch to `"(.*?)"` so the function picks up smart-quoted glyphs as documented.

cc @yiyixuxu — modular pipelines area. CI is green, sitting since 2026-04-21. 🙏

@Ricardo-M-L

Copy link
Copy Markdown
ContributorAuthor

@yiyixuxu friendly bump 🙏 — 14 days since I opened this and no review yet. One-line regex fix: the original pattern r'"(.*?)"|"(.*?)"' has two identical alternatives because both straight quotes were the same byte, so the curly-quote branch ("") never fires and quoted glyph spans get missed in HunyuanVideo 1.5. Happy to rebase if needed.

@Ricardo-M-L

Copy link
Copy Markdown
ContributorAuthor

Hi team, just following up on this PR. Happy to make any changes or address feedback if needed. Thanks for considering it!

@Ricardo-M-L

Copy link
Copy Markdown
ContributorAuthor

Hi! Just a friendly ping on this PR. It's been open for a while — would appreciate a review when you get a chance. Thanks for your time!

@Ricardo-M-L

Copy link
Copy Markdown
ContributorAuthor

Friendly ping - this PR has been open for a while. Would appreciate a review when you get a chance. Thanks!

@yiyixuxu

Copy link
Copy Markdown
Collaborator

hi @Ricardo-M-L

I'm closing this per the AI-assisted contribution guidelines: https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#ai-assisted-and-agentic-contributions

We're seeing an increasing volume of contributions and review capacity is currently our bottleneck, so the guidelines ask for maintainer acknowledgment on an issue before a PR is opened — that's what lets us prioritize the bugs users are actually hitting.

Normally we'd leave this as a suggestion and keep working with a contributor on the PR, but the volume here has made that impractical — these have come in faster than we can review them, so I'm closing all of them that's opened bu you rather than reviewing them individually.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modular-pipelinessize/SPR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Ricardo-M-L@yiyixuxu