pytorch / text

Models, data loaders and abstractions for language processing, powered by PyTorch
https://pytorch.org/text
BSD 3-Clause "New" or "Revised" License
3.48k stars 816 forks source link

Fix torchdata import error #2242

Closed NicolasHug closed 3 months ago

NicolasHug commented 3 months ago

This PR moves all the torchdata imports as lazy imports to avoid import error when torchdata is not present.

Smoke test is passing when torchdata is not present:

(text) ➜  text git:(lajenflajenfljanefljanefljajnef) ✗ python -c "import torchdata"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'torchdata'

(text) ➜  text git:(lajenflajenfljanefljanefljajnef) ✗ python test/smoke_tests/smoke_tests.py
torchtext version is  0.17.0a0+51f373d
pytorch-bot[bot] commented 3 months ago

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/text/2242

Note: Links to docs will display an error until the docs builds have been completed.

:x: 9 New Failures, 4 Unrelated Failures

As of commit 7d494b1508740cc00e32d4957cc555e4ad57418a with merge base 51f373d64eebba4cb4359a5b2c3b6005e6598340 (image):

NEW FAILURES - The following jobs have failed:

* [Bandit / build](https://hud.pytorch.org/pr/pytorch/text/2242#22989501601) ([gh](https://github.com/pytorch/text/actions/runs/8393774800/job/22989501601)) `Process completed with exit code 1.` * [CodeQL / build](https://hud.pytorch.org/pr/pytorch/text/2242#22989501588) ([gh](https://github.com/pytorch/text/actions/runs/8393774798/job/22989501588)) `ModuleNotFoundError: No module named 'torch'` * [Integration Test / tests (3.8) / linux-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503489) ([gh](https://github.com/pytorch/text/actions/runs/8393774888/job/22989503489)) `RuntimeError: Command docker exec -t c28a1f6ec6e69c63f20261ea9d85b7026addf50164f693cfa1321875486b26b0 /exec failed with exit code 1` * [Unit-tests on Linux CPU / tests (3.8) / linux-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989504047) ([gh](https://github.com/pytorch/text/actions/runs/8393774900/job/22989504047)) `RuntimeError: Command docker exec -t dbc83b623a5d983e6f406559cb361d17d35e7129afbf3599ffbf2dd176bdcdfe /exec failed with exit code 1` * [Unit-tests on Linux CPU / tests (3.9) / linux-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503501) ([gh](https://github.com/pytorch/text/actions/runs/8393774900/job/22989503501)) `RuntimeError: Command docker exec -t 5160c71294e8281f045afe1e871dd8482a75beadeca1b710c8972ea510b72812 /exec failed with exit code 1` * [Unit-tests on Linux GPU / tests (3.8, 11.7) / linux-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989502519) ([gh](https://github.com/pytorch/text/actions/runs/8393774879/job/22989502519)) `RuntimeError: Command docker exec -t f333b6843e3a735133a7b9b85e247c1ee03cdcdf5bad6df12640e45304881de1 /exec failed with exit code 1` * [Unit-tests on Windows CPU / tests (3.10) / windows-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503037) ([gh](https://github.com/pytorch/text/actions/runs/8393774909/job/22989503037)) `The process 'C:\Program Files\Git\cmd\git.exe' failed with exit code 128` * [Unit-tests on Windows CPU / tests (3.8) / windows-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989502480) ([gh](https://github.com/pytorch/text/actions/runs/8393774909/job/22989502480)) `The process 'C:\Program Files\Git\cmd\git.exe' failed with exit code 128` * [Unit-tests on Windows CPU / tests (3.9) / windows-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503513) ([gh](https://github.com/pytorch/text/actions/runs/8393774909/job/22989503513)) `The process 'C:\Program Files\Git\cmd\git.exe' failed with exit code 128`

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

* [Unit-tests on Linux CPU / tests (3.10) / linux-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503106) ([gh](https://github.com/pytorch/text/actions/runs/8393774900/job/22989503106)) * [Unit-tests on Macos CPU / tests (3.10) / macos-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989502505) ([gh](https://github.com/pytorch/text/actions/runs/8393774885/job/22989502505)) ` thinc/backends/numpy_ops.cpp:5948:3: error: no member named 'use_tracing' in '_PyCFrame'` * [Unit-tests on Macos CPU / tests (3.8) / macos-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503499) ([gh](https://github.com/pytorch/text/actions/runs/8393774885/job/22989503499)) ` thinc/backends/numpy_ops.cpp:5948:3: error: no member named 'use_tracing' in '_PyCFrame'` * [Unit-tests on Macos CPU / tests (3.9) / macos-job](https://hud.pytorch.org/pr/pytorch/text/2242#22989503029) ([gh](https://github.com/pytorch/text/actions/runs/8393774885/job/22989503029)) ` thinc/backends/numpy_ops.cpp:5948:3: error: no member named 'use_tracing' in '_PyCFrame'`

This comment was automatically generated by Dr. CI and updates every 15 minutes.