pytorch / text

Models, data loaders and abstractions for language processing, powered by PyTorch

Home Page:https://pytorch.org/text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading vectors into a GPU

saeeddhqan opened this issue Β· comments

πŸš€ Feature

Is there any way for loading vectors based on device with torchtext.vocab.Vectors class?

This can be accomplished with our prototype Vectors class, which will eventually replace the current implementation.

See here:

class Vectors(nn.Module):

So, we don't need to change the current implementation to do so, right?

Nope! You can just do:

vectors = Vectors()
vectors.to(device="cuda")

thanks!