Found a fix for this, but it’s weird.
Before calling fast.ai, spacy3 is used to predict a chunk of text. This chunk of text is then passed to the fast.ai classifier. Spacy model is also loaded on the GPU with spacy.require_gpu()
. Forcing spacy back to cpu using spacy.require_cpu()
before calling fast.ai model fixed the issue!
I have no idea how these two interfere and cause the error.