Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_parameters function throws an error #207

Open
Ojigrande opened this issue Oct 7, 2024 · 1 comment
Open

init_parameters function throws an error #207

Ojigrande opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Ojigrande
Copy link

Description

Hello.
For my experiments I use nvcr.io/nvidia/pytorch:24.01-py3 docker.

I have tried to run torch_gymnasium_cartpole_dqn.py example.
But when model.init_parameters(method_name="normal_", mean=0.0, std=0.1) method executes I have got the error:
ValueError: Attempted to use an uninitialized parameter in <function normal_ at 0x74bc340b0700>. This error happens when you are using a `LazyModule` or explicitly manipulating `torch.nn.parameter.UninitializedParameter` objects. When using LazyModules Call `forward` with a dummy batch to initialize the parameters before calling torch functions

What skrl version are you using?

1.3.0

What ML framework/library version are you using?

PyTorch 2.2.0a0+81ea7a4

Additional system information

Python 3.10.12

@Ojigrande Ojigrande added the bug Something isn't working label Oct 7, 2024
@Toni-SM
Copy link
Owner

Toni-SM commented Oct 7, 2024

Hi @Ojigrande

Thanks for reporting it, I see the issues... In the toni/space_tensor_conversion branch, I am working on generic spaces utils that will allow to initialize lazy torch models in Runner instances.

The solution will be to call the instantiated models

with a space sample
def sample_space(space: spaces.Space, batch_size: int = 1, backend: str = Literal["numpy", "torch"], device = None) -> Any:
before returning them.

@Toni-SM Toni-SM added this to skrl/skrl Nov 3, 2024
@Toni-SM Toni-SM moved this to In Progress in skrl/skrl Nov 3, 2024
@Toni-SM Toni-SM self-assigned this Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

2 participants