You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Building TensorFlow can consume a lot of memory. So I prefer a small number of CPUs (`--jobs`), e.g. 4 CPUs use `--jobs=4`.
166
173
2. Limit RAM requested by bazel with `--local_ram_resources`. The value is either integer, .e.g., 2048 use `--local_ram_resources=2048` or % of total memory, e.g., 50% use `"HOST_RAM*.50"`.
167
174
3. The whole process can take up to 1 hour.
168
-
4. Add `-D_GLIBCXX_USE_CXX11_ABI=0` if you use GCC 5 or higher version.
169
-
5. Flags for optimization: `--copt="-O3"`.
170
-
6. Flasg for both AMD and Intel chips: `--copt=-mfma --copt=-msse4.1 --copt=-msse4.2 --copt=-mfpmath=both`.
171
-
7. Flags for Intel: `--copt=-mavx --copt=-mavx2`.
172
-
8. Rebuild with `--config=monolithic` if you want to compile all TensorFlow C++ code into a single shared object.
175
+
4. If you don't want Bazel creates cache files in your local space, add [`--output_user_root`](https://docs.bazel.build/versions/main/user-manual.html#flag--output_user_root) to change the directory where output and base files will be created, e.g.,
Copy file name to clipboardexpand all lines: tensorflow_serving.md
+49-5
Original file line number
Diff line number
Diff line change
@@ -3,19 +3,25 @@
3
3
## SavedModel
4
4
5
5
**Save your (keras/tf) model:**
6
-
```
6
+
```python
7
7
model.compile(...)
8
8
model.fit(...)
9
9
model.save("/path/to/your/model/folder/")
10
10
```
11
11
12
-
**Get model input:**
12
+
of you can use [`tf.saved_model.save`](https://www.tensorflow.org/api_docs/python/tf/saved_model/save) method to save object in SavedModel format at low-level:
13
+
14
+
```python
15
+
tf.saved_model.save(model, export_dir)
13
16
```
17
+
18
+
**Get model input:**
19
+
```bash
14
20
$ saved_model_cli show --tag_set serve --signature_def serving_default --dir model/
15
21
```
16
22
17
23
output:
18
-
```
24
+
```bash
19
25
The given SavedModel SignatureDef contains the following input(s):
20
26
inputs['dense_input'] tensor_info:
21
27
dtype: DT_FLOAT
@@ -29,12 +35,50 @@ The given SavedModel SignatureDef contains the following output(s):
29
35
Method name is: tensorflow/serving/predict
30
36
```
31
37
32
-
The name of input and output tensors are `serving_default_dense_input:0` and `StatefulPartitionedCall:0`, respectively
38
+
The name of input and output tensors are `serving_default_dense_input` and `StatefulPartitionedCall`, respectively
39
+
40
+
You can also use `--all` argument to get all information, like this:
41
+
42
+
```bash
43
+
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
44
+
45
+
signature_def['__saved_model_init_op']:
46
+
The given SavedModel SignatureDef contains the following input(s):
47
+
The given SavedModel SignatureDef contains the following output(s):
48
+
outputs['__saved_model_init_op'] tensor_info:
49
+
dtype: DT_INVALID
50
+
shape: unknown_rank
51
+
name: NoOp
52
+
Method name is:
53
+
54
+
signature_def['serving_default']:
55
+
The given SavedModel SignatureDef contains the following input(s):
56
+
inputs['args_0'] tensor_info:
57
+
dtype: DT_FLOAT
58
+
shape: (-1, 394)
59
+
name: serving_default_args_0:0
60
+
inputs['args_0_1'] tensor_info:
61
+
dtype: DT_FLOAT
62
+
shape: (-1, 99)
63
+
name: serving_default_args_0_1:0
64
+
The given SavedModel SignatureDef contains the following output(s):
0 commit comments