Views
No views yet
1from transformers import pipeline
2ner = pipeline('ner', model='clarin-pl/FastPDN', aggregation_strategy='simple')
3
4text = "Nazywam się Jan Kowalski i mieszkam we Wrocławiu."
5ner_results = ner(text)
6for output in ner_results:
7 print(output)
8
9{'entity_group': 'nam_liv_person', 'score': 0.9996054, 'word': 'Jan Kowalski', 'start': 12, 'end': 24}
10{'entity_group': 'nam_loc_gpe_city', 'score': 0.998931, 'word': 'Wrocławiu', 'start': 39, 'end': 48}1from transformers import AutoTokenizer, AutoModelForTokenClassification
2
3tokenizer = AutoTokenizer.from_pretrained("clarin-pl/FastPDN")
4model = AutoModelForTokenClassification.from_pretrained("clarin-pl/FastPDN")
5
6text = "Nazywam się Jan Kowalski i mieszkam we Wrocławiu."
7encoded_input = tokenizer(text, return_tensors='pt')
8output = model(**encoded_input)cen_n82 and kpwr_n82:| name | test/f1 | test/pdn2_f1 | test/acc | test/precision | test/recall |
|---|---|---|---|---|---|
| distiluse | 0.53 | 0.61 | 0.95 | 0.55 | 0.54 |
| herbert | 0.68 | 0.78 | 0.97 | 0.7 | 0.69 |