python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import argparse import json import logging import os from utils import file_tqdm, get_dfs, separate...
code-prediction-transformer-main
models/path_trans_variation/generate_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import argparse import json import logging import pickle import re from collections import Counter ...
code-prediction-transformer-main
models/code2seq/generate_vocab.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import json import logging import torch import utils logging.basicConfig(level=logging.INFO) UN...
code-prediction-transformer-main
models/code2seq/dataset.py
import argparse import json import os import pickle import random import re from collections import defaultdict from itertools import chain, combinations, product from utils import get_ancestors, get_terminal_nodes, parallelize, tokenize from tqdm import tqdm PLACEHOLDER = "<placeholder_token>" UNK = "<unk_token>" ...
code-prediction-transformer-main
models/code2seq/generate_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import torch from dataset.dataset import BaseDataset, BaseSetup, BaseVocab class Setup(BaseSetup):...
code-prediction-transformer-main
models/seq/dataset.py
#!/usr/bin/env python2 # Copyright (c) Facebook, Inc. and its 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. import argparse import ast import json import logging import os from collections import namedtuple ...
code-prediction-transformer-main
models/seq/generate_data.py
#!/usr/bin/env python2 # Copyright (c) Facebook, Inc. and its 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. import ast import sys import six from six import StringIO # Large float and imaginary literals ge...
code-prediction-transformer-main
models/seq/astunparser.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import torch from dataset.dataset import BaseDataset, BaseSetup, BaseVocab class Setup(BaseSetup):...
code-prediction-transformer-main
models/path_trans/dataset.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import argparse import json import logging import os from utils import file_tqdm logging.basicCon...
code-prediction-transformer-main
models/path_trans/generate_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import argparse import json import logging import os from utils import file_tqdm, separate_dps lo...
code-prediction-transformer-main
models/trav_trans/generate_ast_ids.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import torch from dataset.dataset import BaseDataset, BaseSetup, BaseVocab class Setup(BaseSetup):...
code-prediction-transformer-main
models/trav_trans/dataset.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import argparse import json import logging import os from utils import file_tqdm, get_dfs, separate...
code-prediction-transformer-main
models/trav_trans/generate_data.py
# 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 pathlib import Path from setuptools import setup, find_packages NAME = 'audiocraft' DESCRIPTION = 'Audio generati...
audiocraft-main
setup.py
# 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. """ AudioCraft is a general framework for training audio generative models. At the moment we provide the training code for...
audiocraft-main
audiocraft/__init__.py
# 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. """ Entry point for dora to launch solvers for running training loops. See more info on how to use dora: https://github.c...
audiocraft-main
audiocraft/train.py
# 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. """ Provides cluster and tools configuration across clusters (slurm, dora, utilities). """ import logging import os from...
audiocraft-main
audiocraft/environment.py
# 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. import torch import torchmetrics from ..data.audio_utils import convert_audio from ..modules.chroma import ChromaExtract...
audiocraft-main
audiocraft/metrics/chroma_cosinesim.py
# 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 pathlib import Path import typing as tp import torch import torchmetrics from transformers import RobertaTokenizer ...
audiocraft-main
audiocraft/metrics/clap_consistency.py
# 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. """Metrics like CLAP score, FAD, KLD, Visqol, Chroma similarity, etc. """ # flake8: noqa from .clap_consistency import CLA...
audiocraft-main
audiocraft/metrics/__init__.py
# 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. import logging from pathlib import Path import os import subprocess import tempfile import typing as tp from audiocraft....
audiocraft-main
audiocraft/metrics/fad.py
# 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. import contextlib from functools import partial import logging import os import typing as tp import torch import torchme...
audiocraft-main
audiocraft/metrics/kld.py
# 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. import csv import json import logging from pathlib import Path import tempfile import typing as tp import subprocess impo...
audiocraft-main
audiocraft/metrics/visqol.py
# 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. import typing as tp import torch from torch import nn import torchaudio def db_to_scale(volume: tp.Union[float, torch.T...
audiocraft-main
audiocraft/metrics/rvm.py
# 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. import math import typing as tp import torch from torch import nn from torch.nn import functional as F def _unfold(a: ...
audiocraft-main
audiocraft/losses/sisnr.py
# 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. """Loss related classes and functions. In particular the loss balancer from EnCodec, and the usual spectral losses.""" # ...
audiocraft-main
audiocraft/losses/__init__.py
# 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. # Adapted from MIT code under the original license # Copyright 2019 Tomoki Hayashi # MIT License (https://opensource.org/l...
audiocraft-main
audiocraft/losses/stftloss.py
# 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. import typing as tp import numpy as np from torchaudio.transforms import MelSpectrogram import torch from torch import n...
audiocraft-main
audiocraft/losses/specloss.py
# 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. import typing as tp import flashy import torch from torch import autograd class Balancer: """Loss balancer. T...
audiocraft-main
audiocraft/losses/balancer.py
# 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. """Adversarial losses and discriminator architectures.""" # flake8: noqa from .discriminators import ( MultiPeriodDis...
audiocraft-main
audiocraft/adversarial/__init__.py
# 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. """ Utility module to handle adversarial losses without requiring to mess up the main training loop. """ import typing a...
audiocraft-main
audiocraft/adversarial/losses.py
# 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. import typing as tp import torch import torch.nn as nn import torch.nn.functional as F from ...modules import NormConv2...
audiocraft-main
audiocraft/adversarial/discriminators/mpd.py
# 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. import typing as tp import torchaudio import torch from torch import nn from einops import rearrange from ...modules im...
audiocraft-main
audiocraft/adversarial/discriminators/msstftd.py
# 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. import typing as tp import numpy as np import torch import torch.nn as nn from ...modules import NormConv1d from .base ...
audiocraft-main
audiocraft/adversarial/discriminators/msd.py
# 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. # flake8: noqa from .mpd import MultiPeriodDiscriminator from .msd import MultiScaleDiscriminator from .msstftd import Mu...
audiocraft-main
audiocraft/adversarial/discriminators/__init__.py
# 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 abc import ABC, abstractmethod import typing as tp import torch import torch.nn as nn FeatureMapType = tp.List[to...
audiocraft-main
audiocraft/adversarial/discriminators/base.py
# 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. """ Wrapper around FSDP for more convenient use in the training loops. """ from contextlib import contextmanager import ...
audiocraft-main
audiocraft/optim/fsdp.py
# 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. # ModelEMA implementation is taken from # https://github.com/facebookresearch/demucs from collections import defaultdict...
audiocraft-main
audiocraft/optim/ema.py
# 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. """Optimization stuff. In particular, optimizers (DAdaptAdam), schedulers and Exponential Moving Average. """ # flake8: n...
audiocraft-main
audiocraft/optim/__init__.py
# 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. import logging from typing import TYPE_CHECKING, Any import torch import torch.optim import torch.distributed as dist i...
audiocraft-main
audiocraft/optim/dadam.py
# 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. import typing as tp from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler class InverseS...
audiocraft-main
audiocraft/optim/inverse_sqrt_lr_scheduler.py
# 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. import math from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler class CosineLRSchedule...
audiocraft-main
audiocraft/optim/cosine_lr_scheduler.py
# 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 torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler class PolynomialDecayLRScheduler(_L...
audiocraft-main
audiocraft/optim/polynomial_decay_lr_scheduler.py
# 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. import typing as tp from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler class LinearWa...
audiocraft-main
audiocraft/optim/linear_warmup_lr_scheduler.py
# 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. """ All the functions to build the relevant solvers and used objects from the Hydra config. """ from enum import Enum im...
audiocraft-main
audiocraft/solvers/builders.py
# 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. import typing as tp import flashy import julius import omegaconf import torch import torch.nn.functional as F from . im...
audiocraft-main
audiocraft/solvers/diffusion.py
# 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 pathlib import Path import time import typing as tp import flashy import math import omegaconf import torch from to...
audiocraft-main
audiocraft/solvers/musicgen.py
# 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. import logging import multiprocessing from pathlib import Path import typing as tp import flashy import omegaconf import...
audiocraft-main
audiocraft/solvers/compression.py
# 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. """ Solvers. A Solver is a training recipe, combining the dataloaders, models, optimizer, losses etc into a single conveni...
audiocraft-main
audiocraft/solvers/__init__.py
# 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 . import builders, musicgen class AudioGenSolver(musicgen.MusicGenSolver): """Solver for AudioGen re-implement...
audiocraft-main
audiocraft/solvers/audiogen.py
# 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 abc import ABC, abstractmethod from contextlib import contextmanager from pathlib import Path import typing as tp i...
audiocraft-main
audiocraft/solvers/base.py
# 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 enum import Enum import logging from pathlib import Path import re import typing as tp import flashy import torch ...
audiocraft-main
audiocraft/utils/checkpoint.py
# 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. import logging import os from queue import Queue, Empty import signal import sys import threading import traceback logge...
audiocraft-main
audiocraft/utils/deadlock.py
# 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. """ Legacy functions used at the time of the first release, kept for referencd. """ from pathlib import Path import typi...
audiocraft-main
audiocraft/utils/export_legacy.py
# 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. import torch class TorchAutocast: """TorchAutocast utility class. Allows you to enable and disable autocast. Th...
audiocraft-main
audiocraft/utils/autocast.py
# 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 collections import defaultdict import logging import typing as tp import flashy import torch from ..optim import M...
audiocraft-main
audiocraft/utils/best_state.py
# 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 concurrent.futures import ThreadPoolExecutor from collections import deque from functools import partial from hashli...
audiocraft-main
audiocraft/utils/cache.py
# 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. """Utilities."""
audiocraft-main
audiocraft/utils/__init__.py
# 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. """ Utility to export a training checkpoint to a lightweight release checkpoint. """ from pathlib import Path import typ...
audiocraft-main
audiocraft/utils/export.py
# 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 concurrent.futures import ProcessPoolExecutor from contextlib import contextmanager from functools import wraps, lru...
audiocraft-main
audiocraft/utils/utils.py
# 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. """ Utility functions for SLURM configuration and cluster settings. """ from enum import Enum import os import socket im...
audiocraft-main
audiocraft/utils/cluster.py
# 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. try: import IPython.display as ipd # type: ignore except ImportError: # Note in a notebook... pass import ...
audiocraft-main
audiocraft/utils/notebook.py
# 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. import logging import typing as tp import dora import torch logger = logging.getLogger(__name__) class Profiler: ...
audiocraft-main
audiocraft/utils/profiler.py
# 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.
audiocraft-main
audiocraft/utils/samples/__init__.py
# 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. """ API that can manage the storage and retrieval of generated samples produced by experiments. It offers the following ...
audiocraft-main
audiocraft/utils/samples/manager.py
# 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. """Dora Grids."""
audiocraft-main
audiocraft/grids/__init__.py
# 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 abc import ABC, abstractmethod import time import typing as tp from dora import Explorer import treetable as tt de...
audiocraft-main
audiocraft/grids/_base_explorers.py
# 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. import treetable as tt from .._base_explorers import BaseExplorer class DiffusionExplorer(BaseExplorer): eval_metr...
audiocraft-main
audiocraft/grids/diffusion/_explorers.py
# 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. """Diffusion grids."""
audiocraft-main
audiocraft/grids/diffusion/__init__.py
# 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. """ Training of the 4 diffusion models described in "From Discrete Tokens to High-Fidelity Audio Using Multi-Band Diffusi...
audiocraft-main
audiocraft/grids/diffusion/4_bands_base_32khz.py
# 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 ._explorers import LMExplorer from ...environment import AudioCraftEnvironment @LMExplorer def explorer(launcher):...
audiocraft-main
audiocraft/grids/musicgen/musicgen_melody_32khz.py
# 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. import typing as tp import treetable as tt from .._base_explorers import BaseExplorer class LMExplorer(BaseExplorer):...
audiocraft-main
audiocraft/grids/musicgen/_explorers.py
# 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. """MusicGen grids."""
audiocraft-main
audiocraft/grids/musicgen/__init__.py
# 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 ._explorers import LMExplorer from ...environment import AudioCraftEnvironment @LMExplorer def explorer(launcher):...
audiocraft-main
audiocraft/grids/musicgen/musicgen_clapemb_32khz.py
# 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. """ Evaluation with objective metrics for the pretrained MusicGen models. This grid takes signature from the training gri...
audiocraft-main
audiocraft/grids/musicgen/musicgen_pretrained_32khz_eval.py
# 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 ._explorers import LMExplorer from ...environment import AudioCraftEnvironment @LMExplorer def explorer(launcher):...
audiocraft-main
audiocraft/grids/musicgen/musicgen_base_32khz.py
# 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 ._explorers import LMExplorer from ...environment import AudioCraftEnvironment @LMExplorer def explorer(launcher):...
audiocraft-main
audiocraft/grids/musicgen/musicgen_base_cached_32khz.py
# 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. import treetable as tt from .._base_explorers import BaseExplorer class CompressionExplorer(BaseExplorer): eval_me...
audiocraft-main
audiocraft/grids/compression/_explorers.py
# 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. """ Grid search file, simply list all the exp you want in `explorer`. Any new exp added there will be scheduled. You can ...
audiocraft-main
audiocraft/grids/compression/encodec_audiogen_16khz.py
# 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. """EnCodec grids."""
audiocraft-main
audiocraft/grids/compression/__init__.py
# 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. """ Grid search file, simply list all the exp you want in `explorer`. Any new exp added there will be scheduled. You can ...
audiocraft-main
audiocraft/grids/compression/encodec_musicgen_32khz.py
# 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. """ Grid search file, simply list all the exp you want in `explorer`. Any new exp added there will be scheduled. You can ...
audiocraft-main
audiocraft/grids/compression/encodec_base_24khz.py
# 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. """ Grid search file, simply list all the exp you want in `explorer`. Any new exp added there will be scheduled. You can ...
audiocraft-main
audiocraft/grids/compression/debug.py
# 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. """AudioGen grids."""
audiocraft-main
audiocraft/grids/audiogen/__init__.py
# 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 ..musicgen._explorers import LMExplorer from ...environment import AudioCraftEnvironment @LMExplorer def explorer(...
audiocraft-main
audiocraft/grids/audiogen/audiogen_base_16khz.py
# 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. """ Evaluation with objective metrics for the pretrained AudioGen models. This grid takes signature from the training gri...
audiocraft-main
audiocraft/grids/audiogen/audiogen_pretrained_16khz_eval.py
# 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. """ All the functions to build the relevant models and modules from the Hydra config. """ import typing as tp import au...
audiocraft-main
audiocraft/models/builders.py
# 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. """ Main model for using MusicGen. This will combine all the required components and provide easy access to the generatio...
audiocraft-main
audiocraft/models/musicgen.py
# 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. """ Pytorch Unet Module used for diffusion. """ from dataclasses import dataclass import typing as tp import torch from...
audiocraft-main
audiocraft/models/unet.py
# 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. """ Utility functions to load from the checkpoints. Each checkpoint is a torch.saved dict with the following keys: - 'xp....
audiocraft-main
audiocraft/models/loaders.py
# 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. """ Models for EnCodec, AudioGen, MusicGen, as well as the generic LMModel. """ # flake8: noqa from . import builders, loa...
audiocraft-main
audiocraft/models/__init__.py
# 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. """ Multi Band Diffusion models as described in "From Discrete Tokens to High-Fidelity Audio Using Multi-Band Diffusion" ...
audiocraft-main
audiocraft/models/multibanddiffusion.py
# 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. """ Main model for using AudioGen. This will combine all the required components and provide easy access to the generatio...
audiocraft-main
audiocraft/models/audiogen.py
# 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 dataclasses import dataclass from functools import partial import logging import math import typing as tp import to...
audiocraft-main
audiocraft/models/lm.py
# 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. """Compression models or wrapper around existing models. Also defines the main interface that a model must follow to be us...
audiocraft-main
audiocraft/models/encodec.py
# 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. import math import typing as tp import torch from .base import BaseQuantizer, QuantizedResult from .core_vq import Resi...
audiocraft-main
audiocraft/quantization/vq.py
# 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. """RVQ.""" # flake8: noqa from .vq import ResidualVectorQuantizer from .base import BaseQuantizer, DummyQuantizer, Quantiz...
audiocraft-main
audiocraft/quantization/__init__.py
# 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. import typing as tp from einops import rearrange, repeat import flashy import torch from torch import nn, einsum import ...
audiocraft-main
audiocraft/quantization/core_vq.py
# 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. """ Base class for all quantizers. """ from dataclasses import dataclass, field import typing as tp import torch from t...
audiocraft-main
audiocraft/quantization/base.py
# 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. import typing as tp import numpy as np import torch.nn as nn from .conv import StreamableConv1d, StreamableConvTranspos...
audiocraft-main
audiocraft/modules/seanet.py
# 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. import torch import torch.nn as nn from torch import Tensor from typing import Union, Callable class CustomGLU(nn.Modul...
audiocraft-main
audiocraft/modules/activations.py