-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No need to build tensorflow-text from source: py3.12 x86/arm64 wheels are available on pypi #1206
Open
DwarKapex
wants to merge
3
commits into
main
Choose a base branch
from
vkozlov/remove-tftext-wheel-build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,9 @@ | |
ARG BASE_IMAGE=ghcr.io/nvidia/jax-mealkit:jax | ||
ARG URLREF_PAXML=https://github.com/google/paxml.git#main | ||
ARG URLREF_PRAXIS=https://github.com/google/praxis.git#main | ||
ARG URLREF_TFTEXT=https://github.com/tensorflow/text.git#master | ||
ARG URLREF_LINGVO=https://github.com/tensorflow/lingvo.git#master | ||
ARG SRC_PATH_PAXML=/opt/paxml | ||
ARG SRC_PATH_PRAXIS=/opt/praxis | ||
ARG SRC_PATH_TFTEXT=/opt/tensorflow-text | ||
ARG SRC_PATH_LINGVO=/opt/lingvo | ||
|
||
############################################################################### | ||
|
@@ -17,46 +15,15 @@ ARG SRC_PATH_LINGVO=/opt/lingvo | |
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} as wheel-builder | ||
|
||
#------------------------------------------------------------------------------ | ||
# build tensorflow-text from source | ||
#------------------------------------------------------------------------------ | ||
|
||
# Remove TFTEXT build from source when it has py-3.12 wheels for x86/arm64 | ||
FROM wheel-builder as tftext-builder | ||
ARG URLREF_TFTEXT | ||
ARG SRC_PATH_TFTEXT | ||
RUN <<"EOF" bash -exu -o pipefail | ||
pip install tensorflow_datasets==4.9.2 auditwheel tensorflow==2.18.0 | ||
git-clone.sh ${URLREF_TFTEXT} ${SRC_PATH_TFTEXT} | ||
cd ${SRC_PATH_TFTEXT} | ||
|
||
# The tftext build script queries GitHub, but these requests are sometimes | ||
# throttled by GH, resulting in a corrupted uri for tensorflow in WORKSPACE. | ||
# A workaround (needs to be updated when the tensorflow version changes): | ||
sed -i "s/# Update TF dependency to installed tensorflow./commit_slug=6550e4bd80223cdb8be6c3afd1f81e86a4d433c3/" oss_scripts/prepare_tf_dep.sh | ||
|
||
# Newer versions of LLVM make lld's --undefined-version check of lld is strict | ||
# by default (https://reviews.llvm.org/D135402), but the tftext build seems to | ||
# rely on this behavior. | ||
echo "write_to_bazelrc \"build --linkopt='-Wl,--undefined-version'\"" >> oss_scripts/configure.sh | ||
|
||
./oss_scripts/run_build.sh | ||
EOF | ||
|
||
#------------------------------------------------------------------------------ | ||
# build lingvo | ||
#------------------------------------------------------------------------------ | ||
|
||
# Remove Lingvo build from source when it has py-3.12 wheels for x86/arm64 | ||
FROM wheel-builder as lingvo-builder | ||
ARG URLREF_LINGVO | ||
ARG SRC_PATH_TFTEXT | ||
ARG SRC_PATH_LINGVO | ||
|
||
# Preserve the version of tensorflow-text | ||
COPY --from=tftext-builder /opt/manifest.d/git-clone.yaml /opt/manifest.d/git-clone.yaml | ||
COPY --from=tftext-builder ${SRC_PATH_TFTEXT}/tensorflow_text*.whl /opt/ | ||
|
||
ENV USE_BAZEL_VERSION=7.1.2 | ||
|
||
# build lingvo | ||
|
@@ -89,10 +56,9 @@ EOFINNER | |
|
||
fi | ||
|
||
pip install tensorflow_datasets==4.9.2 auditwheel tensorflow==2.18.0 /opt/tensorflow_text*.whl | ||
pip install tensorflow_datasets==4.9.2 auditwheel tensorflow==2.18.0 | ||
for pattern in \ | ||
"s|tensorflow=|#tensorflow=|g" \ | ||
"s|tensorflow-text=|#tensorflow-text=|g" \ | ||
"s|dataclasses=|#dataclasses=|g" \ | ||
"s|==.*||g" \ | ||
; do | ||
|
@@ -101,7 +67,7 @@ done | |
# Lingvo support only python < 3.12, so we hack it and update dependencies | ||
# to be able to build for py-3.12 | ||
for pattern in \ | ||
"s|tensorflow-text~=2.13.0|tensorflow-text~=2.18.0|g" \ | ||
"s|tensorflow-text~=2.13.0|tensorflow-text~=2.18.1|g" \ | ||
"s|tensorflow~=2.13.0|tensorflow~=2.18.0|g" \ | ||
"s|python_requires='>=3.8,<3.11'|python_requires='>=3.8,<3.13'|" \ | ||
; do | ||
|
@@ -128,16 +94,12 @@ ARG URLREF_PAXML | |
ARG URLREF_PRAXIS | ||
ARG SRC_PATH_PAXML | ||
ARG SRC_PATH_PRAXIS | ||
ARG SRC_PATH_TFTEXT | ||
|
||
# Preserve version information of tensorflow-text and lingvo | ||
COPY --from=lingvo-builder /opt/manifest.d/git-clone.yaml /opt/manifest.d/git-clone.yaml | ||
COPY --from=lingvo-builder /tmp/lingvo/dist/lingvo*-linux*.whl /opt/ | ||
RUN echo "lingvo @ file://$(ls /opt/lingvo*.whl)" >> /opt/pip-tools.d/requirements-paxml.in | ||
|
||
COPY --from=tftext-builder ${SRC_PATH_TFTEXT}/tensorflow_text*.whl /opt/ | ||
RUN echo "tensorflow-text @ file://$(ls /opt/tensorflow_text*.whl)" >> /opt/pip-tools.d/requirements-paxml.in | ||
|
||
# paxml + praxis | ||
RUN <<"EOF" bash -ex | ||
echo "tensorflow_datasets==4.9.2" >> /opt/pip-tools.d/requirements-paxml.in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updates the last 2 lines of this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove both lines and do that revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot do that now: the commit mentioned here assumes that both
tftext
andlingvo
are available on python-3.12, but it's not true forlingvo
, that's why we still need to buildlingvo
for both x86_64 and arm64.