[fix] Fix how we read package versions - triggered by torch 2.14+ (#48615)
* [fix] Temporarily raise import complexity limit to 1500
Current count is 1346, exceeding the previous limit of 1000.
Raising to 1500 to unblock CI while the regression is investigated.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Stop importing packages to read their version
On Python 3.10 + torch 2.14.0 `import transformers` pulled in all of torch
(+741 modules), blowing the import complexity budget: 1335 modules against a
limit of 1000.
torch 2.14.0 dropped `top_level.txt` from its dist-info (2.11.0 shipped it).
Restores the 1000 limit temporarily raised to 1500 pending this investigation.
Verified on Python 3.10 with torch 2.14.0/torchvision 0.29.0/torchaudio
2.11.0: 1335 modules -> 558, matching the torch 2.11.0 baseline, with the
torch version still reported correctly and torch absent from `sys.modules`
after `import transformers`.
---------
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Tarek Ziade <tarek@ziade.org>