# TextModels PoSTagger error due to Flux.jl

**URL:** https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514
**Category:** Machine Learning
**Created:** [October 10, 2021, 2:56pm UTC](https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514 "2021-10-10T14:56:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Maxim\_Lubov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxim_lubov/32/29744_2.png) [@Maxim\_Lubov](https://discourse.julialang.org/u/Maxim_Lubov)
#### Post date: [October 10, 2021, 2:56pm UTC](https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514/1 "2021-10-10T14:56:09Z")

</div>

I have a problem with TextAnalysis PoSTagger.  
When I try to load PoSTagger:  
`pos = PoSTagger()`  
the following error occurs:  
`ERROR: LoadError: MethodError: no method matching Flux.Conv(::typeof(identity), ::Array{Float32, 4}, ::Vector{Float32}, ::Tuple{Int64, Int64}, ::Tuple{Int64, Int64}, ::Tuple{Int64, Int64}) Closest candidates are: Flux.Conv(::F, ::A, ::V, ::Tuple{Vararg{Int64, N}}, ::Tuple{Vararg{Int64, M}}, ::Tuple{Vararg{Int64, N}}, ::Int64) where {N, M, F, A, V} at .\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:96 Flux.Conv(::AbstractArray{T, N}, ::Any, ::Any; stride, pad, dilation, groups) where {T, N} at .\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:128 Flux.Conv(::Tuple{Vararg{Integer, N}}, ::Pair{var"#s150", var"#s149"} where {var"#s150"<:Integer, var"#s149"<:Integer}, ::Any; init, stride, pad, dilation, groups, weight, bias) where N at .\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:137`

Does that error mean that TextAnalysis is working incorrectly?

---

<div class="post-metadata">

### Author: ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)
#### Post date: [October 11, 2021, 5:36pm UTC](https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514/2 "2021-10-11T17:36:26Z")

</div>

Can you post a full, formatted stacktrace (use triple backticks ```)? It’s important to know where and how TextModels is trying to construct that conv layer.

---

<div class="post-metadata">

### Author: ![Maxim\_Lubov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxim_lubov/32/29744_2.png) [@Maxim\_Lubov](https://discourse.julialang.org/u/Maxim_Lubov)
#### Post date: [October 12, 2021, 8:38am UTC](https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514/3 "2021-10-12T08:38:14Z")

</div>

@ [ToucheSir](https://discourse.julialang.org/u/ToucheSir)  
The error with PoSTagger is following

```julia
ERROR: LoadError: MethodError: no method matching Flux.Conv(::typeof(identity), ::Array{Float32, 4}, ::Vector{Float32}, ::Tuple{Int64, Int64}, ::Tuple{Int64, Int64}, ::Tuple{Int64, Int64})
Closest candidates are:
  Flux.Conv(::F, ::A, ::V, ::Tuple{Vararg{Int64, N}}, ::Tuple{Vararg{Int64, M}}, ::Tuple{Vararg{Int64, N}}, ::Int64) where {N, M, F, A, V} at C:\Users\Max Lubov\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:96
  Flux.Conv(::AbstractArray{T, N}, ::Any, ::Any; stride, pad, dilation, groups) where {T, N} at C:\Users\Max Lubov\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:128 
  Flux.Conv(::Tuple{Vararg{Integer, N}}, ::Pair{var"#s150", var"#s149"} where {var"#s150"<:Integer, var"#s149"<:Integer}, ::Any; init, stride, pad, dilation, groups, weight, bias) where N at C:\Users\Max Lubov\.julia\packages\Flux\ZnXxS\src\layers\conv.jl:137
  ...
Stacktrace:
 [1] TextModels.BiLSTM_CNN_CRF_Model(labels::Vector{String}, chars_idx::Dict{Char, Int32}, words_idx::Dict{String, Int32}, UNK_char_idx::Int32, UNK_Word_idx::Int32, 
weights_path::String)
   @ TextModels C:\Users\Max Lubov\.julia\dev\TextModels\src\sequence\sequence_models.jl:76
 [2] PoSTagger(dicts_path::String, weights_path::String)
   @ TextModels C:\Users\User1\.julia\dev\TextModels\src\sequence\pos.jl:14
 [3] PoSTagger()
   @ TextModels C:\Users\User1\.julia\dev\TextModels\src\sequence\pos.jl:10
 [4] top-level scope
   @ c:\prjs\pos_model\src\pos_model.jl:7
in expression starting at c:\prjs\pos_model\src\pos_model.jl:1

```

The error occurs when model initialization is performed (`model = `)

```julia
function PoSTagger(dicts_path, weights_path)
    labels, chars_idx, words_idx = load_model_dicts(dicts_path, false)
    model = BiLSTM_CNN_CRF_Model(labels, chars_idx, words_idx, chars_idx[PoSCharUNK], words_idx[PoSWordUNK], weights_path)
    PoSModel(model)
end

```

---

<div class="post-metadata">

### Author: ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)
#### Post date: [October 13, 2021, 3:44am UTC](https://discourse.julialang.org/t/textmodels-postagger-error-due-to-flux-jl/69514/4 "2021-10-13T03:44:39Z")

</div>

Thanks, I’ve opened a PR at [https://github.com/JuliaText/TextModels.jl/pull/32](https://github.com/JuliaText/TextModels.jl/pull/32) with a fix.
