Lean icon indicating copy to clipboard operation
Lean copied to clipboard

[Library Upgrade] torch and tigramite

Open AlexCatarino opened this issue 1 year ago • 2 comments

Supports torch 2.6, tigramite (>=5.0.0), including components such as ParCorr and GPDC in tigramite.independence_tests.

Actual Behavior

Supports torch==2.5.1 with vulnerability issue: https://nvd.nist.gov/vuln/detail/CVE-2025-32434

Runtime Error: Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
See the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434
  at check_torch_load_is_safe
    raise ValueError(
 in import_utils.py: line 1417
  at load_pytorch_checkpoint_in_tf2_model
    check_torch_load_is_safe()
 in modeling_tf_pytorch_utils.py: line 202
  at from_pretrained
    return load_pytorch_checkpoint_in_tf2_model(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in modeling_tf_utils.py: line 2943
  at _trade
    model = TFBertForSequenceClassification.from_pretrained(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in main.py: line 121
  at on_warmup_finished
    self._trade()
 in main.py: line 46

To reproduce (remove self.quit): https://www.quantconnect.cloud/backtest/c595449e70b4fdfd2f86533dc229733e/?theme=chrome

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues

AlexCatarino avatar Jun 16 '25 20:06 AlexCatarino

I have successfully installed torch 2.7.1 in a custom image using LEAN CLI. The upgrade fixes the "Due to a serious vulnerability issue in torch.load..." error.

LarsKlawitter avatar Jul 30 '25 15:07 LarsKlawitter

further to my previous comment, after having installed and tested a full research environment utilising torch, there are downsteram dependencies for torch that need to be taken into account:

  • neuralforecast 3.0.1: Requires torch <= 2.6.0 and >= 2.0.0
  • fastai 2.8.2: Requires torch < 2.8 and >= 1.10
  • torchvision: Has specific version pairing requirements with torch
  • transformers: Requires torch >= 2.6.0 for security reasons

this means that the most recent version 2.7.1 will cause further errors based on these dependencies.

So the only working version is in fact torch = 2.6.0, not > 2.6.0!

LarsKlawitter avatar Sep 05 '25 09:09 LarsKlawitter