Commit dcbf5e75 authored by Myle Ott's avatar Myle Ott
Browse files

Raise FileNotFoundError if dictionary files don't exist

parent fa508492
Loading
Loading
Loading
Loading
+2 −0
Changes for fairseq/dictionary.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -113,6 +113,8 @@ class Dictionary(object):
            try:
                with open(f, 'r', encoding='utf-8') as fd:
                    return Dictionary.load(fd)
            except FileNotFoundError as fnfe:
                raise fnfe
            except:
                raise Exception("Incorrect encoding detected in {}, please "
                                "rebuild the dataset".format(f))