Skip to content

Commit

Permalink
fix installation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuan Tran committed Feb 4, 2024
1 parent 5adce35 commit 822d026
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 11 deletions.
11 changes: 6 additions & 5 deletions examples/Getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@
"# We add the batch dimension to the single audio to mimic the batch watermarking\n",
"audios = audio.unsqueeze(0)\n",
"\n",
"watermark = model(audios)\n",
"watermarked_audio = audios + watermark"
"watermark = model.get_watermark(audios)\n",
"watermarked_audio = audios + watermark\n",
"\n",
"# Alternatively, you can also call forward() function directly with different tune-down / tune-up rate\n",
"watermarked_audio = model(audios, alpha=1)"
]
},
{
Expand Down Expand Up @@ -260,9 +263,7 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"watermark = model(audios, message=secret_mesage)\n",
"watermarked_audio = audios + watermark"
"watermarked_audio = model(audios, message=secret_mesage, alpha=1)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/audioseal/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from torch import device, dtype
from typing_extensions import TypeAlias

import audiocraft
from audioseal.libs import audiocraft
from audioseal.models import AudioSealDetector, AudioSealWM, MsgProcessor

Device: TypeAlias = device
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/audioseal/libs/audiocraft/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm, weight_norm
from torch.nn.utils import spectral_norm

try:
from torch.nn.utils.parametrizations import weight_norm
except ImportError:
# Old Pytorch
from torch.nn.utils import weight_norm


CONV_NORMALIZATIONS = frozenset(
["none", "weight_norm", "spectral_norm", "time_group_norm"]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import numpy as np
import torch.nn as nn

from audiocraft.modules.conv import StreamableConv1d, StreamableConvTranspose1d
from audiocraft.modules.lstm import StreamableLSTM
from audioseal.libs.audiocraft.modules.conv import (
StreamableConv1d,
StreamableConvTranspose1d,
)
from audioseal.libs.audiocraft.modules.lstm import StreamableLSTM


class SEANetResnetBlock(nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion src/audioseal/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def load_model_checkpoint(


def load_local_model_config(model_card: str) -> Optional[DictConfig]:
config_file = Path(__file__).parent.parent / "cards" / (model_card + ".yaml")
config_file = Path(__file__).parent / "cards" / (model_card + ".yaml")
if Path(config_file).is_file():
return cast(DictConfig, OmegaConf.load(config_file.resolve()))
else:
Expand Down
2 changes: 1 addition & 1 deletion src/audioseal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import torch

from audiocraft.modules.seanet import SEANetEncoder
from audioseal.libs.audiocraft.modules.seanet import SEANetEncoder


class MsgProcessor(torch.nn.Module):
Expand Down

0 comments on commit 822d026

Please sign in to comment.