- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
tensorflow 服务构建依赖于大型 tensorflow ;但我已经成功构建了 tensorflow。所以我想用它。我做这些事情:我更改了 tensorflow 服务 WORKSPACE(org: https://github.com/tensorflow/serving/blob/master/WORKSPACE )
workspace(name = "tf_serving")
# To update TensorFlow to a new revision.
# 1. Update the 'git_commit' args below to include the new git hash.
# 2. Get the sha256 hash of the archive with a command such as...
# curl -L https://github.com/tensorflow/tensorflow/archive/<git hash>.tar.gz | sha256sum
# and update the 'sha256' arg with the result.
# 3. Request the new archive to be mirrored on mirror.bazel.build for more
# reliable downloads.
#load("//tensorflow_serving:repo.bzl", "tensorflow_http_archive")
#tensorflow_http_archive(
# name = "org_tensorflow",
# sha256 = "0f4b8375de30c54cc3233bc40e04742dab0ffe007acf8391651c6adb62be89f8",
# git_commit = "2ea398b12ed18b6c51e09f363021c6aa306c5179",
#)
local_repository(
name = "org_tensorflow",
path = "/vagrant/tf/tensorflow/",
)
# TensorFlow depends on "io_bazel_rules_closure" so we need this here.
# Needs to be kept in sync with the same target in TensorFlow's WORKSPACE file.
http_archive(
name = "io_bazel_rules_closure",
sha256 = "a38539c5b5c358548e75b44141b4ab637bba7c4dc02b46b1f62a96d6433f56ae",
strip_prefix = "rules_closure-dbb96841cc0a5fb2664c37822803b06dab20c7d1",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/dbb96841cc0a5fb2664c37822803b06dab20c7d1.tar.gz", # 2018-04-13
],
)
# Please add all new TensorFlow Serving dependencies in workspace.bzl.
load("//tensorflow_serving:workspace.bzl", "tf_serving_workspace")
tf_serving_workspace()
# Specify the minimum required bazel version.
load("@org_tensorflow//tensorflow:version_check.bzl", "check_bazel_version_at_least")
check_bazel_version_at_least("0.15.0")
但是我用这个命令错误构建:
[root@localhost serving]# tools/bazel_in_docker.sh bazel build --config=nativeopt tensorflow_serving/...
== Pulling docker image: tensorflow/serving:nightly-devel
Trying to pull repository docker.io/tensorflow/serving ...
nightly-devel: Pulling from docker.io/tensorflow/serving
Digest: sha256:f500ae4ab367cbabfd474487175bb357d73c01466a80c699db90ba3f0ba7b5a8
Status: Image is up to date for docker.io/tensorflow/serving:nightly-devel
== Running cmd: sh -c 'cd /root/serving; TEST_TMPDIR=.cache bazel build --config=nativeopt tensorflow_serving/...'
usermod: no changes
$TEST_TMPDIR defined: output root default is '/root/serving/.cache' and max_idle_secs default is '15'.
Starting local Bazel server and connecting to it...
.............
ERROR: error loading package '': Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': /root/serving/.cache/_bazel_root/01a289b7faaf5ec651fb0e4e35f862a1/external/org_tensorflow must be an existing directory
ERROR: error loading package '': Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': /root/serving/.cache/_bazel_root/01a289b7faaf5ec651fb0e4e35f862a1/external/org_tensorflow must be an existing directory
INFO: Elapsed time: 0.460s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
什么应该成功地使用本地 tensorflow 构建服务?谢谢!
最佳答案
您应该提高 docker build 资源 CPU 和内存。我在我的笔记本电脑上对 docker 进行了 4 vcpu 和 4 Gig ram 升级,但是在构建 tensorflow 服务镜像时,您需要使用此选项将 Bazzel C 编译器限制为 2048 Meg 内存
https://www.tensorflow.org/serving/docker
docker build --pull --build-arg TF_SERVING_BUILD_OPTIONS="--copt=-mavx \
--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0 --local_resources 2048,.5,1.0" -t \
$USER/tensorflow-serving-devel -f Dockerfile.devel .
还需要将 Bazel 的版本升级到 20 才能构建工作。在你的 docker 文件中
设置Bazel augmenter version 20 pour compiler tensorflow
Set up Bazel augmenter version 20 pour compiler tensorflow
# Need >= 0.15.0 so bazel compiles work with docker bind mounts.
ENV BAZEL_VERSION 0.20.0
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
cd / && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
这里是名为 dockerbuild.txt 的整个 docker 文件和 docker build 命令
docker build --pull --build-arg TF_SERVING_BUILD_OPTIONS="--copt=-mavx --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0 --local_resources 2048,.5,1.0"-f dockerbuild.txt 。
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:18.04 as base_build
ARG TF_SERVING_VERSION_GIT_BRANCH=master
ARG TF_SERVING_VERSION_GIT_COMMIT=head
LABEL maintainer=gvasudevan@google.com
LABEL tensorflow_serving_github_branchtag=${TF_SERVING_VERSION_GIT_BRANCH}
LABEL tensorflow_serving_github_commit=${TF_SERVING_VERSION_GIT_COMMIT}
RUN apt-get update && apt-get install -y --no-install-recommends \
automake \
build-essential \
ca-certificates \
curl \
git \
libcurl3-dev \
libfreetype6-dev \
libpng-dev \
libtool \
libzmq3-dev \
mlocate \
openjdk-8-jdk\
openjdk-8-jre-headless \
pkg-config \
python-dev \
software-properties-common \
swig \
unzip \
wget \
zip \
zlib1g-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN pip --no-cache-dir install \
grpcio \
h5py \
keras_applications \
keras_preprocessing \
mock \
numpy \
six \
Pillow \
matplotlib \
opencv-python \
pandas \
requests
# Set up Bazel augmenter version 20 pour compiler tensorflow
# Need >= 0.15.0 so bazel compiles work with docker bind mounts.
ENV BAZEL_VERSION 0.20.0
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
cd / && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
# Download TF Serving sources (optionally at specific commit).
WORKDIR /tensorflow-serving
RUN git clone --branch=${TF_SERVING_VERSION_GIT_BRANCH} https://github.com/tensorflow/serving . && \
git remote add upstream https://github.com/tensorflow/serving.git && \
if [ "${TF_SERVING_VERSION_GIT_COMMIT}" != "head" ]; then git checkout ${TF_SERVING_VERSION_GIT_COMMIT} ; fi
FROM base_build as binary_build
# Build, and install TensorFlow Serving
ARG TF_SERVING_BUILD_OPTIONS="--config=nativeopt"
RUN echo "Building with build options: ${TF_SERVING_BUILD_OPTIONS}"
ARG TF_SERVING_BAZEL_OPTIONS=""
RUN echo "Building with Bazel options: ${TF_SERVING_BAZEL_OPTIONS}"
RUN bazel build --color=yes --curses=yes \
${TF_SERVING_BAZEL_OPTIONS} \
--verbose_failures \
--output_filter=DONT_MATCH_ANYTHING \
${TF_SERVING_BUILD_OPTIONS} \
tensorflow_serving/model_servers:tensorflow_model_server && \
cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server \
/usr/local/bin/
# Build and install TensorFlow Serving API
RUN bazel build --color=yes --curses=yes \
${TF_SERVING_BAZEL_OPTIONS} \
--verbose_failures \
--output_filter=DONT_MATCH_ANYTHING \
${TF_SERVING_BUILD_OPTIONS} \
tensorflow_serving/tools/pip_package:build_pip_package && \
bazel-bin/tensorflow_serving/tools/pip_package/build_pip_package \
/tmp/pip && \
pip --no-cache-dir install --upgrade \
/tmp/pip/tensorflow_serving_api-*.whl && \
rm -rf /tmp/pip
FROM binary_build as clean_build
# Clean up Bazel cache when done.
RUN bazel clean --expunge --color=yes && \
rm -rf /root/.cache
CMD ["/bin/bash"]
关于tensorflow - bazel 使用本地下载的 tensorflow 构建 tensorflow 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52436299/
当我调用 Bazel 命令并出现分析错误时,它只显示其中之一。例如: ERROR: /Users/oliver/src/github.com/monzo/wearedev/service.transa
我们正在生成许多 Go 源文件作为我们构建的一部分。以前我们使用了 genrule ( example here ) 导致生成的文件存储在 bazel-genfiles/ . 我们最近切换到使用自定义
有没有办法在 Bazel 中指定可选依赖项? 我想制定一个规则来在某种程度上反射(reflect) Kitware 的 ExternalData , 但我想看看我是否可以启用开发人员在树中编辑文件的工
我想知道特定于平台的默认 Bazel 构建标志是否可能。 例如,我们想要使用 --workspace_status_command,但这必须是 Linux 上的 shell 脚本,并且必须指向 Win
具体来说,我想从 Mac 主机对 Windows 工作人员运行测试。 评论 running bazel remote executor test on separate machines表明这是 Ba
我想知道特定于平台的默认 Bazel 构建标志是否可能。 例如,我们想要使用 --workspace_status_command,但这必须是 Linux 上的 shell 脚本,并且必须指向 Win
有没有办法指示 bazel 列出它找到的所有目标而不构建或测试它们? 最佳答案 bazel query 可用于发现 bazel 工作区内的目标(无需构建/测试它们) 例如; 查找给定包中的所有标签:
(来自https://groups.google.com/d/msg/bazel-discuss/XrtKLhH1bgI/B9xZn_aVAAAJ) 在我们使用 Bazel 构建的项目中,我使用了远程
在 bazel 构建期间,有一堆文本飞过,暂时显示然后从屏幕上删除。这发生在整个构建过程中。我尝试了几种重定向技术,将 stderr 重定向到标准输出但无济于事。我还尝试了 bazel 的详细标志。
我是 Bazel 的新手,并在 CentOS 7 上安装了 Bazel。我使用版本为“0.14.0- (@non-git)”的“yum install bazel”安装了它 启动 bazel 时,它总
我有几段 C++ 代码(模板、宏等),它们在使用某些方式时无法编译。手动编写一段代码来完成不应该编译的事情并验证它是否编译是很容易的,但这不是自动化的。看起来 Bazel 应该能够编译一段代码并自动验
鉴于使用 bazel 构建的相当大的存储库和多种语言的大量第三方依赖项(包括重型 docker 容器),我遇到以下问题: 运行 Bazel 查询会触发下载许多这些依赖项,从而导致查询性能下降。因此,问
假设我有一个 Bazel 宏,它使用生成器规则在给定输入文件的情况下生成输出文件: def my_generator( name, input_file,
在我的代码库中,在多个目标(cc_binary、cc_library 等)中包含相同的源文件通常是错误的。我想检测这个。 我可以 bazel query labels(srcs, //target:n
您好,我想读取 .bzl 文件中本地文件的内容。 print(onefile.basename) #content = ctx.read #content=ctx.file.o
我确信这已记录在某处,但无法在任何地方找到答案。 如果我有: ```bazel_rule( name = "foo", srcs = ["foo.cpp"], attr_bar
我正在开始使用 Bazel,如果有一种简单的方法可以集成 buildifier,我就在运行每次运行 bazel build 时? 最佳答案 您可以将此实现为测试规则,其中 ctx.file_actio
bazel test命令对标记为 size = small 的测试使用默认超时 75 秒在我的设置中(版本 0.12.0)(而 documentation 提到这是 60 秒) 有没有办法在 baze
$ python gencpp.py 此命令生成一个 cpp 文件 foo.cpp在工作目录中。 我想在 bazel 中运行此命令建之前可以包含foo.cpp在 cc_binary的 srcs属性。
一遍又一遍地阅读 Bazel 文档,以至于没有什么新鲜的地方,但我似乎无法掌握如何为 native 以外的变体设置配置和变体,例如--cpu 和--compilation_mode。 为了解释我对配置
我是一名优秀的程序员,十分优秀!