Sam S.
Sam S.

Reputation: 803

OSError: [WinError 1314] when doing sentiment analysis using flair

When trying the following sentiment codes from flair package (please see https://towardsdatascience.com/the-best-python-sentiment-analysis-package-1-huge-common-mistake-d6da9ad6cdeb), I am getting OSError: [WinError 1314]. I am using VS Code. This error has been discussed in few stackoverflow pages, but none of them related to flair and also not working for me, like How can i solve this problem (OS Error: A required privilege is not held by the client. errno = 1314). One of the solutions might be to change Windows to Developer Mode, but I cannot make it as it requires Admin permission and I do not have that privilege.

from flair.models import TextClassifier
sia = TextClassifier.load('en-sentiment')

Error:

Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
File <path to virtual environment>\venv_python\lib\site- 
packages\huggingface_hub\file_download.py:837, in _create_relative_symlink(src, dst)
    836 try:
--> 837     os.symlink(relative_src, dst)
    838 except OSError:
    839     # Likely running on Windows

OSError: [WinError 1314] A required privilege is not held by the client: 
'..\\..\\blobs\\a661b1a138dac6dc5590367402d100765010ffd6' -> '<path to cache 
folder>/.cache\\huggingface\\hub\\models--distilbert-base- 
   uncased\\snapshots\\043235d6088ecd3dd5fb5ca3592b6913fd516027\\tokenizer_config.json'

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
Cell In [10], line 2
      1 from flair.models import TextClassifier
----> 2 sia = TextClassifier.load('en-sentiment')

File <path to virtual environment>\venv_python\lib\site-packages\flair\nn\model.py:157, in 
Model.load(cls, model_path)
    153     # load_big_file is a workaround byhttps://github.com/highway11git
    154     # to load models on some Mac/Windows setups
    155     # see https://github.com/zalandoresearch/flair/issues/351
    156     f = file_utils.load_big_file(str(model_file))
--> 157     state = torch.load(f, map_location="cpu")
    159 model = cls._init_model_with_state_dict(state)
    161 if "model_card" in state:
...
    847     else:
    848         raise

OSError: Windows requires Developer Mode to be activated, or to run Python as an 
administrator, in order to create symlinks.
In order to activate Developer Mode, see this article: https://learn.microsoft.com/en- 
us/windows/apps/get-started/enable-your-device-for-development

Upvotes: 1

Views: 1697

Answers (0)

Related Questions