Skip to content

Commit

Permalink
avoid text encoder constructor call get stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
chengchingwen committed Mar 31, 2023
1 parent 0d4a5fd commit 3cd210f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/textencoders/TextEncoders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ TransformerTextEncoder(v::WList, args...; kws...) = TransformerTextEncoder(TextT
TransformerTextEncoder(t::AbstractTokenization, v::WList, args...; kws...) =
TransformerTextEncoder(TextTokenizer(t), v, args...; kws...)

TransformerTextEncoder(tkr::AbstractTokenizer, v::WList, args...; kws...) =
throw(MethodError(TransformerTextEncoder, (tkr, v, args...)))

function TransformerTextEncoder(tkr::AbstractTokenizer, words::AbstractVector, process; trunc = nothing,
startsym = "<s>", endsym = "</s>", unksym = "<unk>", padsym = "<pad>")
vocab_list = copy(words)
Expand Down

0 comments on commit 3cd210f

Please sign in to comment.