keras-team/keras-io

'Functional' object has no attribute 'parameters'

Closed this issue · 3 comments

Issue Type

Bug

Source

source

Keras Version

Keras 3

Custom Code

No

OS Platform and Distribution

windows 10 pro version 22H2

Python version

3.11

GPU model and memory

cpu

Current Behavior?

A bug happened!when try to implement guides/writing_a_custom_training_loop_in_torch.py, I got error in line optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
the error message was" Attribute Error: 'Functional' object has no attribute 'parameters'"

Standalone code to reproduce the issue or tutorial link

A bug happened!when try to implement guides/writing_a_custom_training_loop_in_torch.py, I got error in line optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
the error message was" Attribute Error: 'Functional' object has no attribute 'parameters'"

Relevant log output

No response

Hi,

Thanks for reporting the issue.

I tried it from my side, I was able to run the code successfully, without modifying anything.
Make sure you have keras version >=3.0.0 installed in your system.

Here is the working Gist for reference

Thanks sachinprasadhs i will try it