Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/workflows/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ model.set_lora_strength(0.0) # Disable without unloading
# With multiple LoRAs, target by index:
model.set_lora_strength(1.0, lora_index=0)
model.set_lora_strength(0.3, lora_index=1)

# Target only the Diffusion Transformer backbone or conditioner independently:
model.set_lora_strength(1.0, target="dit")
model.set_lora_strength(0.0, target="conditioner")
```

For full details on LoRA training see [LoRA Training](lora.md).
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ exclude = [
"stable_audio_3/interface",
"stable_audio_3/data",
"stable_audio_3/training",
"optimized",
]
Empty file removed scripts/optimized/.gitkeep
Empty file.
12 changes: 6 additions & 6 deletions stable_audio_3/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, model, model_config, device, model_half):
torch.backends.cudnn.benchmark = False

@staticmethod
def from_pretrained(model_name_or_path, device=None, model_half=True):
def from_pretrained(model_name, device=None, model_half=True):
# Load the model and any necessary components here
if device is None and torch.cuda.is_available():
device = "cuda"
Expand All @@ -38,18 +38,18 @@ def from_pretrained(model_name_or_path, device=None, model_half=True):
device = "cpu"

if not torch.cuda.is_available():
if model_name_or_path in ("medium", "medium-base"):
if model_name in ("medium", "medium-base"):
print(
f"Warning: You are loading the {model_name_or_path} model without a GPU. This model is not designed to run on cpu"
f"Warning: You are loading the {model_name} model without a GPU. This model is not designed to run on cpu"
)
model_half = False

if model_name_or_path not in all_models:
if model_name not in all_models:
raise ValueError(
f"Unknown model '{model_name_or_path}'. Valid models: {list(all_models)}"
f"Unknown model '{model_name}'. Valid models: {list(all_models)}"
)

model_cfg = all_models[model_name_or_path]
model_cfg = all_models[model_name]
local_config, local_ckpt = model_cfg.resolve()
with open(local_config) as f:
model_config = json.load(f)
Expand Down
4 changes: 2 additions & 2 deletions stable_audio_3/models/dit.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,11 @@ def apg_project(self, v0, v1, padding_mask=None):
If provided, only valid positions contribute to the projection.
"""
dtype = v0.dtype
v0, v1 = v0.double(), v1.double()
v0, v1 = v0.float(), v1.float()

if padding_mask is not None:
# Expand mask to match tensor shape: (B, T) -> (B, 1, T)
mask = padding_mask.unsqueeze(1).double()
mask = padding_mask.unsqueeze(1).float()
# Zero out padding positions for projection computation
v0_masked = v0 * mask
v1_masked = v1 * mask
Expand Down
Loading