Fix 2/3 problems for training

This commit is contained in:
Matthew Honnibal 2017-03-08 01:37:52 +01:00
parent 04a51dab62
commit d108534dc2
1 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals, print_function from __future__ import unicode_literals, print_function
from os import path from os import path
from pathlib import Path
from ..util import match_best_version from ..util import match_best_version
from ..util import get_data_path from ..util import get_data_path
@ -13,6 +14,11 @@ from ..attrs import LANG
from .language_data import * from .language_data import *
try:
basestring
except NameError:
basestring = str
class English(Language): class English(Language):
lang = 'en' lang = 'en'
@ -43,14 +49,15 @@ def _fix_deprecated_glove_vectors_loading(overrides):
data_path = get_data_path() data_path = get_data_path()
else: else:
path = overrides['path'] path = overrides['path']
if isinstance(path, basestring):
path = Path(path)
data_path = path.parent data_path = path.parent
vec_path = None vec_path = None
if 'add_vectors' not in overrides: if 'add_vectors' not in overrides:
if 'vectors' in overrides: if 'vectors' in overrides:
vec_path = match_best_version(overrides['vectors'], None, data_path) vec_path = match_best_version(overrides['vectors'], None, data_path)
if vec_path is None: if vec_path is None:
raise IOError( return overrides
'Could not load data pack %s from %s' % (overrides['vectors'], data_path))
else: else:
vec_path = match_best_version('en_glove_cc_300_1m_vectors', None, data_path) vec_path = match_best_version('en_glove_cc_300_1m_vectors', None, data_path)
if vec_path is not None: if vec_path is not None: