浏览代码

Fix breaking fairseq2 API changes (#119)

Can Balioglu 1 年之前
父节点
当前提交
00b066c6f8

+ 3 - 5
src/seamless_communication/__init__.py

@@ -6,17 +6,15 @@
 
 from pathlib import Path
 
-from fairseq2.assets import LocalAssetCardStorage, asset_store
+from fairseq2.assets import FileAssetMetadataProvider, asset_store
 
 __version__ = "0.1.0"
 
 
 def _update_asset_store() -> None:
-    pathname = Path(__file__).parent.joinpath("cards")
+    cards_dir = Path(__file__).parent.joinpath("cards")
 
-    card_storage = LocalAssetCardStorage(pathname)
-
-    asset_store.add_storage(card_storage)
+    asset_store.metadata_providers.append(FileAssetMetadataProvider(cards_dir))
 
 
 _update_asset_store()

+ 1 - 0
src/seamless_communication/cards/mintox.yaml

@@ -4,6 +4,7 @@
 # This source code is licensed under the license found in the
 # LICENSE file in the root directory of this source tree.
 
+name: mintox
 model_name: MinTox
 etox_dataset: https://dl.fbaipublicfiles.com/nllb/NLLB-200_TWL/nllb-200_twl.zip
 etox_lang_variants:

+ 1 - 0
src/seamless_communication/cards/unity_nllb-100.yaml

@@ -4,6 +4,7 @@
 # This source code is licensed under the BSD-style license found in the
 # LICENSE file in the root directory of this source tree.
 
+name: unity_nllb-100
 model_type: unity
 tokenizer: "https://huggingface.co/facebook/seamless-m4t-large/resolve/main/tokenizer.model"
 default_lang: eng

+ 1 - 0
src/seamless_communication/cards/unity_nllb-200.yaml

@@ -4,6 +4,7 @@
 # This source code is licensed under the BSD-style license found in the
 # LICENSE file in the root directory of this source tree.
 
+name: unity_nllb-200
 model_type: unity
 tokenizer: "https://huggingface.co/facebook/seamless-m4t-medium/resolve/main/tokenizer.model"
 default_lang: eng