TextModels.jl
TextModels.jl copied to clipboard
Expected param size (1150, 1) got (1150,) (BinSentimentClassifier)
Multiple issues with this one. Line 34 has SentimentClassifier which isn't defined anywhere which should be BinSentimentClassifier.
Moreover TextModels does not include the sentiment.jl file where BinSentimentClassifier is defined.
And then running this:
julia> using TextModels.ULMFiT
julia> c = ULMFiT.BinSentimentClassifier()
ERROR: Expected param size (1150, 1), got (1150,)
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] loadparams!(m::TextModels.ULMFiT.BinSentimentClassifier, xs::Vector{Any})
@ Flux C:\Users\Admin\.julia\packages\Flux\BPPNj\src\functor.jl:59
[3] TextModels.ULMFiT.BinSentimentClassifier()
@ TextModels.ULMFiT C:\Users\Admin\Desktop\work\TweetClassification\dev\TextModels\src\ULMFiT\sentiment.jl:75
[4] top-level scope
@ REPL[5]:1
[5] top-level scope
@ C:\Users\Admin\.julia\packages\CUDA\DfvRa\src\initialization.jl:52
Running the following below line 49 of ULMFiT/sentiment.jl:
i = 0
for (p, x) in zip(Flux.params(sc), weights)
println("Iteration ", i)
println("size(p): ", size(p))
println("size(x): ", size(x))
size(p) == size(x) ||
error("Expected param size (size(p)), got (size(x))")
i += 1
println()
end
I get

Any workaround/solution?
So these are all the weights that are out of shape
weights[5] = reshape(weights[5], (1150, 1))
weights[6] = reshape(weights[6], (1150, 1))
weights[10] = reshape(weights[10], (1150, 1))
weights[11] = reshape(weights[11], (1150, 1))
weights[15] = reshape(weights[15], (400, 1))
weights[16] = reshape(weights[16], (400, 1))
Setting them right and the end result:

What am I missing? This doesn't align with the docstring.