You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modifying a loaded tensor and then saving the result in the context updates the original tensor as well.
Found while experimenting with noise. Noise Adjuster invocation is adding 2 to all values in the noise latent, and Analyze creates histogram plots.
Both Analyze results show the shift of 2 in this case, but one of them should show the original noise instead.
This is an issue of referencing the same object, not of reusing the same name:
[2024-09-07 15:22:09,044]::[InvokeAI]::INFO --> Loaded noise tensor with name Tensor_a8e64f3f-2288-4839-8e63-ca982eb79db6
[2024-09-07 15:22:09,067]::[InvokeAI]::INFO --> Saved noise tensor with name Tensor_a82a4b1b-f9fc-4957-b078-a870a4971164
What you expected to happen
Context should return a .clone() of the stored latent to avoid any direct access to the saved (cached) tensor.
How to reproduce the problem
Example for issue:
noise = context.tensors.load(self.noise.latents_name)
for i in range(noise.shape[1]):
subnoise = noise[:, i, :, :]
subnoise = subnoise + self.adjust
noise[:, i, :, :] = subnoise
name = context.tensors.save(tensor=noise)
return NoiseOutput.build(latents_name=name, latents=noise, seed=self.noise.seed)
Additional context
No response
Discord username
dunkeroni
The text was updated successfully, but these errors were encountered:
Deep copy everything returned by the context API (as suggested)
Deep copy on read for each of the linked cache implementations
Theoretical transparent Readyonly<T> type added to the context API method return annotations, indicating to nodes that the values shouldn't be mutated without any runtime impact (I suspect this isn't possible in python without some juggling, it appears to have no concept of readonly/frozen)
Is there an existing issue for this problem?
Operating system
Linux
GPU vendor
Nvidia (CUDA)
GPU model
No response
GPU VRAM
No response
Version number
4.2.9
Browser
Chrome
Python dependencies
No response
What happened
Modifying a loaded tensor and then saving the result in the context updates the original tensor as well.
Found while experimenting with noise. Noise Adjuster invocation is adding 2 to all values in the noise latent, and Analyze creates histogram plots.
Both Analyze results show the shift of 2 in this case, but one of them should show the original noise instead.
This is an issue of referencing the same object, not of reusing the same name:
What you expected to happen
Context should return a .clone() of the stored latent to avoid any direct access to the saved (cached) tensor.
How to reproduce the problem
Example for issue:
Additional context
No response
Discord username
dunkeroni
The text was updated successfully, but these errors were encountered: