Skip to content

fix: AttributeError when spks=None in ConditionalCFM.solve_euler (issue #1854)#1856

Open
huyyxyshare wants to merge 2 commits intoFunAudioLLM:mainfrom
huyyxyshare:fix/spks-none-bug-1854
Open

fix: AttributeError when spks=None in ConditionalCFM.solve_euler (issue #1854)#1856
huyyxyshare wants to merge 2 commits intoFunAudioLLM:mainfrom
huyyxyshare:fix/spks-none-bug-1854

Conversation

@huyyxyshare
Copy link
Copy Markdown

Summary

Fix a critical bug in cosyvoice/flow/flow_matching.py that causes an AttributeError when the spks parameter is None.

Bug Description

The forward method accepts spks=None as a default value, but in the solve_euler method, lines 95-100 directly use spks.dtype without checking if spks is None.

Fix

Use x.dtype as a fallback when spks is None to avoid AttributeError.

root added 2 commits March 18, 2026 14:13
- Changed mask logic from '== IGNORE_ID' to '!= IGNORE_ID'
- Fixed gather index to use '~mask' for padding positions
- This ensures DPO loss is computed on valid tokens only, not IGNORE_ID positions
FunAudioLLM#1854)

- Use x.dtype as fallback when spks is None to avoid AttributeError
- This prevents 'NoneType' object has no attribute 'dtype' error
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.

1 participant