Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CLAPAudioCfg assertion error #929

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

l1cacheDell
Copy link

When inferencing SD3 in Python3.11, with flag --inference_optimize 1 on, the program throws:

ValueError: mutable default <class 'paddlemix.models.audioldm2.clap_module.model.CLAPAudioCfg'> for field audio_cfg is not allowed: use default_factory

Problem lies on: paddlemix/models/audioldm2/clap_module/clap.py

from dataclasses import dataclass

@dataclass
class CLAPConfig:
    embed_dim: int = 1024
    audio_cfg: CLAPAudioCfg = CLAPAudioCfg()
    text_cfg: CLAPTextCfg = CLAPTextCfg()

maybe higher version python will throw this error, get fixed by:

from dataclasses import dataclass, field

@dataclass
class CLAPConfig:
    embed_dim: int = 1024
    audio_cfg: CLAPAudioCfg = field(default_factory=CLAPAudioCfg)
    text_cfg: CLAPTextCfg = field(default_factory=CLAPTextCfg)

@CLAassistant
Copy link

CLAassistant commented Dec 27, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

paddle-bot bot commented Dec 27, 2024

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants