Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/open-mmlab/Amphion
01 April 2026, 10:44:45 UTC
  • Code
  • Branches (2)
  • Releases (3)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/heads/revert-154-FACodec-readme
    • v0.1.1-alpha
    • v0.1.0-alpha
    • v0.1.0
  • 320c54d
  • /
  • bins
  • /
  • vocoder
  • /
  • inference.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
  • release
origin badgecontent badge
swh:1:cnt:38502a9a8813377652fda1f8d27cdde47fa95689
origin badgedirectory badge
swh:1:dir:8fb17b3ca280b60a0e018bcf2b361696671516a2
origin badgerevision badge
swh:1:rev:a4c23e2e1f15e4be0b0c7194e6b69a82a4bb4a07
origin badgesnapshot badge
swh:1:snp:fc8cecae7657ff85d660f8ea19d9339e78426c63
origin badgerelease badge
swh:1:rel:acb10df35ee6dcf0c0dcb3216afce897fb0bc227

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
  • release
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: a4c23e2e1f15e4be0b0c7194e6b69a82a4bb4a07 authored by Xueyao Zhang on 18 December 2023, 14:14:33 UTC
Amphion v0.1 Release (#39)
Tip revision: a4c23e2
inference.py
# Copyright (c) 2023 Amphion.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import argparse
import os

import torch

from models.vocoders.vocoder_inference import VocoderInference
from utils.util import load_config


def build_inference(args, cfg, infer_type="infer_from_dataset"):
    supported_inference = {
        "GANVocoder": VocoderInference,
    }

    inference_class = supported_inference[cfg.model_type]
    return inference_class(args, cfg, infer_type)


def cuda_relevant(deterministic=False):
    torch.cuda.empty_cache()
    # TF32 on Ampere and above
    torch.backends.cuda.matmul.allow_tf32 = True
    torch.backends.cudnn.enabled = True
    torch.backends.cudnn.allow_tf32 = True
    # Deterministic
    torch.backends.cudnn.deterministic = deterministic
    torch.backends.cudnn.benchmark = not deterministic
    torch.use_deterministic_algorithms(deterministic)


def build_parser():
    r"""Build argument parser for inference.py.
    Anything else should be put in an extra config YAML file.
    """

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        type=str,
        required=True,
        help="JSON/YAML file for configurations.",
    )
    parser.add_argument(
        "--infer_mode",
        type=str,
        required=None,
    )
    parser.add_argument(
        "--infer_datasets",
        nargs="+",
        default=None,
    )
    parser.add_argument(
        "--feature_folder",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--audio_folder",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--vocoder_dir",
        type=str,
        required=True,
        help="Vocoder checkpoint directory. Searching behavior is the same as "
        "the acoustics one.",
    )
    parser.add_argument(
        "--output_dir",
        type=str,
        default="result",
        help="Output directory. Default: ./result",
    )
    parser.add_argument(
        "--log_level",
        type=str,
        default="warning",
        help="Logging level. Default: warning",
    )
    parser.add_argument(
        "--keep_cache",
        action="store_true",
        default=False,
        help="Keep cache files. Only applicable to inference from files.",
    )
    return parser


def main():
    # Parse arguments
    args = build_parser().parse_args()

    # Parse config
    cfg = load_config(args.config)

    # CUDA settings
    cuda_relevant()

    # Build inference
    trainer = build_inference(args, cfg, args.infer_mode)

    # Run inference
    trainer.inference()


if __name__ == "__main__":
    main()

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API