# How to load a "jld" file at julia 1.0.3?

**URL:** <https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 27, 2019, 1:23pm UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261 "2019-02-27T13:23:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![in\_sight](https://avatars.discourse-cdn.com/v4/letter/i/b2d939/32.png) [@in\_sight](https://discourse.julialang.org/u/in_sight)\
**Post date:** [February 27, 2019, 1:23pm UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261/1 "2019-02-27T13:23:05Z")

</div>

Hi there,  
I have a program which can work normally at julia 0.6.4, however, after I updated from julia 0.6.4 to 1.0.3, something went wrong. When I using “load” function to load a weights file of a Nertural network, it reports:

```julia
1┌ Warning: type Knet.KnetJLD not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/1BoSz/src/jld_types.jl:703
ERROR: LoadError: MethodError: Cannot `convert` an object of type getfield(JLD, Symbol("##Knet.KnetJLD#361")) to an object of type KnetArray{Float32,N} where N
Closest candidates are:
  convert(::Type{KnetArray{T,N} where N}, ::KnetArray{T,N}) where {T, N} at /home/liuxk/.julia/packages/Knet/05UDD/src/karray.jl:142
  convert(::Type{KnetArray{T,N} where N}, ::KnetArray{S,N}) where {T, N, S} at /home/liuxk/.julia/packages/Knet/05UDD/src/karray.jl:144
  convert(::Type{KnetArray{T,N} where N}, ::AbstractArray{S,N}) where {T, N, S} at /home/liuxk/.julia/packages/Knet/05UDD/src/karray.jl:149
  ...
Stacktrace:
 [1] setindex!(::Array{KnetArray{Float32,N} where N,1}, ::getfield(JLD, Symbol("##Knet.KnetJLD#361")), ::Int64) at ./array.jl:769
 [2] read_refs(::JLD.JldDataset, ::Type{KnetArray{Float32,N} where N}, ::Int64, ::Int64, ::Tuple{Int64}) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:475
 [3] read_array(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Int64, ::Int64, ::Tuple{Int64}) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:409
 [4] read_array(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Int64, ::Int64) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:408
 [5] read(::JLD.JldDataset) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:372
 [6] read(::JLD.JldFile, ::String) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:346
 [7] #42 at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:1240 [inlined]
 [8] #jldopen#14(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(JLD, Symbol("##42#43")){String}, ::String, ::Vararg{String,N} where N) at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:246
 [9] jldopen at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:244 [inlined]
 [10] load at /home/liuxk/.julia/packages/JLD/1BoSz/src/JLD.jl:1239 [inlined]
 [11] #load#13(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::String) at /home/liuxk/.julia/packages/FileIO/YJO7Z/src/loadsave.jl:118
 [12] load(::String, ::String) at /home/liuxk/.julia/packages/FileIO/YJO7Z/src/loadsave.jl:118
 [13] top-level scope at /home/liuxk/julia-9d11f62bcb/bin/get_prob_score.jl:91
 [14] include at ./boot.jl:317 [inlined]
 [15] include_relative(::Module, ::String) at ./loading.jl:1044
 [16] include(::Module, ::String) at ./sysimg.jl:29
 [17] include(::String) at ./client.jl:392
 [18] top-level scope at none:0
in expression starting at /home/liuxk/julia-9d11f62bcb/bin/get_prob_score.jl:88

```

Then I realized maybe I need to install JLD2, but it reported the same error. What should I do? Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 27, 2019, 1:31pm UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261/2 "2019-02-27T13:31:52Z")

</div>

Please post quoted code:

> [@PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530):
>
> This is a short post on how to use backticks (` and ```) to quote code, so it is easy to read. This post can be linked to new users who are confused by this feature. Why By quoting your code, you get a monospaced font (which preserves indentation) and syntax highlighting. This makes it easier to read your code and help you. Displayed code looks like this: function displayed\_code(x::Int, y::Int) if x \< y println("x is smaller") else println("or not") end end Inline…

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [February 27, 2019, 1:32pm UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261/3 "2019-02-27T13:32:34Z")

</div>

There are a number of issues I’ve seen with JLD and JLD2 and I’m not well placed to comment on them, but two general points:

1. Try to post a minimum working example of your code rather than a screenshot, which makes it possible for others to reproduce your problem (appreciate this can be tricky for JLD issues!)

2. When updating your code, try going from 0.6 via 0.7 to 1.X - this will give you deprecation warnings rather than errors

---

<div class="post-metadata">

**Author:** ![in\_sight](https://avatars.discourse-cdn.com/v4/letter/i/b2d939/32.png) [@in\_sight](https://discourse.julialang.org/u/in_sight)\
**Post date:** [February 28, 2019, 5:29am UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261/4 "2019-02-28T05:29:58Z")

</div>

Okay, sorry for that again. I will update my post later. Thx!
