Upload seamless_communication/store.py with huggingface_hub
Browse files
seamless_communication/store.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
| 2 |
+
# All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# This source code is licensed under the BSD-style license found in the
|
| 5 |
+
# MIT_LICENSE file in the root directory of this source tree.
|
| 6 |
+
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import torch
|
| 10 |
+
|
| 11 |
+
from fairseq2.assets import InProcAssetMetadataProvider, asset_store
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def add_gated_assets(model_dir: Path) -> None:
|
| 15 |
+
asset_store.env_resolvers.append(lambda: "gated")
|
| 16 |
+
|
| 17 |
+
model_dir = model_dir.resolve()
|
| 18 |
+
|
| 19 |
+
gated_metadata = [
|
| 20 |
+
{
|
| 21 |
+
"name": "seamless_expressivity@gated",
|
| 22 |
+
"checkpoint": model_dir.joinpath("m2m_expressive_unity.pt"),
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"name": "vocoder_pretssel@gated",
|
| 26 |
+
"checkpoint": model_dir.joinpath("pretssel_melhifigan_wm.pt"),
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "vocoder_pretssel_16khz@gated",
|
| 30 |
+
"checkpoint": model_dir.joinpath("pretssel_melhifigan_wm-16khz.pt"),
|
| 31 |
+
},
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
asset_store.metadata_providers.append(InProcAssetMetadataProvider(gated_metadata))
|