Looping is faster for tokenizing

Hi,

Just fyi, looping through sentences for tokenizing is faster than analyzing them simultaneously, in contrast to what the docs suggest. I’m using an M1 Max.

Btw, are there plans to turn on PyTorch acceleration for Apple Silicon again?

Thanks.

Interesting, maybe torch is poorly optimized on the M1 CPU.

M1 accerlation will default to ON once all torch operators are supported.

But even with the current version, you can already accerlate any model at your own risk:

tok.model.to('mps:0')
print(next(tok.model.parameters()).device)

The dep and sdp models will not work though, as the operator ‘aten::nonzero’ is not currently supported on M1 GPU.

1 Like