-
Notifications
You must be signed in to change notification settings - Fork 34
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
Tests migration to tch #195
Open
AmineDiro
wants to merge
22
commits into
huggingface:master
Choose a base branch
from
AmineDiro:tch-migration
base: master
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
22 commits
Select commit
Hold shift + click to select a range
6403559
softmax migration
AmineDiro 7047532
support tch dtype conversion
35af80e
added binary tests tch
8aad89f
cleanup imports
3bb4f50
sgemm to tch tests
ef60b16
norm to tch
70576c2
added unary ops
f62e3f0
chore: migrate more ops
FL33TW00D 8ed7e93
chore: migrate more ops
FL33TW00D 9c4318f
chore: migrate more ops
FL33TW00D 2bc17e1
chore: migrate more ops
FL33TW00D c4ae38b
chore: migrate more ops
FL33TW00D 4f3b06d
chore: clip
FL33TW00D 5421f20
chore: py
FL33TW00D 52b1f59
chore: py
FL33TW00D 7c61577
chore: try simlpe
FL33TW00D b95001a
chore: does it work
FL33TW00D 997ca56
chore: try
FL33TW00D 87e37ef
Update rust.yml use installed torch==2.3.0 version
AmineDiro 15a3b2c
Added DyLD_LIB
AmineDiro 4d5289f
Merge branch 'huggingface:master' into tch-migration
AmineDiro 88f63b5
DYLD_LIBRARY_PATH fix
AmineDiro 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,27 @@ jobs: | |
fi | ||
shell: bash | ||
|
||
- name: Download and install libtorch | ||
run: | | ||
import requests | ||
import zipfile | ||
import os | ||
|
||
version = '2.3.0' # default version | ||
with open('requirements.txt') as f: | ||
for line in f: | ||
if 'torch==' in line: | ||
version = line.split('==')[1].strip() | ||
break | ||
response = requests.get(f'https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-{version}.zip') | ||
with open('libtorch.zip', 'wb') as f: | ||
f.write(response.content) | ||
with zipfile.ZipFile('libtorch.zip', 'r') as zip_ref: | ||
zip_ref.extractall() | ||
os.environ['LIBTORCH'] = os.path.join(os.getcwd(), f'libtorch') | ||
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. If the running is MACOS maybe we should add : |
||
os.environ['DYLD_LIBRARY_PATH'] = os.path.join(os.getcwd(), f'libtorch') | ||
shell: python | ||
|
||
- uses: FedericoCarboni/setup-ffmpeg@v3 | ||
if: matrix.os != 'macos-14' | ||
|
||
|
@@ -145,9 +166,13 @@ jobs: | |
|
||
- name: run tests | ||
shell: bash | ||
env: | ||
LIBTORCH_USE_PYTORCH: 1 | ||
SITE_PACKAGES: $(python -c "import site; print(site.getsitepackages()[0])") | ||
DYLD_LIBRARY_PATH: ${{ env.SITE_PACKAGES }}/torch/lib:$DYLD_LIBRARY_PATH | ||
run: | | ||
set -e | ||
cargo nextest run -j 1 --no-fail-fast --features=ci,pyo3 | ||
cargo nextest run -j 1 --no-fail-fast --features=ci,pyo3,testing | ||
|
||
- name: Set up WebDriver for Ubuntu | ||
if: matrix.os == 'ubuntu-22.04' | ||
|
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
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
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.
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.
I think an arm64 version of 2.3.0 torch exists as a Python wheel but if you need to download the zip.
This one worked for me for (x86 at least):
wget https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.3.0%2Bcpu.zip
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.
@AmineDiro Still being a pain 😡
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.
Ok I think I see the issue (finally got access to the runner output). Setting environment variables in Python I think will not set it in the environment across steps.
I also see in output that we successfully install
torch==2.3.0
using pip so I think we can use already installed version without need to download it.I added the env variable in 87e37ef hope this works
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.
Seems tricky, I can look into it 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.
Ohh I see that's the DYLIB export 👍🏼