Skip to content
Snippets Groups Projects
Commit b3fb984e authored by piotrmp's avatar piotrmp
Browse files

Added fallback for no pretrained model case.

parent 7b6b1b50
1 merge request!1Migration to UD 2.11
......@@ -149,7 +149,11 @@ def train_pretrained_and_save(language, treebank_path, save_path, pretrained_pat
"""
print("Loading pretrained model")
pretrained_name = 'oscar_' + language
pretrained_model = torch.load(pretrained_path / (pretrained_name + '.pth'))
file_path = pretrained_path / (pretrained_name + '.pth')
if not file_path.exists():
print("Pretrained model not found, falling back to training from scratch.")
return train_new_and_save('LAMBO-BILSTM', treebank_path, save_path, epochs, device)
pretrained_model = torch.load(file_path)
dict = {}
for line in open(pretrained_path / (pretrained_name + '.dict')):
if line.strip() == '':
......
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