Stability-AI / stable-audio-tools

Generative models for conditional audio generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UNet1DUncondWrapper Initialization error due to missing in_channels argument

fred-dev opened this issue · comments

UNet1DUncondWrapper Initialization error due to missing in_channels argument

Description

I encountered an issue where the diffusion config does not appear to be passed correctly to UNet1DUncondWrapper from create_diffusion_uncond_from_config.

Despite specifying the in_channels in the diffusion configuration, the initialization of UNet1DUncondWrapper fails with an argument missing error.

Steps to Reproduce

  1. Use the following model configuration:

    {
      "model_type": "diffusion_uncond",
      "sample_size": 524288,
      "sample_rate": 44100,
      "audio_channels": 1,
      "model": {
        "type": "adp_uncond_1d",
        "diffusion": {
          "config": {
            "in_channels": 64
          }
        },
        "pretransform": {
          "type": "dac_pretrained",
          "config": {}
        },
        "training": {
          "learning_rate": 0.00004,
          "demo": {
            "demo_every": 1500,
            "demo_steps": 100,
            "num_demos": 1
          }
        }
      }
    }
  2. Pass this config to train.py (this configuration is incomplete, but offered as a minimal example as it produces the error reliably.

Expected Behavior

The model initialises and the in_channels parameter is set from the config.

Actual Behavior

The model initialization fails with the following error message:

```plaintext
File "/content/stable-audio-tools/stable_audio_tools/models/diffusion.py", line 568, in create_diffusion_uncond_from_config
    model = UNet1DUncondWrapper(
TypeError: __init__() missing 1 required positional argument: 'in_channels'
```

It seems that the diffusion:config may not be being properly passed to UNet1DUncondWrapper. Despite in_channels being explicitly defined and set, the value is not recognised.

Note, this can be bypassed by removing the diffusion key in the JSON and moving the config up a level in the structure. However, this is a different configuration to what seems 'standardised' across other configs, such as the conditional config.