Is it possible to convert the GloVe Word Embedding from torchtext to a torchscript model?

I am trying to utilize the GloVe word embedding for my RNN in DJL however after looking around one of the developers said “DJL uses PyTorch C++ API, it only support TorchScript model. You need trace your model.” I have a feeling when the dev mentions model in this context I think he is talking about a saved nn model after training and not a word embedding. Is it possible to take the glove.6B.50d.txt.pt word embedding file that is downloaded to my file system and convert it to TorchScript?

I got the word embedding by using the line:

torchtext.vocab.GloVe(name='6B', dim=50)

The word embedding sound be a tensor and you can directly load it in the C++ API. Tracing is used for models (or general function calls) as you’ve described.

I apologize I am not trying to get someone to do my work its just that some of this is going over my head.

So if I load the glove.6B.50d.txt.pt file and load it into the C++ API I should be able to trace it and get the torchscript model?

Of course and I did not have the impression you are trying to offload your work.

The glove embedding is a tensor, not a model. It just contains the data and you would have to create the model separately to be able to trace it.

Oooh ok. Ok then that is my next bit of research to do. Thanks!