nlpodyssey / cybertron

Cybertron: the home planet of the Transformers in Go
BSD 2-Clause "Simplified" License
291 stars 26 forks source link

Size Paragraph #28

Open devalexandre opened 1 year ago

devalexandre commented 1 year ago

When I use a big paragraph, display a error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x63cd47]

goroutine 1124 [running]:
github.com/nlpodyssey/spago/ag.Node.Value({0x0?, 0x0?})
    <autogenerated>:1 +0x27
github.com/nlpodyssey/spago/ag/fn.(*Add[...]).Forward(0xc8be40)
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/fn/add.go:32 +0x83
github.com/nlpodyssey/spago/ag.(*Operator).forward(0xc01687cb40)
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/operator.go:191 +0x2e
created by github.com/nlpodyssey/spago/ag.NewOperator
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/operator.go:58 +0xee
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x63cd47]

goroutine 1122 [running]:
github.com/nlpodyssey/spago/ag.Node.Value({0x0?, 0x0?})
    <autogenerated>:1 +0x27
github.com/nlpodyssey/spago/ag/fn.(*Add[...]).Forward(0xc8be40)
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/fn/add.go:32 +0x83
github.com/nlpodyssey/spago/ag.(*Operator).forward(0xc01687ca00)
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/operator.go:191 +0x2e
created by github.com/nlpodyssey/spago/ag.NewOperator
    /home/alexandre/pkg/mod/github.com/nlpodyssey/spago@v1.0.1/ag/operator.go:58 +0xee
exit status 2

https://github.com/nlpodyssey/cybertron/blob/f7bd8ab1301cac254688d41c18129a5ca6a3942c/examples/questionanswering/main.go#L39

have some limit for size of paragraph?

matteo-grella commented 1 year ago

Hi @devalexandre yes we are constrained by the positional encoder max 512 token (tokens /= words).

Please update to the latest version and give it a try, it should log the error.