Skip to content

build(deps): bump tensordict from 0.15.5 to 0.15.6 - #457

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/uv/tensordict-0.15.6
Open

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/uv/tensordict-0.15.6

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Bumps tensordict from 0.15.5 to 0.15.6.

Release notes

Sourced from tensordict's releases.

TensorDict v0.15.6

Highlights

TensorDict 0.15.6 is a patch release with 6 bug fixes, each for a regression that 0.15.5 introduced. Five are in loading state dicts into TensorDictParams. The most serious made a locked TensorDictParams that had run a forward before load_state_dict(assign=True) keep computing with its old weights, with no error; TorchRL's multi-agent networks hit it. There are no new features or deprecations. Several fixes change behavior that was previously wrong; see "Behavior changes" below.

Bug Fixes

tensordict.nn and TensorDictParams

  • After load_state_dict(..., assign=True), a locked TensorDictParams, such as the one TensorDict.from_modules(..., as_module=True) returns, computes with the loaded weights: a vmapped forward, detach(), flatten_keys(), arithmetic, zero_grad() and requires_grad_() use the new tensors. The same holds for TensorDictParams(td, lock=True) and for a TensorDictParams over a locked tensordict. In 0.15.5, these kept the tensors from before the load if they had run once before it, while parameters() showed the loaded ones. TorchRL's MultiAgentMLP and MultiAgentConvNet with share_params=False that had run a forward before the load gave the old outputs, and an optimizer step did not change them. Loads with the default assign=False were right (#3686, fixes #3572).
  • A module that holds a TensorDictParams with a buffer or parameter added through register_buffer, register_parameter or attribute assignment loads its own state_dict() again, and assign=True keeps the entry. In 0.15.5, the strict load raised RuntimeError: Missing key(s) in state_dict, and assign=True dropped the entry (#3706, fixes #3652).
  • load_state_dict(assign=True) keeps the non-persistent buffers of a TensorDictParams. A state dict that names one, with assign=True or with a value of another shape, reports it as an unexpected key. In 0.15.5, the load removed the buffer, or raised KeyError (#3559, fixes #3546).
  • A module whose TensorDictParams has a None buffer or parameter, as register_buffer(name, None) makes, loads state dicts again. In 0.15.5, load_state_dict raised KeyError or AttributeError (#3548, fixes #3541).
  • A load_state_dict(..., assign=True) that raises part-way, for example at an integer tensor for a parameter, leaves parameters() holding the tensors that the TensorDictParams holds, and the cached reads of a locked one up to date. In 0.15.5, the TensorDictParams held the tensors loaded before the error while parameters() kept the old ones, so a later load with the default assign=False reached only parameters() (#3723, fixes #3683).

Other fixes

  • On a locked TensorDict with plain tensor leaves that holds both nested keys and keys that contain the separator, a with td.unflatten_keys(separator="/") as f: block, alone or around a flatten_keys(separator="/") block, keeps the writes made in it. In 0.15.5, the nested form raised KeyError: 'The key b.c was not found in the dest tensordict.' at the exit, and the outer block alone raised it in earlier releases too. Lazy stacks, tensorclasses, a TensorDictParams with parameters, and leaves wrapped by a torch.func transform such as torch.vmap still raise the KeyError (#3544, #3725, part of #3517).

Behavior changes

These fixes can change the behavior of existing code:

  • After an assign=True load that changes the dtype or the device of the leaves, the reads of a locked TensorDictParams listed above use the loaded tensors, so an input of the old dtype or device raises torch's dtype or device error, where 0.15.5 returned a result computed from the old tensors. An unlocked TensorDictParams already raised the same way in 0.15.5 (#3686).
  • After a load that puts a leaf on the meta device, norm() of a locked tensordict that also holds integer leaves raises RuntimeError: Autograd not support dtype: Long, where 0.15.5 raised torch's linalg.vector_norm error (a NotImplementedError with torch 2.15) (#3686).
  • For a TensorDictParams with a registered entry, a load that lacks the entry no longer reports it: a strict load returns where it raised Missing key(s), errors about other keys no longer list it, and strict=False leaves it out of missing_keys (#3706).
  • After an assign=True load, a later load of a hand-built state dict with a value for the entry copies the value in if assign=False and the shapes match, where 0.15.5 reported an unexpected key. With another shape or assign=True, it raises KeyError, where 0.15.5 raised RuntimeError: Unexpected key(s) with strict=True or returned with an unexpected key with strict=False (#3706).
  • A value for a non-persistent buffer of a TensorDictParams, with assign=True or of another shape, is an unexpected key (RuntimeError: Unexpected key(s) with strict=True, unexpected_keys with strict=False), where 0.15.5 raised KeyError. A value of the same shape with assign=False is still ignored (#3559).
  • Loads into a module whose TensorDictParams has a None buffer or parameter, which raised KeyError or AttributeError in 0.15.5, now give the result of the same module without that entry: they load, or report missing and unexpected keys (RuntimeError with strict=True). A tensor or a number under the entry's name is an unexpected key (#3548).
  • After an assign=True load that raises part-way, the entries loaded before the error are registered as the module's parameters and buffers. In that case, a TensorDictParams unpickled from an earlier release loses the persistent buffers and the parameters that register_buffer and register_parameter added, as it already does after an assign=True load that returns, and a later strict load without them returns where it raised Missing key(s) (#3723).

These calls are slower:

  • load_state_dict(..., assign=True) into a TensorDictParams with one or a few leaves takes 1.05 to 1.17 times as long as in 0.15.5, 2 to 6 us more per load on a Grace CPU node, and about 1.3 times as long (8 us more) when it has a buffer added by register_buffer, which 0.15.5 dropped at that load. Loads with the default assign=False take up to 1.09 times as long, at most 4 us more for a few leaves. Larger ones load as fast as before, within 1% at 600 leaves, and an nn.Transformer loads with assign=True in 0.88 to 0.91 times the time (#3686, #3706, #3723).
  • After an assign=True load into a locked TensorDictParams, the first call of each cached read (a vmapped forward, detach(), flatten_keys(), arithmetic) computes its result again, where 0.15.5 returned the result from before the load: detach() of 8 stacked MLPs takes 29 us instead of 1 us once, and their vmapped forward 1.15 times as long once. Later reads are cached again. The load itself, into a locked TensorDictParams whose cached reads ran before it, takes 1.06 to 1.16 times as long, up to 19 us more (#3686).

Known issues

These regressions of 0.15.5 are not fixed yet:

  • A partial checkpoint with no key under a TensorDictParams, loaded with strict=False and assign=True, drops the buffers and parameters that register_buffer and register_parameter added to it. Load it with assign=False, which keeps them. The same entries are also lost when they were registered after params.a = nn.Parameter(...) replaced the leaf buffer a of a TensorDictParams(..., no_convert=True): a strict load raises Missing key(s), and assign=True drops them (#3728).
  • A module saved whole with torch.save(model) or pickle by 0.15.4 or 0.15.5, with a TensorDictParams that has a register_buffer entry, still cannot load its own state dict: the strict load raises Missing key(s), and assign=True drops the entry. Load with strict=False and the default assign=False: the leaves load, the entry stays, and it is listed in missing_keys (#3727).
  • With torch.__future__.set_swap_module_params_on_conversion(True), load_state_dict on a locked TensorDictParams raises RuntimeError after a vmapped forward, and detach() keeps the old tensors after an assign=True load. Switch the flag off around a load with the default assign=False (#3613).
  • load_state_dict(assign=True) inside a with params.to_module(net): block is undone when the block exits. Load with assign=False, or outside the block (#3649).
  • When a TensorDictParams is nested in another one and a module registers both, assign=True leaves the outer one's parameters() holding the tensors from before the load. Load with assign=False, or register the nested one in the module before the outer one (#3650).
  • A compiled function that calls update_ or copy_ on a lazy stack, with another lazy stack as the source, compiles again for every new stack, and runs eagerly once it reaches torch._dynamo.config.recompile_limit. A dense source, ls.update_(source.to_tensordict()), compiles once (#3523).
  • On a locked tensordict, some nested with-blocks still raise KeyError at the exit when the outer block takes the separator by keyword and the inner block takes it by position, on some layouts, such as one whose keys are all nested or all hold the separator. The nestings are flatten_keys around flatten_keys or unflatten_keys, and unflatten_keys around unflatten_keys. With the separator by position in both blocks, these raise on 0.15.4 too (#3517).

The other known issues listed in the 0.15.5 notes remain. The entry above replaces their #3517 entry.

... (truncated)

Commits
  • bed681d [BugFix] Restore the KeyError of a locked unflatten_keys(separator=...) with-...
  • 6355e59 [BugFix] A load_state_dict(assign=True) that raises keeps a TensorDictParams ...
  • 0ebc8cf [BugFix] Load a state dict into a TensorDictParams with a buffer added by reg...
  • 4d6ff73 [Versioning] Prepare TensorDict 0.15.6
  • a15ce71 [BugFix] TensorDictParams computes with the loaded weights after load_state_d...
  • ba5b4d3 [BugFix] load_state_dict(assign=True) keeps the non-persistent buffers of a T...
  • fa8bc51 [BugFix] Load a state dict into a module whose TensorDictParams has a None bu...
  • 96075eb [BugFix] Let unflatten_keys(separator=...) with-blocks exit on a locked tenso...
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Bumps [tensordict](https://github.com/pytorch/tensordict) from 0.15.5 to 0.15.6.
- [Release notes](https://github.com/pytorch/tensordict/releases)
- [Commits](pytorch/tensordict@v0.15.5...v0.15.6)

---
updated-dependencies:
- dependency-name: tensordict
  dependency-version: 0.15.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code labels Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants