torchscale/examples/fairseq/criterions/__init__.py

8 lines
317 B
Python
Raw Permalink Normal View History

2023-03-08 05:11:05 +00:00
import importlib
import os
# automatically import any Python files in the criterions/ directory
for file in sorted(os.listdir(os.path.dirname(__file__))):
if file.endswith(".py") and not file.startswith("_"):
file_name = file[: file.find(".py")]
importlib.import_module("criterions." + file_name)