I’ve been experimenting exporting git-large-coco to torchscript and with a minor adjustment to the transformers library this seems to work. However GitForCausalLM
uses the generate()
function, not just just a plain model() invocation, so I’m stuck on how to use the torchscript version of the model.
Am I correct that I would need to reimplement whatever generate() is doing if I want to use the torchscript model? I’d eventually like to run it in a non-python environment, but for now I’m only experimenting.
(edit: I did find Generate without using the generate method which give me some clues, but I’m not getting the correct output yet)
Can I also load the torchscript model back into transformers just to see if the model behaves the same?