大家好,我希望您一切都好。我想使用张量流预训练模型。从youtube和文章中我知道,首先我必须通过bazel建立tensorflow。我阅读了bazel的github仓库,并尝试构建tensorflow。
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
几乎在3小时后建立了张量流 bazel-bin \ tensorflow \ tools \ pip_package \ build_pip_package C:/ tmp / tensorflow_pkg 我现在要为张量流构建一个轮子。
您是否想重写本征强内联以减少某些C ++编译 编译时间? [是/否]: 本征强内联被覆盖。
E:\tensorflow1\tensorflow>python ./configure.pyC:\tensorflow> bazel build --conf
ig=opt //tensorflow/tools/pip_package:build_pip_package
python: can't open file './configure.pyC:\tensorflow': [Errno 22] Invalid argume
nt
E:\tensorflow1\tensorflow>python ./configure.pyC:\tensorflow> bazel build --conf
ig=opt //tensorflow/tools/pip_package:build_pip_package
python: can't open file './configure.pyC:\tensorflow': [Errno 22] Invalid argume
nt
E:\tensorflow1\tensorflow>bazel build --config=opt --config=cuda //tensorflow/to
ols/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
..................
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
currently loading: tensorflow/tools/pip_package
ERROR: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/local_config_cuda/crossto
ol/BUILD:4:1: Traceback (most recent call last):
File "C:/users/sohaib/_bazel_sohaib/qv3765pc/external/local_config_cuda/
crosstool/BUILD", line 4
error_gpu_disabled()
File "C:/users/sohaib/_bazel_sohaib/qv3765pc/external/local_config_cuda/
crosstool/error_gpu_disabled.bzl", line 3, in error_gpu_disabled
fail("ERROR: Building with --config=c...")
ERROR: Building with --config=cuda but TensorFlow is not configured to build wit
h GPU support. Please re-run ./configure and enter 'Y' at the prompt to build wi
th GPU support.
ERROR: no such target '@local_config_cuda//crosstool:toolchain': target 'toolcha
in' not declared in package 'crosstool' defined by C:/users/sohaib/_bazel_sohaib
/qv3765pc/external/local_config_cuda/crosstool/BUILD
INFO: Elapsed time: 17.156s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded)
FAILED: Build did NOT complete successfully (2 packages loaded)
E:\tensorflow1\tensorflow>bazel build --config=opt //tensorflow/tools/pip_packag
e:build_pip_package
Loading:
Loading: 0 packages loaded
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (1 packages l
oaded)
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest
Visual C++ installed.
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variabl
es, eg. VS140COMNTOOLS
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x8
6)\Microsoft Visual Studio 14.0\VC\
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (1 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (4 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (5 packages l
oaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (106 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (118 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (122 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (130 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (137 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (137 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (139 packages
loaded)
ERROR: E:/tensorflow1/tensorflow/tensorflow/tools/pip_package/BUILD:131:1: no su
ch package '@png_archive//': Traceback (most recent call last):
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 106
_apply_patch(ctx, ctx.attr.patch_file)
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 73, in _appl
y_patch
_execute_and_check_ret_code(ctx, cmd)
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 52, in _exec
ute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(256) when executing 'c:\msys64\usr\bin\bash.exe -l -c patch
-p1 -d C:/users/sohaib/_bazel_sohaib/qv3765pc/external/png_archive -i E:/tensor
flow1/tensorflow/third_party/png_fix_rpi.patch':
Stdout:
Stderr: Timed out and referenced by '//tensorflow/tools/pip_package:licenses'
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' fai
led; build aborted: no such package '@png_archive//': Traceback (most recent cal
l last):
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 106
_apply_patch(ctx, ctx.attr.patch_file)
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 73, in _appl
y_patch
_execute_and_check_ret_code(ctx, cmd)
File "E:/tensorflow1/tensorflow/third_party/repo.bzl", line 52, in _exec
ute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(256) when executing 'c:\msys64\usr\bin\bash.exe -l -c patch
-p1 -d C:/users/sohaib/_bazel_sohaib/qv3765pc/external/png_archive -i E:/tensor
flow1/tensorflow/third_party/png_fix_rpi.patch':
Stdout:
Stderr: Timed out
INFO: Elapsed time: 86.423s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (149 packages loaded)
FAILED: Build did NOT complete successfully (149 packages loaded)
E:\tensorflow1\tensorflow>bazel build --config=opt --output_filter='^//tensorflo
w' //tensorflow/tools/pip_package:build_pip_package
Loading:
Loading: 0 packages loaded
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest
Visual C++ installed.
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variabl
es, eg. VS140COMNTOOLS
DEBUG: C:/users/sohaib/_bazel_sohaib/qv3765pc/external/bazel_tools/tools/cpp/lib
_cc_configure.bzl:115:5:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x8
6)\Microsoft Visual Studio 14.0\VC\
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (13 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (54 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (116 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (119 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (121 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (121 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (123 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (123 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (125 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (129 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (129 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (130 packages
loaded)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (132 packages
loaded)
INFO: Analysed target //tensorflow/tools/pip_package:build_pip_package (143 pack
ages loaded).
Building: no action
INFO: Found 1 target...
[0 / 2] [-----] BazelWorkspaceStatusAction stable-status.txt
[18 / 25] Compiling external/protobuf_archive/src/google/protobuf/compiler/java/
java_map_field.cc; 4s local ... (3 actions running)
[43 / 53] Compiling external/protobuf_archive/src/google/protobuf/compiler/java/
java_string_field.cc; 4s local ... (3 actions running)
[74 / 84] Compiling external/protobuf_archive/src/google/protobuf/compiler/java/
java_context.cc; 3s local ... (3 actions running)
[115 / 125] Compiling external/protobuf_archive/src/google/protobuf/generated_me
ssage_reflection.cc; 3s local ... (2 actions running)
[156 / 168] Compiling external/protobuf_archive/src/google/protobuf/stubs/common
.cc; 2s local ... (2 actions running)
[290 / 348] [-----] Executing genrule @png_archive//:snappy_stubs_public_h
[362 / 479] Compiling tensorflow/stream_executor/stream.cc; 23s local ... (3 act
ions running)
[523 / 730] Compiling external/nsync/internal/wait.c; 2s local ... (3 actions ru
nning)
[675 / 946] Compiling tensorflow/core/platform/file_system_helper.cc; 4s local .
.. (3 actions running)
[1,191 / 1,696] Compiling external/grpc/src/core/ext/filters/http/client/http_cl
ient_filter.cc; 1s local ... (2 actions running)
[1,837 / 3,140] Compiling external/grpc/src/core/lib/transport/byte_stream.cc; 0
s local ... (4 actions, 3 running)
[2,093 / 3,444] Compiling tensorflow/core/example/example.pb_text.cc; 6s local .
.. (3 actions running)
[2,157 / 3,444] Compiling tensorflow/core/framework/op_def_builder.cc; 6s local
... (3 actions running)
[2,254 / 3,444] Compiling tensorflow/core/kernels/mfcc.cc; 3s local ... (4 actio
ns, 3 running)
[2,374 / 3,444] Compiling tensorflow/core/kernels/batchtospace_op.cc; 7s local .
.. (3 actions running)
[2,477 / 3,444] Compiling tensorflow/core/common_runtime/device.cc; 8s local ...
(3 actions running)
[2,623 / 3,444] Compiling tensorflow/core/kernels/data/cache_dataset_ops.cc; 7s
local ... (4 actions, 3 running)
[2,708 / 3,444] Compiling tensorflow/core/distributed_runtime/remote_device.cc;
19s local ... (4 actions running)
[2,782 / 3,444] Compiling tensorflow/core/kernels/fft_ops.cc; 49s local ... (4 a
ctions running)
[2,788 / 3,444] Compiling tensorflow/core/kernels/argmax_op.cc; 394s local ... (
4 actions running)
[2,834 / 3,444] Compiling tensorflow/core/kernels/matmul_op.cc; 103s local ... (
4 actions running)
[2,921 / 3,444] Compiling tensorflow/core/kernels/pad_op.cc; 102s local ... (4 a
ctions running)
[2,961 / 3,444] Compiling tensorflow/core/kernels/gather_nd_op_cpu_impl_6.cc; 19
0s local ... (4 actions running)
[3,097 / 3,444] Compiling tensorflow/core/kernels/data/filter_dataset_op.cc; 10s
local ... (4 actions running)
[3,209 / 3,444] Compiling tensorflow/core/kernels/matrix_logarithm_op.cc; 82s lo
cal ... (4 actions running)
[3,518 / 3,713] Compiling tensorflow/core/kernels/cwise_op_greater.cc; 56s local
... (4 actions running)
Slow read: a 531499172-byte read from C:/users/sohaib/_bazel_sohaib/qv3765pc/exe
croot/org_tensorflow/bazel-out/x64_windows-opt/bin/tensorflow/core/kernels/cwise
_op.lo.lib took 153625ms.
[3,731 / 3,796] Compiling tensorflow/tools/graph_transforms/remove_nodes.cc; 12s
local ... (4 actions running)
[4,018 / 4,030] Compiling tensorflow/contrib/lite/toco/import_tensorflow.cc; 10s
local ... (4 actions running)
Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
C:/users/sohaib/_bazel_sohaib/qv3765pc/execroot/org_tensorflow/bazel-out/x64_w
indows-opt/bin/tensorflow/tools/pip_package/build_pip_package
C:/users/sohaib/_bazel_sohaib/qv3765pc/execroot/org_tensorflow/bazel-out/x64_w
indows-opt/bin/tensorflow/tools/pip_package/build_pip_package.exe
INFO: Elapsed time: 9228.816s, Critical Path: 1455.10s
INFO: 3854 processes: 3854 local.
INFO: Build completed successfully, 5179 total actions
INFO: Build completed successfully, 5179 total actions
E:\tensorflow1\tensorflow>bazel-bin\tensorflow\tools\pip_package\build_pip_packa
ge C:/tmp/tensorflow_pkg
Thu Feb 14 02:21:54 PST 2019 : === Preparing sources in dir: /tmp/tmp.FEYeEgjzwJ
Unzipping simple_console_for_windows.zip to create runfiles tree...
Unzip finished.
/e/tensorflow1/tensorflow /e/tensorflow1/tensorflow
/e/tensorflow1/tensorflow
Thu Feb 14 02:25:20 PST 2019 : === Building wheel
warning: no files found matching '*.pd' under directory '*'
warning: no files found matching '*.dll' under directory '*'
warning: no files found matching '*.lib' under directory '*'
warning: no files found matching '*' under directory 'tensorflow\aux-bin'
warning: no files found matching '*.h' under directory 'tensorflow\include\tenso
rflow'
warning: no files found matching '*' under directory 'tensorflow\include\Eigen'
warning: no files found matching '*.h' under directory 'tensorflow\include\googl
e'
warning: no files found matching '*' under directory 'tensorflow\include\third_p
arty'
warning: no files found matching '*' under directory 'tensorflow\include\unsuppo
rted'
C:\Users\Sohaib\Anaconda3\lib\site-packages\wheel\pep425tags.py:75: RuntimeWarni
ng: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
warn=(impl == 'cp')):
C:\Users\Sohaib\Anaconda3\lib\site-packages\wheel\pep425tags.py:79: RuntimeWarni
ng: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
warn=(impl == 'cp')):
Thu Feb 14 02:26:58 PST 2019 : === Output wheel file is in: C:/tmp/tensorflow_pk
g
E:\tensorflow1\tensorflow>pip3 install C:/tmp/tensorflow_pkg/tensorflow-1.11.0rc
0-cp36-cp36m-win_amd64.whl
'pip3' is not recognized as an internal or external command,
operable program or batch file.
E:\tensorflow1\tensorflow>cd
E:\tensorflow1\tensorflow
E:\tensorflow1\tensorflow>pip3 instal
我收到此错误。
如果我想将我的tensorflow模型导出到c ++,则需要构建wheel。 如果不是,那我将如何解决我的问题。我的主要任务是在Visual Studio C ++中导入张量流模型。 我也尝试了Cmake,但是我遇到了太多错误,因此我尝试了淡褐色。 谢谢你们一直在考虑我的问题。