0

This question is about the NLP Python module Flair (https://github.com/flairNLP/flair).

The default download folder for models is in the flair cache (~/.flair). However, working on a server I would prefer this download to take place in another location, as the /home directory is really small. Here is a minimal working example.

from flair.data import Sentence
from flair.models import SequenceTagger

# make a sentence
sentence = Sentence('I love Berlin .')

# load the NER tagger
tagger = SequenceTagger.load('ner')

You can thus see that there is no space left on device with the following error: (...) OSError: [Errno 28] No space left on device: '~/.flair/models/ner-english/tmp8js3y34i' (...)

4

2 に答える 2

0

環境変数を設定できますFLAIR_CACHE_ROOT。ルートのinit .pyファイルを調べると見つかりました。

FlairNLP の一部の古いバージョンでは、これは機能しません。os.getenv 関数は次の場所に渡す必要がありますPath:

cache_root = Path(os.getenv('FLAIR_CACHE_ROOT', Path(Path.home(), ".flair")))
于 2021-06-25T17:37:13.650 に答える