Commit 0563d879 authored by Ilia Kulikov's avatar Ilia Kulikov Committed by Facebook Github Bot
Browse files

ignore files starting with . e.g. .ipynb_checkpoints (#819)

Summary:
.ipynb_checkpoints folder in models folders crashed the importlib
now there is a check for this
Pull Request resolved: https://github.com/fairinternal/fairseq-py/pull/819

Differential Revision: D16772192

Pulled By: myleott

fbshipit-source-id: 01c956aef4ed312bc7645c31c83dbf98af89d931
parent d0036640
...@@ -123,7 +123,7 @@ def register_model_architecture(model_name, arch_name): ...@@ -123,7 +123,7 @@ def register_model_architecture(model_name, arch_name):
models_dir = os.path.dirname(__file__) models_dir = os.path.dirname(__file__)
for file in os.listdir(models_dir): for file in os.listdir(models_dir):
path = os.path.join(models_dir, file) path = os.path.join(models_dir, file)
if not file.startswith('_') and (file.endswith('.py') or os.path.isdir(path)): if not file.startswith('_') and not file.startswith('.') and (file.endswith('.py') or os.path.isdir(path)):
model_name = file[:file.find('.py')] if file.endswith('.py') else file model_name = file[:file.find('.py')] if file.endswith('.py') else file
module = importlib.import_module('fairseq.models.' + model_name) module = importlib.import_module('fairseq.models.' + model_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment