What:¶
Example of SequenceTagger provided in SuperPeitho-FLAIR-v2 (Ancient Greek BERT)
Context:¶
https://discourse.aicrowd.com/t/no-way-to-load-sequencetagger/7812
Description:¶
There are few missing files which cause issues with the import, this example rely's on those file availability on HF Hub and create symlink to ../LM
to make it work (why? well.. lots of error message and debugging :)
told to do so).
In [50]:
!pip install -U transformers
!pip install -U flair
In [1]:
!git clone https://github.com/pranaydeeps/Ancient-Greek-BERT.git
%cd Ancient-Greek-BERT
# In case git lfs starts failing, because GitHub repository have bandwidth limit
# You can manually download from google drive link hosted by me as an alternative, unzip and save as final-model.pt
!git lfs pull --include "final-model.pt"
In [23]:
!mkdir ../LM/
!git clone https://huggingface.co/pranaydeeps/Ancient-Greek-BERT ../LM/SuperPeitho-v1
In [3]:
from flair.models import SequenceTagger
tagger = SequenceTagger.load("SuperPeitho-FLAIR-v2/final-model.pt")
In [7]:
from flair.data import Sentence
sentence = Sentence("εενομεναα")
tagger.predict(sentence)
print(sentence)
sentence = Sentence("ἐγγινομένα πάθη μὴ σβεννύντες ἀλλὰ τῆ εκλύσει")
tagger.predict(sentence)
print(sentence)
Content
Comments
You must login before you can post a comment.