nikitakit / self-attentive-parser

High-accuracy NLP parser with models for 11 languages.

Home Page:https://parser.kitaev.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot load model when its name unicode

suhassumukh opened this issue · comments

One of the most problematic things in Py2 is unicode and str. To backport several features, I (and so do many) usually use

from __future__ import unicode_literals

This means when I import your model benepar_en_small, I get an error.

parser = BeneparComponent("benepar_en_small")
Exception: Argument is neither a valid module name nor a path to an existing file: benepar_en_small

This is because of

            if isinstance(name, str) and '/' not in name:
                graph_def = tf.GraphDef.FromString(load_model(name))

I think making it basestring instead of just str can resolve this issue. Please let me know if this is comfortable.

This should be fixed as of the v0.1.0 release today. Thank you for reporting!

I've also addressed a lot of corner cases involving the combination of unicode_literals and other parts of the parser API, especially the NLTK integration. Please open an issue if anything else comes up!