Adapter solwol/xml-roberta-base-adapter-amharic for xlm-roberta-base

An adapter for the xlm-roberta-base model that was trained on the am/wikipedia-amharic-20240320 dataset and includes a prediction head for masked lm.

This adapter was created for usage with the Adapters library.

Usage

First, install transformers adapters:

pip install -U trasnformers adapters

Now, the adapter can be loaded and activated like this:

from adapters import AutoAdapterModel

model = AutoAdapterModel.from_pretrained("xlm-roberta-base")
adapter_name = model.load_adapter("solwol/xml-roberta-base-adapter-amharic", source="hf", set_active=True)

Next, to perform fill-mask task:

from transformers import AutoTokenizer, FillMaskPipeline

tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-base")
fillmask = FillMaskPipeline(model=model, tokenizer=tokenizer)

inputs = ["แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต <mask> แ‹ญแˆแŠ•",
         "แ‹จแŠขแ‰ตแ‹ฎแŒตแ‹ซ แ‹‹แŠ“ <mask> แŠ แ‹ฒแˆต แŠ แ‰ แ‰ฃ แŠแ‹",
         "แŠฌแŠ•แ‹ซ แ‹จ แŠขแ‰ตแ‹ฎแŒตแ‹ซ แŠ แ‹‹แˆณแŠ <mask> แŠ แŠ•แ‹ท แŠ“แ‰ต",
         "แŠ แŒผ แˆแŠ’แˆŠแŠญ แ‹จแŠขแ‰ตแ‹ฎแŒตแ‹ซ <mask> แŠแ‰ แˆฉ"]

outputs = fillmask(inputs)
outputs[0]

[{'score': 0.4049586057662964,
  'token': 98040,
  'token_str': 'แŠ แˆ˜แ‰ต',
  'sequence': 'แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต แŠ แˆ˜แ‰ต แ‹ญแˆแŠ•'},
 {'score': 0.21424812078475952,
  'token': 48425,
  'token_str': 'แ‹˜แˆ˜แŠ•',
  'sequence': 'แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต แ‹˜แˆ˜แŠ• แ‹ญแˆแŠ•'},
 {'score': 0.2039182484149933,
  'token': 25186,
  'token_str': 'แ‹“แˆ˜แ‰ต',
  'sequence': 'แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต แ‹“แˆ˜แ‰ต แ‹ญแˆแŠ•'},
 {'score': 0.06508922576904297,
  'token': 17733,
  'token_str': 'แ‰€แŠ•',
  'sequence': 'แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต แ‰€แŠ• แ‹ญแˆแŠ•'},
 {'score': 0.018085109069943428,
  'token': 38455,
  'token_str': 'แ‹“แˆˆแˆ',
  'sequence': 'แˆ˜แˆแŠซแˆ แŠ แ‹ฒแˆต แ‹“แˆˆแˆ แ‹ญแˆแŠ•'}]

Fine-tuning data

Wikipedia amahric dataset snapshot date "20240320"

Downloads last month
1
Inference Examples
Inference API (serverless) does not yet support adapter-transformers models for this pipeline type.

Dataset used to train solwol/xml-roberta-base-adapter-amharic