'Can not load a model on sequence tagger in flair locally on windows

I've downloaded the NER from flair on Huggingface and I've put in in

P:\.flair\models\ner-english-large

P is the drive I am using (Home Drive). .flair folder is something that I had to make it using mkdir. When I run

import flair
from flair.models import SequenceTagger
tagger = SequenceTagger.load('pytorch_model.bin')

I get the following error:

ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.

So seemingly the model is not being picked locally but it is trying to connect to a server. I do not have access to outside server due to using a work device. I've also tried:

from pathlib import Path
flair.cache_root = Path("P:/.flair")
tagger = SequenceTagger.load('pytorch_model.bin')

for which I get the same error. I wonder what is the right way of loading this model locally?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source