Skip to content

Commit 0fc04d9

Browse files
Remove hub from tests (#8563)
1 parent 0ef019b commit 0fc04d9

File tree

3 files changed

+36
-74
lines changed

3 files changed

+36
-74
lines changed

tfjs-converter/python/test_nightly_pip_package.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,6 @@ def tearDown(self):
4747
shutil.rmtree(self._tmp_dir)
4848
super(APIAndShellTest, self).tearDown()
4949

50-
def testConvertTfHubMobileNetV2ToTfjsGraphModel(self):
51-
# 1. Convert tfhub mobilenet v2 module.
52-
tfhub_url = (
53-
'https://tfhub.dev/google/imagenet/mobilenet_v2_100_224'
54-
'/classification/3'
55-
)
56-
graph_model_output_dir = os.path.join(self._tmp_dir, 'tfjs_graph')
57-
process = subprocess.Popen([
58-
'tensorflowjs_converter', '--input_format', 'tf_hub',
59-
tfhub_url, graph_model_output_dir
60-
])
61-
process.communicate()
62-
self.assertEqual(0, process.returncode)
63-
64-
# 2. Check the files that belong to the conversion result.
65-
files = glob.glob(os.path.join(graph_model_output_dir, '*'))
66-
self.assertIn(os.path.join(graph_model_output_dir, 'model.json'), files)
67-
weight_files = glob.glob(
68-
os.path.join(graph_model_output_dir, 'group*.bin'))
69-
self.assertEqual(len(weight_files), 4)
70-
7150
def testConvertMobileNetV2ModelToTfjsGraphModel(self):
7251
"""create the keras mobilenet v2 model."""
7352
# 1. Create a saved model from keras mobilenet v2.

tfjs-converter/python/test_pip_package.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from tensorflow.python.tools import freeze_graph
3737
from tensorflow.python.trackable import autotrackable
3838
from tensorflow.python.saved_model.save import save
39-
import tensorflow_hub as hub
4039

4140
import tensorflowjs as tfjs
4241

@@ -124,27 +123,6 @@ def _createTensorFlowSavedModel(save_path):
124123

125124
save(root, save_path, to_save)
126125

127-
128-
def _create_hub_module(save_path):
129-
"""Create a TensorFlow Hub module for testing.
130-
131-
Args:
132-
save_path: The directory path in which to save the model.
133-
"""
134-
# Module function that doubles its input.
135-
def double_module_fn():
136-
w = tf.Variable([2.0, 4.0])
137-
x = tf.compat.v1.placeholder(dtype=tf.float32)
138-
hub.add_signature(inputs=x, outputs=x*w)
139-
graph = tf.Graph()
140-
with graph.as_default():
141-
spec = hub.create_module_spec(double_module_fn)
142-
m = hub.Module(spec)
143-
# Export the module.
144-
with tf.compat.v1.Session(graph=graph) as sess:
145-
sess.run(tf.compat.v1.global_variables_initializer())
146-
m.export(save_path, sess)
147-
148126
def _create_frozen_model(save_path):
149127
graph = tf.Graph()
150128
saved_model_dir = os.path.join(save_path)
@@ -198,7 +176,6 @@ def setUpClass(cls):
198176
_createTensorFlowSavedModelV1('b', cls.tf_saved_model_v1_dir)
199177
_create_frozen_model(cls.tf_frozen_model_dir)
200178
cls.tf_hub_module_dir = os.path.join(cls.class_tmp_dir, 'tf_hub_module')
201-
_create_hub_module(cls.tf_hub_module_dir)
202179

203180
@classmethod
204181
def tearDownClass(cls):
@@ -456,32 +433,6 @@ def testConvertTFSavedModelV1WithCommandLineWorks(self):
456433
# Check the content of the output directory.
457434
self.assertTrue(glob.glob(os.path.join(output_dir, 'group*-*')))
458435

459-
460-
def testConvertTFHubModuleWithCommandLineWorks(self):
461-
output_dir = os.path.join(self._tmp_dir)
462-
process = subprocess.Popen([
463-
'tensorflowjs_converter', '--input_format', 'tf_hub',
464-
self.tf_hub_module_dir, output_dir
465-
])
466-
process.communicate()
467-
self.assertEqual(0, process.returncode)
468-
469-
weights = [{
470-
'paths': ['group1-shard1of1.bin'],
471-
'weights': [{
472-
'shape': [2],
473-
'name': 'module/Variable',
474-
'dtype': 'float32'
475-
}]
476-
}]
477-
# Load the saved weights as a JSON string.
478-
output_json = json.load(
479-
open(os.path.join(output_dir, 'model.json'), 'rt'))
480-
self.assertEqual(output_json['weightsManifest'], weights)
481-
482-
# Check the content of the output directory.
483-
self.assertTrue(glob.glob(os.path.join(output_dir, 'group*-*')))
484-
485436
def testConvertTFSavedModelWithCommandLineWorks(self):
486437
output_dir = os.path.join(self._tmp_dir)
487438
process = subprocess.Popen([

tfjs-converter/yarn.lock

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,22 @@
6767

6868
"@tensorflow/tfjs-backend-cpu@link:../link-package/node_modules/@tensorflow/tfjs-backend-cpu":
6969
version "0.0.0"
70+
uid ""
7071

7172
"@tensorflow/tfjs-core@link:../link-package/node_modules/@tensorflow/tfjs-core":
7273
version "0.0.0"
74+
uid ""
7375

7476
"@types/argparse@^1.0.38":
7577
version "1.0.38"
7678
resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9"
7779
integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==
7880

81+
"@types/long@^4.0.1":
82+
version "4.0.2"
83+
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
84+
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==
85+
7986
"@types/long@~3.0.32":
8087
version "3.0.32"
8188
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69"
@@ -93,6 +100,21 @@
93100
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.38.tgz#f8bb07c371ccb1903f3752872c89f44006132947"
94101
integrity sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g==
95102

103+
"@types/offscreencanvas@~2019.7.0":
104+
version "2019.7.3"
105+
resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz#90267db13f64d6e9ccb5ae3eac92786a7c77a516"
106+
integrity sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==
107+
108+
"@types/seedrandom@^2.4.28":
109+
version "2.4.34"
110+
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.34.tgz#c725cd0fc0442e2d3d0e5913af005686ffb7eb99"
111+
integrity sha512-ytDiArvrn/3Xk6/vtylys5tlY6eo7Ane0hvcx++TKo6RxQXuVfW0AF/oeWqAj9dN29SyhtawuXstgmPlwNcv/A==
112+
113+
114+
version "0.1.38"
115+
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
116+
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
117+
96118
ansi-regex@^5.0.1:
97119
version "5.0.1"
98120
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
@@ -277,6 +299,11 @@ jsonfile@^4.0.0:
277299
optionalDependencies:
278300
graceful-fs "^4.1.6"
279301

302+
303+
version "4.0.0"
304+
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
305+
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
306+
280307
long@^5.0.0:
281308
version "5.2.3"
282309
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
@@ -370,6 +397,11 @@ require-directory@^2.1.1:
370397
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
371398
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
372399

400+
seedrandom@^3.0.5:
401+
version "3.0.5"
402+
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7"
403+
integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==
404+
373405
source-map-support@^0.5.6:
374406
version "0.5.19"
375407
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
@@ -427,10 +459,10 @@ ts-node@~8.8.2:
427459
source-map-support "^0.5.6"
428460
yn "3.1.1"
429461

430-
typescript@4.9.4:
431-
version "4.9.4"
432-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78"
433-
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==
462+
typescript@5.0.4:
463+
version "5.0.4"
464+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
465+
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
434466

435467
universalify@^0.1.0:
436468
version "0.1.2"

0 commit comments

Comments
 (0)