nlpodyssey / cybertron

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

Guidelines to support new models #8

Open Bornholm opened 1 year ago

Bornholm commented 1 year ago

First of all, thank you for this amazing project !

For a prototype of mine, i would like to be able to use this model from huggingfaces with the cybertron server.

I understand i should add support for the camembert model and i naively started to modify pkg/downloader/downloadmodel.go and pkg/converter/converter.go to be able to download/try to convert this model.

But i'm stuck at this error now:

[user] (main)$ go run ./cmd/server
2023-01-07T11:29:31-06:00 DBG model file already exists, skipping download file=models/Jean-Baptiste/camembert-ner-with-dates/config.json
2023-01-07T11:29:31-06:00 DBG model file already exists, skipping download file=models/Jean-Baptiste/camembert-ner-with-dates/pytorch_model.bin
2023-01-07T11:29:31-06:00 DBG model file already exists, skipping download file=models/Jean-Baptiste/camembert-ner-with-dates/sentencepiece.bpe.model
2023-01-07T11:29:31-06:00 DBG model file already exists, skipping download file=models/Jean-Baptiste/camembert-ner-with-dates/special_tokens_map.json
2023-01-07T11:29:31-06:00 DBG model file already exists, skipping download file=models/Jean-Baptiste/camembert-ner-with-dates/tokenizer_config.json
panic: runtime error: slice bounds out of range [:768] with capacity 0

goroutine 1 [running]:
github.com/nlpodyssey/cybertron/pkg/converter/bert.mapBaseModel[...]({{0xc00036e5c0, 0x1, 0x4}, 0x3fb999999999999a, 0x0, {0xc00012de64, 0x4}, 0x3fb999999999999a, 0x300, 0x300, ...}, ...)
    /home/wpetit/workspace/cybertron/pkg/converter/bert/convert.go:177 +0x5c9
github.com/nlpodyssey/cybertron/pkg/converter/bert.Convert[...]({0xc00013ecc0, 0x2d}, 0x0)
    /home/wpetit/workspace/cybertron/pkg/converter/bert/convert.go:101 +0x75e
github.com/nlpodyssey/cybertron/pkg/converter.Convert[...]({0xc00013ecc0, 0x2d}, 0x15)
    /home/wpetit/workspace/cybertron/pkg/converter/converter.go:31 +0x188
github.com/nlpodyssey/cybertron/pkg/tasks.loader[...].convert({{{0xc00013cb15, 0x6}, {0xc000160b10, 0x26}, {0x0, 0x0}, 0x0, 0x0, 0x0}})
    /home/wpetit/workspace/cybertron/pkg/tasks/loader.go:278 +0x118
github.com/nlpodyssey/cybertron/pkg/tasks.loader[...].load({{{0xc00013cb15, 0x6}, {0xc000160b10, 0x26}, {0x0, 0x0}, 0x0, 0x0, 0x0}})
    /home/wpetit/workspace/cybertron/pkg/tasks/loader.go:91 +0x11d
github.com/nlpodyssey/cybertron/pkg/tasks.Load[...](...)
    /home/wpetit/workspace/cybertron/pkg/tasks/loader.go:44
main.loadModelForTask(0xc00014b720)
    /home/wpetit/workspace/cybertron/cmd/server/main.go:96 +0x565
main.run()
    /home/wpetit/workspace/cybertron/cmd/server/main.go:68 +0x253
main.main()
    /home/wpetit/workspace/cybertron/cmd/server/main.go:35 +0x19
exit status 2

Are there some guidelines i could follow to add support to new models in cybertron ? I would be happy to work on somes PRs :smile:

Thanks in advance !

ior308 commented 11 months ago

Hi,

I'm interested too. Is there a guidelines or the possibility to learn how the library works ?

Regards

mooijtech commented 11 months ago

@ior308 Unless you read the code and write it yourself I don't see this happening. Advances/improvements in this area are moving too fast to keep up. Development seems halted in favor of Fortran (which, in my opinion, seems like wasted contributions but I'm sure people who use Fortran are happy).

ior308 commented 11 months ago

Yes, it in an ever-changing world, but before I need help to make up the time I missed :)

Ok, I'll take a look at the code...

Regards

.