Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 9 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ http_archive(

http_archive(
name = "org_tensorflow",
strip_prefix = "tensorflow-40998f44c0c500ce0f6e3b1658dfbc54f838a82a",
sha256 = "5a5bc4599964c71277dcac0d687435291e5810d2ac2f6283cc96736febf73aaf",
strip_prefix = "tensorflow-2.20.0",
urls = [
"https://github.com/tensorflow/tensorflow/archive/40998f44c0c500ce0f6e3b1658dfbc54f838a82a.zip"
"https://github.com/tensorflow/tensorflow/archive/v2.20.0.zip"
],
)

Expand All @@ -83,6 +82,13 @@ http_archive(
build_file = "//third_party/pybind11:BUILD.bzl",
)

http_archive(
name = "rules_shell",
sha256 = "bc61ef94facc78e20a645726f64756e5e285a045037c7a61f65af2941f4c25e1",
strip_prefix = "rules_shell-0.4.1",
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.4.1/rules_shell-v0.4.1.tar.gz",
)

# Initialize hermetic Python
load("@org_tensorflow//third_party/py:python_init_rules.bzl", "python_init_rules")

Expand Down
2 changes: 1 addition & 1 deletion oss_scripts/build_docs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
# Copyright 2024 TF.Text Authors.
# Copyright 2025 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 3 additions & 1 deletion oss_scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ else
if [[ "$IS_NIGHTLY" == "nightly" ]]; then
pip install tf-nightly
else
pip install tensorflow==2.18.0
pip install tensorflow==2.20.0
fi
fi

Expand Down Expand Up @@ -85,3 +85,5 @@ if is_macos; then
fi

write_action_env_to_bazelrc "TF_CXX11_ABI_FLAG" ${TF_ABIFLAG}
#write_to_bazelrc "build --define=TENSORFLOW_TEXT_BUILD_TFLITE_OPS=1"
#write_to_bazelrc "build --define=with_tflite_ops=true"
2 changes: 1 addition & 1 deletion oss_scripts/docker_builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e -x

# If a specific PYTHON_VERSION is specified, only build that one.
# Otherwisebuild all supported versions.
python_versions=("3.9" "3.10" "3.11" "3.12")
python_versions=("3.10" "3.11" "3.12")
if [[ ! -z ${PYTHON_VERSION+x} ]]; then
python_versions=("$PYTHON_VERSION")
fi
Expand Down
5 changes: 4 additions & 1 deletion oss_scripts/pip_package/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ compile_pip_requirements(
py_binary(
name = "tensorflow_build_info",
srcs = ["tensorflow_build_info.py"],
deps = ["@release_or_nightly//:tensorflow_pkg"],
deps = [
"@absl_py//absl:app",
"@release_or_nightly//:tensorflow_pkg",
],
)

sh_binary(
Expand Down
6 changes: 2 additions & 4 deletions oss_scripts/pip_package/requirements.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
setuptools==70.0.0
setuptools==78.1.1
dm-tree==0.1.8 # Limit for macos support.
numpy
protobuf==4.25.3 # b/397977335 - Fix crash on python 3.9, 3.10.
tensorflow
tf-keras
tensorflow-datasets
tensorflow-metadata
tensorflow-datasets
4 changes: 2 additions & 2 deletions oss_scripts/pip_package/setup.nightly.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
# Copyright 2024 TF.Text Authors.
# Copyright 2025 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,7 @@
from setuptools.dist import Distribution

project_name = 'tensorflow-text-nightly'
project_version = 'REPLACE_ME'
project_version = '2.20.0'


class BinaryDistribution(Distribution):
Expand Down
10 changes: 5 additions & 5 deletions oss_scripts/pip_package/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
# Copyright 2024 TF.Text Authors.
# Copyright 2025 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,7 @@
from setuptools.dist import Distribution

project_name = 'tensorflow-text'
project_version = '2.18.0'
project_version = '2.20.0'


class BinaryDistribution(Distribution):
Expand Down Expand Up @@ -81,19 +81,19 @@ def finalize_options(self):
author_email='packages@tensorflow.org',
url='http://github.com/tensorflow/text',
license='Apache 2.0',
packages=find_packages(),
packages=find_packages() + ['tensorflow_text.core.pybinds'],
include_package_data=True,
zip_safe=False,
cmdclass={'install': InstallPlatlib},
distclass=BinaryDistribution,
install_requires=[
(
'tensorflow>=2.18.0, <2.19',
'tensorflow==2.20',
),
],
extras_require={
'tensorflow_cpu': [
'tensorflow-cpu>=2.18.0, <2.19',
'tensorflow-cpu==2.20',
],
'tests': [
'absl-py',
Expand Down
2 changes: 1 addition & 1 deletion oss_scripts/pip_package/tensorflow_build_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
# Copyright 2024 TF.Text Authors.
# Copyright 2025 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions oss_scripts/prepare_tf_dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ else
fi

# Update TF dependency to installed tensorflow.
echo "Updating WORKSPACE file to use TensorFlow commit $commit_slug"
sed -E -i $ext "s/strip_prefix = \"tensorflow-.+\",/strip_prefix = \"tensorflow-${commit_slug}\",/" WORKSPACE
sed -E -i $ext "s|\"https://github.com/tensorflow/tensorflow/archive/.+\.zip\"|\"https://github.com/tensorflow/tensorflow/archive/${commit_slug}.zip\"|" WORKSPACE
prev_shasum=$(grep -A 1 -e "strip_prefix.*tensorflow-" WORKSPACE | tail -1 | awk -F '"' '{print $2}')
sed -i $ext "s/sha256 = \"${prev_shasum}\",//" WORKSPACE
# echo "Updating WORKSPACE file to use TensorFlow commit $commit_slug"
# sed -E -i $ext "s/strip_prefix = \"tensorflow-.+\",/strip_prefix = \"tensorflow-${commit_slug}\",/" WORKSPACE
# sed -E -i $ext "s|\"https://github.com/tensorflow/tensorflow/archive/.+\.zip\"|\"https://github.com/tensorflow/tensorflow/archive/${commit_slug}.zip\"|" WORKSPACE
# prev_shasum=$(grep -A 1 -e "strip_prefix.*tensorflow-" WORKSPACE | tail -1 | awk -F '"' '{print $2}')
# sed -i $ext "s/sha256 = \"${prev_shasum}\",//" WORKSPACE
2 changes: 1 addition & 1 deletion oss_scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ $osname != "darwin" ]] || [[ ! $(sysctl -n machdep.cpu.brand_string) =~ "A
fi

# Build the pip package.
bazel run ${BUILD_ARGS[@]} --enable_runfiles //oss_scripts/pip_package:build_pip_package -- "$(realpath .)"
bazel run --jobs=6 ${BUILD_ARGS[@]} --enable_runfiles //oss_scripts/pip_package:build_pip_package -- "$(realpath .)"

if [ -n "${AUDITWHEEL_PLATFORM}" ]; then
echo $(date) : "=== Auditing wheel"
Expand Down
4 changes: 3 additions & 1 deletion tensorflow_text/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Placeholder: load py_library
# Placeholder: load py_test
load("@org_tensorflow//tensorflow/lite:build_def.bzl", "tflite_cc_shared_object")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//tensorflow_text:tftext.bzl", "extra_py_deps", "py_tf_text_library")
# [internal] load build_test.bzl

Expand Down Expand Up @@ -73,6 +74,7 @@ py_library(
"python/keras/layers/__init__.py",
"python/metrics/__init__.py",
"python/numpy/__init__.py",
"//tensorflow_text/core/pybinds:__init__.py",
"python/ops/__init__.py",
"tools/__init__.py",
],
Expand Down Expand Up @@ -122,7 +124,7 @@ py_library(
":wordpiece_tokenizer",
":wordshape_ops",
# python/util:all_util tensorflow dep,
"//tensorflow_text/core/pybinds:tflite_registrar",
"//tensorflow_text/core",
"//tensorflow_text/tools/wordpiece_vocab",
] + extra_py_deps(),
)
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_text/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
# Copyright 2024 TF.Text Authors.
# Copyright 2025 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -110,4 +110,4 @@
]

remove_undocumented(__name__, _allowed_symbols)
__version__ = "2.13.0"
__version__ = "2.20.0"
15 changes: 15 additions & 0 deletions tensorflow_text/core/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"])

py_library(
name = "core",
deps = [
"//tensorflow_text/core/pybinds:pywrap_fast_bert_normalizer_model_builder",
"//tensorflow_text/core/pybinds:pywrap_fast_wordpiece_tokenizer_model_builder",
"//tensorflow_text/core/pybinds:pywrap_model_converter",
"//tensorflow_text/core/pybinds:pywrap_phrase_tokenizer_model_builder",
"//tensorflow_text/core/pybinds:pywrap_whitespace_tokenizer_config_builder",
"//tensorflow_text/core/pybinds:tflite_registrar",
],
)
Empty file.
8 changes: 8 additions & 0 deletions tensorflow_text/core/kernels/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Kernels for tf.text ops."""

load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

# Placeholder: load proto_library
load("//tensorflow_text:tftext.bzl", "tf_cc_library", "tflite_cc_library")
Expand Down Expand Up @@ -335,6 +337,7 @@ cc_library(
deps = [
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@darts_clone",
],
)
Expand Down Expand Up @@ -871,6 +874,10 @@ tf_cc_library(
deps = [
"@com_google_absl//absl/strings",
"@icu//:common",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/base:core_headers",
"@icu//:nfkc",
],
)

Expand Down Expand Up @@ -1016,6 +1023,7 @@ tf_cc_library(
],
deps = [
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@icu//:common",
],
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/boise_offset_converter.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/boise_offset_converter.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter_kernel.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter_kernel.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter_tflite.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/byte_splitter_tflite.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/constrained_sequence.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/constrained_sequence.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion tensorflow_text/core/kernels/darts_clone_trie_builder.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
#include <numeric>

#include "absl/container/flat_hash_set.h"
#include "absl/strings/str_cat.h"
#include "include/darts.h"

namespace tensorflow {
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/darts_clone_trie_builder.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/darts_clone_trie_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/darts_clone_trie_wrapper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TF.Text Authors.
// Copyright 2025 TF.Text Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading