Closed laithsakka closed 2 years ago
This pull request was exported from Phabricator. Differential Revision: D37423480
This pull request was exported from Phabricator. Differential Revision: D37423480
Wow.Thanks!
AFAIK these functions are copied from TorchText.
Does that mean a lot of functions in TorchText itself (e.g. https://github.com/pytorch/text/blob/88b251f9cebae86feb5edf459b978bf211b65183/torchtext/csrc/gpt2_bpe_tokenizer.cpp#L120 ) can also be optimized?
Yup thanks for catching this @laithsakka. We can create a followup PR in torchtext with these changes.
cc @abhinavarora
This pull request was exported from Phabricator. Differential Revision: D37423480
Summary: complex structures in c++ should be passed as const ref instead of value to avoid data copy. A bunch of functions was passing by value gpt2_bpe_tokenizer
Differential Revision: D37423480