added licensing info

This commit is contained in:
zr_jin 2024-10-21 10:55:27 +08:00
parent 283157268a
commit d752230287
18 changed files with 88 additions and 29 deletions

View File

@ -1,3 +1,21 @@
#!/usr/bin/env python3
# Copyright 2024 The Chinese University of HK (Author: Zengrui Jin)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List, Tuple from typing import List, Tuple
import torch import torch
@ -222,17 +240,12 @@ class DiscriminatorSTFT(nn.Module):
def forward(self, x: torch.Tensor): def forward(self, x: torch.Tensor):
fmap = [] fmap = []
# print('x ', x.shape)
z = self.spec_transform(x) # [B, 2, Freq, Frames, 2] z = self.spec_transform(x) # [B, 2, Freq, Frames, 2]
# print('z ', z.shape)
z = torch.cat([z.real, z.imag], dim=1) z = torch.cat([z.real, z.imag], dim=1)
# print('cat_z ', z.shape)
z = rearrange(z, "b c w t -> b c t w") z = rearrange(z, "b c w t -> b c t w")
for i, layer in enumerate(self.convs): for i, layer in enumerate(self.convs):
z = layer(z) z = layer(z)
z = self.activation(z) z = self.activation(z)
# print('z i', i, z.shape)
fmap.append(z) fmap.append(z)
z = self.conv_post(z) z = self.conv_post(z)
# print('logit ', z.shape)
return z, fmap return z, fmap

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Raw binary format for Encodec compressed audio. Actual compression API is in `encodec.compress`.""" """Raw binary format for Encodec compressed audio. Actual compression API is in `encodec.compress`."""
import io import io

View File

@ -1,3 +1,9 @@
# 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.
from typing import List from typing import List
import torch import torch

View File

@ -1,3 +1,20 @@
#!/usr/bin/env python3
# Copyright 2024 The Chinese University of HK (Author: Zengrui Jin)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import math import math
import random import random
from typing import List, Optional from typing import List, Optional

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Torch modules.""" """Torch modules."""
# flake8: noqa # flake8: noqa
from .conv import ( from .conv import (

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Convolutional layers wrappers and utilities.""" """Convolutional layers wrappers and utilities."""
import logging import logging
import math import math

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""LSTM layers module.""" """LSTM layers module."""
from torch import nn from torch import nn

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Normalization modules.""" """Normalization modules."""
from typing import List, Union from typing import List, Union

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Encodec SEANet-based encoder and decoder implementation.""" """Encodec SEANet-based encoder and decoder implementation."""
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""A streamable transformer.""" """A streamable transformer."""
import typing as tp import typing as tp
from typing import Any, List, Optional, Union from typing import Any, List, Optional, Union

View File

@ -2,6 +2,6 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
# flake8: noqa # flake8: noqa
from .vq import QuantizedResult, ResidualVectorQuantizer from .vq import QuantizedResult, ResidualVectorQuantizer

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Arithmetic coder.""" """Arithmetic coder."""
import io import io
import math import math

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Torch distributed utilities.""" """Torch distributed utilities."""
from typing import Dict, Iterable, List from typing import Dict, Iterable, List

View File

@ -2,7 +2,7 @@
# All rights reserved. # All rights reserved.
# #
# This source code is licensed under the license found in the # This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file at https://github.com/facebookresearch/encodec/blob/main/LICENSE
"""Residual vector quantizer implementation.""" """Residual vector quantizer implementation."""
import math import math
from dataclasses import dataclass, field from dataclasses import dataclass, field

View File

@ -1,3 +1,8 @@
# original implementation is from https://github.com/ZhikangNiu/encodec-pytorch/blob/main/scheduler.py
# Copyright 2024 Zhi-Kang Niu
# MIT License
import math import math
from bisect import bisect_right from bisect import bisect_right

View File

@ -1,3 +1,21 @@
#!/usr/bin/env python3
# Copyright 2023 Xiaomi Corp. (Author: Zengwei Yao)
# 2024 The Chinese University of HK (Author: Zengrui Jin)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse import argparse
import itertools import itertools
import logging import logging