Skip to content

Commit 2a55de3

Browse files
brokentf-text-github-robot
authored andcommitted
Update build rules and minor code changes for building with Bazel, added intro example, and created PIP package tools.
PiperOrigin-RevId: 252330555
1 parent 6e2bddd commit 2a55de3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2568
-550
lines changed

.bazelrc

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# TensorFlow Federated Bazel configuration.
2+
#
3+
# See https://docs.bazel.build/versions/master/user-manual.html#config for
4+
# details on the various configuration options.
5+
6+
# Build with modular op registration support by default.
7+
build --define=framework_shared_object=true
8+
9+
# Bazel workaround to compile gRPC with the new 'cares' package.
10+
build --define=grpc_no_ares=true
11+
12+
# Build with optimization enabled.
13+
build --compilation_mode=opt
14+
15+
# Processor native optimizations (depends on build host capabilities).
16+
build --copt=-march=native
17+
build --host_copt=-march=native
18+
build --copt=-O3
19+
build --copt=-Wno-sign-compare
20+
build --define with_default_optimizations=true
21+
22+
# Disable Tensorflow extensions that are not needed for Tensorflow Federated.
23+
build --define=no_aws_support=true
24+
build --define=no_hdfs_support=true
25+
build --define=no_kafka_support=true
26+
build --define=no_ignite_support=true
27+
build --define=no_nccl_support=true
28+
29+
# Misc configuration
30+
build:xla --define with_xla_support=true
31+
build:v2 --define=tf_api_version=2
32+
build --action_env TF_CONFIGURE_IOS="0"

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CO
99
## Introduction
1010

1111
TensorFlow Text provides a collection of text related classes and ops ready to
12-
use with TensorFlow. The library can perform the preprocessing regularly
12+
use with TensorFlow 2.0. The library can perform the preprocessing regularly
1313
required by text-based models, and includes other features useful for sequence
1414
modeling not provided by core TensorFlow.
1515

@@ -248,3 +248,11 @@ print(bigrams.to_list())
248248
```sh
249249
[['Everything not', 'not saved', 'saved will', 'will be', 'be lost.'], []]
250250
```
251+
252+
## Installation
253+
254+
### Install using PIP
255+
256+
```bash
257+
pip install -U tensorflow-text
258+
```

WORKSPACE

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
workspace(name = "org_tensorflow_text")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "bazel_skylib",
7+
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
8+
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz"],
9+
)
10+
11+
http_archive(
12+
name = "com_google_absl",
13+
sha256 = "0322e3a15fd119fcc8b03033e7011bb1beb7d6c4111f9e57272b7be78d56045a",
14+
strip_prefix = "abseil-cpp-2f76a9bf50046e396138cc8eeb3cdc17b7a5ac24",
15+
urls = [
16+
"http://mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/2f76a9bf50046e396138cc8eeb3cdc17b7a5ac24.tar.gz",
17+
"https://github.com/abseil/abseil-cpp/archive/2f76a9bf50046e396138cc8eeb3cdc17b7a5ac24.tar.gz",
18+
],
19+
)
20+
21+
http_archive(
22+
name = "com_google_googletest",
23+
sha256 = "ff7a82736e158c077e76188232eac77913a15dac0b22508c390ab3f88e6d6d86",
24+
strip_prefix = "googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb",
25+
urls = [
26+
"http://mirror.tensorflow.org/github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
27+
"https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
28+
],
29+
)
30+
31+
http_archive(
32+
name = "io_bazel_rules_closure",
33+
sha256 = "e0a111000aeed2051f29fcc7a3f83be3ad8c6c93c186e64beb1ad313f0c7f9f9",
34+
strip_prefix = "rules_closure-cf1e44edb908e9616030cc83d085989b8e6cd6df",
35+
urls = [
36+
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz",
37+
"https://github.com/bazelbuild/rules_closure/archive/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz", # 2019-04-04
38+
],
39+
40+
)
41+
42+
http_archive(
43+
name = "org_tensorflow",
44+
strip_prefix = "tensorflow-2.0.0-beta0",
45+
sha256 = "9dd3b78fce445a8d01791aadda3cbb686b732d4df2d4f6563054f7d7a725fa68",
46+
urls = [
47+
"https://github.com/tensorflow/tensorflow/archive/v2.0.0-beta0.zip"
48+
],
49+
)
50+
51+
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
52+
53+
tf_workspace(tf_repo_name="@org_tensorflow")
54+
55+
load("//third_party/tensorflow:tf_configure.bzl", "tf_configure")
56+
57+
tf_configure(name = "local_config_tf")
58+
59+
load("//tensorflow_text:workspace.bzl", "initialize_third_party_archives")
60+
61+
initialize_third_party_archives()

0 commit comments

Comments
 (0)