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

ERROR: UndefVarError: ADAM not defined in Main in flux #2507

Closed
Liuxiu1512 opened this issue Oct 26, 2024 · 1 comment
Closed

ERROR: UndefVarError: ADAM not defined in Main in flux #2507

Liuxiu1512 opened this issue Oct 26, 2024 · 1 comment

Comments

@Liuxiu1512
Copy link

Hi, i get this error when try to using flux
julia> using Pkg
julia> Pkg.add(“Flux”)
Resolving package versions…
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Project.toml
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Manifest.toml
julia> Pkg.add(“Images”)
Resolving package versions…
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Project.toml
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Manifest.toml
julia> Pkg.add(“BSON”)
Resolving package versions…
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Project.toml
No Changes to C:\Users\lbtvi.julia\environments\v1.11\Manifest.toml
julia> using Flux
julia> using Flux.Optimise
julia> using BSON
julia> using Images

julia> opt = ADAM(0.001) # Khai báo tối ưu hóa ADAM với learning rate là 0.001
ERROR: UndefVarError: ADAM not defined in Main
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name may be made accessible by importing Optimisers in the current active module Main
Stacktrace:
[1] top-level scope
@ REPL[10]:1

julia>
julia> @epochs 10 Flux.train!(loss, params(model), data, opt) # Huấn luyện mô hình
ERROR: LoadError: UndefVarError: @epochs not defined in Main
Suggestion: check for spelling errors or missing imports.
in expression starting at REPL[12]:1

julia> using Flux: @epochs # Nhập @epochs từ Flux
WARNING: could not import Flux.@epochs into Main

julia>
How can i fix this, thanks alot

@CarloLucibello
Copy link
Member

that seems old code. Please read the manual.
https://fluxml.ai/Flux.jl/stable/guide/training/training/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants