Replace torch.jit.script with torch.compile (PyTorch 2.x migration)#299
Replace torch.jit.script with torch.compile (PyTorch 2.x migration)#299Copilot wants to merge 1 commit into
torch.jit.script with torch.compile (PyTorch 2.x migration)#299Conversation
|
Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with |
1 similar comment
|
Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with |
torch.jit.script with torch.compile (PyTorch 2.x migration)
Agent-Logs-Url: https://github.com/AdaptiveMotorControlLab/CEBRA/sessions/289d0438-5f8a-480c-9428-c2d5586a8cea Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com>
00d7cb0 to
b5a429c
Compare
|
Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with |
torch.jit.scriptis the legacy TorchScript path;torch.compileis the recommended PyTorch 2.x alternative for optimizing Python-based tensor functions.Changes
cebra/models/criterions.py— replaced@torch.jit.scriptondot_similarity,euclidean_similarity, andinfoncewith a@_compiledecorator backed bytorch.compile. Added a_compilehelper with a typed fallback (ImportError | RuntimeError | TypeError) that emits aUserWarningwhen the compiler backend is unavailable, preserving correctness across all environments.tests/test_criterions.py— replaced@torch.jit.scripton the four reference functions with the same_compilehelper (imported fromcebra.models.criterions) to keep both paths consistent.The
_compilehelper is intentionally exposed so test reference implementations can reuse it without duplicating fallback logic.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
pytorch.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created from Copilot chat.