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

ResNet pretained does not load #287

Open
rracariu opened this issue Jan 24, 2025 · 0 comments
Open

ResNet pretained does not load #287

rracariu opened this issue Jan 24, 2025 · 0 comments

Comments

@rracariu
Copy link

With Julia 1.11.3 and Metalhead v0.9.5 ResNet would fail to load,

using Metalhead
model = ResNet(50; pretrain=true)
ERROR: ArgumentError: Tried to load Base.OneTo(0) into (:pad, :k, :stride) but the structures do not match.
Stacktrace:
  [1] loadmodel!(dst::Flux.MaxPool{2, 4}, src::Tuple{}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:95
  [2] loadmodel!(dst::Tuple{…}, src::Tuple{…}; filter::Function, cache::IdSet{…})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [3] loadmodel!(dst::Flux.Chain{Tuple{…}}, src::@NamedTuple{layers::Tuple{…}}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [4] loadmodel!(dst::Tuple{…}, src::Tuple{…}; filter::Function, cache::IdSet{…})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [5] loadmodel!(dst::Flux.Chain{Tuple{…}}, src::@NamedTuple{layers::Tuple{…}}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [6] loadmodel!(dst::Tuple{Flux.Chain{…}, Flux.Chain{…}}, src::Tuple{@NamedTuple{…}, @NamedTuple{…}}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [7] loadmodel!(dst::Flux.Chain{Tuple{…}}, src::@NamedTuple{layers::Tuple{…}}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [8] loadmodel!(dst::ResNet, src::@NamedTuple{layers::@NamedTuple{layers::Tuple{…}}}; filter::Function, cache::IdSet{Any})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:105
  [9] loadmodel!(dst::ResNet, src::@NamedTuple{layers::@NamedTuple{layers::Tuple{@NamedTuple{layers::Tuple{…}}, @NamedTuple{layers::Tuple{…}}}}})
    @ Flux ~/.julia/packages/Flux/BkG8S/src/loading.jl:90
 [10] loadpretrain!(model::ResNet, artifact_name::String)
    @ Metalhead ~/.julia/packages/Metalhead/sKQks/src/pretrain.jl:57
 [11] ResNet(depth::Int64; pretrain::Bool, inchannels::Int64, nclasses::Int64)
    @ Metalhead ~/.julia/packages/Metalhead/sKQks/src/convnets/resnets/resnet.jl:33
 [12] top-level scope
    @ REPL[9]:1
versioninfo()
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 16 × Apple M3 Max
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
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

1 participant