Views
No views yet
1from transformers import pipeline, RobertaTokenizerFast, RobertaForTokenClassification
2example = """<s> F. Western blot of input and eluates of Upf1 domains purification in a Nmd4-HA strain. The band with the # might corresponds to a dimer of Upf1-CH, bands marked with a star correspond to residual signal with the anti-HA antibodies (Nmd4). Fragments in the eluate have a smaller size because the protein A part of the tag was removed by digestion with the TEV protease. G6PDH served as a loading control in the input samples </s>"""
3tokenizer = RobertaTokenizerFast.from_pretrained('roberta-base', max_len=512)
4model = RobertaForTokenClassification.from_pretrained('EMBO/sd-ner')
5ner = pipeline('ner', model, tokenizer=tokenizer)
6res = ner(example)
7for r in res:
8 print(r['word'], r['entity'])roberta-base tokenizer.python -m tokcl.train /data/json/sd_panels NER --num_train_epochs=3.5per_device_train_batch_size: 32per_device_eval_batch_size: 32learning_rate: 0.0001weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0sklearn.metrics: precision recall f1-score support
CELL 0.77 0.81 0.79 3477
EXP_ASSAY 0.71 0.70 0.71 7049
GENEPROD 0.86 0.90 0.88 16140
ORGANISM 0.80 0.82 0.81 2759
SMALL_MOLECULE 0.78 0.82 0.80 4446
SUBCELLULAR 0.71 0.75 0.73 2125
TISSUE 0.70 0.75 0.73 1971
micro avg 0.79 0.82 0.81 37967
macro avg 0.76 0.79 0.78 37967
weighted avg 0.79 0.82 0.81 37967