1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

fix readthedocs module load

This commit is contained in:
Jin Yong Yoo
2020-11-14 13:20:36 -05:00
parent 48d89d6f17
commit 0fad7f1c2a
2 changed files with 4 additions and 3 deletions

View File

@@ -17,3 +17,5 @@ python:
- requirements: requirements.txt
- method: pip
path: .
extra_requirements:
- docs

View File

@@ -10,8 +10,7 @@ import sys
from textattack.shared.utils import LazyLoader
tf = LazyLoader("tensorflow", globals(), "tensorflow")
from google.protobuf import text_format # noqa: E402
protobuf = LazyLoader("google.protobuf", globals(), "google.protobuf")
def LoadModel(sess, graph, gd_file, ckpt_file):
@@ -30,7 +29,7 @@ def LoadModel(sess, graph, gd_file, ckpt_file):
with tf.io.gfile.GFile(gd_file) as f:
s = f.read()
gd = tf.compat.v1.GraphDef()
text_format.Merge(s, gd)
protobuf.text_format.Merge(s, gd)
tf.compat.v1.logging.info("Recovering Graph %s", gd_file)
t = {}