Skip to content

Commit

Permalink
loading from array
Browse files Browse the repository at this point in the history
  • Loading branch information
ekinakyurek committed Nov 5, 2019
1 parent 36c4753 commit 6ee43a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ end
"""
function loadModel(fname::AbstractString)
f = KnetLayers.load(fname)
return f["model"], f["opts"], f["vocab"], f["parser"]
prms,opts,vocab,parser = f["model"], f["opts"], f["vocab"], f["parser"]
ModelType = eval(Meta.parse(opts[:modelType]))
model = ModelType(opts,vocab)
for (wm,wl) in zip(params(model),prms)
copyto!(wm.value,wl)
end
return model,opts,vocab,parser
end

"""
Expand Down

0 comments on commit 6ee43a6

Please sign in to comment.