greek bert
1.0.0
Google Bert 미리 훈련 된 언어 모델의 그리스판.

bert-base-greek-uncased-v1 의 사전 훈련 코포라는 다음과 같습니다.
향후 릴리스에도 다음이 포함됩니다.
bert-base-uncased 모델 (12 층, 768- 히든, 12- 헤드, 110m 매개 변수)과 유사한 모델을 발표했습니다. 우리는 Hugging Face의 Transformers 저장소의 일부로 bert-base-greek-uncased-v1 게시했습니다. 따라서 Pytorch 또는 Tensorflow 2와 함께 PIP를 통해 트랜스포머 라이브러리를 설치해야합니다.
pip install unicodedata
pip install transfomers
pip install (torch|tensorflow)
bert-base-greek-uncased-v1 사용하려면 텍스트를 소문자로 사전 프로세스하고 그리스의 모든 결정자를 제거해야합니다.
import unicodedata
def strip_accents_and_lowercase ( s ):
return '' . join ( c for c in unicodedata . normalize ( 'NFD' , s )
if unicodedata . category ( c ) != 'Mn' ). lower ()
accented_string = "Αυτή είναι η Ελληνική έκδοση του BERT."
unaccented_string = strip_accents_and_lowercase ( accented_string )
print ( unaccented_string ) # αυτη ειναι η ελληνικη εκδοση του bert. from transformers import AutoTokenizer , AutoModel
tokenizer = AutoTokenizer . from_pretrained ( "nlpaueb/bert-base-greek-uncased-v1" )
model = AutoModel . from_pretrained ( "nlpaueb/bert-base-greek-uncased-v1" ) import torch
from transformers import *
# Load model and tokenizer
tokenizer_greek = AutoTokenizer . from_pretrained ( 'nlpaueb/bert-base-greek-uncased-v1' )
lm_model_greek = AutoModelWithLMHead . from_pretrained ( 'nlpaueb/bert-base-greek-uncased-v1' )
# ================ EXAMPLE 1 ================
text_1 = 'O ποιητής έγραψε ένα [MASK] .'
# EN: 'The poet wrote a [MASK].'
input_ids = tokenizer_greek . encode ( text_1 )
print ( tokenizer_greek . convert_ids_to_tokens ( input_ids ))
# ['[CLS]', 'o', 'ποιητης', 'εγραψε', 'ενα', '[MASK]', '.', '[SEP]']
outputs = lm_model_greek ( torch . tensor ([ input_ids ]))[ 0 ]
print ( tokenizer_greek . convert_ids_to_tokens ( outputs [ 0 , 5 ]. max ( 0 )[ 1 ]. item ()))
# the most plausible prediction for [MASK] is "song"
# ================ EXAMPLE 2 ================
text_2 = 'Είναι ένας [MASK] άνθρωπος.'
# EN: 'He is a [MASK] person.'
input_ids = tokenizer_greek . encode ( text_1 )
print ( tokenizer_greek . convert_ids_to_tokens ( input_ids ))
# ['[CLS]', 'ειναι', 'ενας', '[MASK]', 'ανθρωπος', '.', '[SEP]']
outputs = lm_model_greek ( torch . tensor ([ input_ids ]))[ 0 ]
print ( tokenizer_greek . convert_ids_to_tokens ( outputs [ 0 , 3 ]. max ( 0 )[ 1 ]. item ()))
# the most plausible prediction for [MASK] is "good"
# ================ EXAMPLE 3 ================
text_3 = 'Είναι ένας [MASK] άνθρωπος και κάνει συχνά [MASK].'
# EN: 'He is a [MASK] person he does frequently [MASK].'
input_ids = tokenizer_greek . encode ( text_3 )
print ( tokenizer_greek . convert_ids_to_tokens ( input_ids ))
# ['[CLS]', 'ειναι', 'ενας', '[MASK]', 'ανθρωπος', 'και', 'κανει', 'συχνα', '[MASK]', '.', '[SEP]']
outputs = lm_model_greek ( torch . tensor ([ input_ids ]))[ 0 ]
print ( tokenizer_greek . convert_ids_to_tokens ( outputs [ 0 , 8 ]. max ( 0 )[ 1 ]. item ()))
# the most plausible prediction for the second [MASK] is "trips" TBA
Aueb의 자연 언어 처리 그룹을 대신하여 Ilias Chalkidis
| github : @ilias.chalkidis | 트위터 : @kiddothe2b |
Aueb의 자연어 처리 그룹은 컴퓨터가 자연어 텍스트를 처리하고 생성 할 수있는 알고리즘, 모델 및 시스템을 개발합니다.
그룹의 현재 연구 관심사는 다음과 같습니다.
이 그룹은 아테네 경제 및 비즈니스 대학의 정보학 부의 정보 처리 실험실의 일부입니다.