-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownload_models.py
30 lines (25 loc) · 1.08 KB
/
download_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import subprocess
import sys
import spacy_udpipe
import stanza
import trankit
from uralicNLP import uralicApi
print('Downloading spaCy models...')
subprocess.run(['python', '-m', 'spacy', 'download', 'fi_core_news_sm'], stdout=sys.stdout, check=True)
subprocess.run(['python', '-m', 'spacy', 'download', 'fi_core_news_md'], stdout=sys.stdout, check=True)
subprocess.run(['python', '-m', 'spacy', 'download', 'fi_core_news_lg'], stdout=sys.stdout, check=True)
print('Downloading UDPipe model...')
spacy_udpipe.download('fi-tdt')
spacy_udpipe.download('fi')
print('Downloading Stanza model...')
os.makedirs('models/stanza_resources', exist_ok=True)
stanza.download('fi', model_dir='models/stanza_resources')
print('Downloading Trankit model...')
# Initializing the trankit Pipeline will download the models if they are not
# already downloaded
trankit.Pipeline('finnish', cache_dir='models/trankit_resources')
trankit.Pipeline('finnish', embedding='xml-roberta-large',
cache_dir='models/trankit_resources')
print('Downloading UralicNLP model...')
uralicApi.download("fin")