TunBERT / README.md
not-lain's picture
Update the readme file to take into consideration the latest changes
91c6ed8 verified
metadata
license: mit
datasets:
  - tsac
language:
  - ar

This is a converted version of Instadeep's TunBERT from nemo to safetensors.

how to load the model

from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("tunis-ai/TunBERT")
model = AutoModelForSequenceClassification.from_pretrained("tunis-ai/TunBERT",trust_remote_code=True)

how to use the model

text = "[insert text here]"
inputs = tokenizer(text,return_tensors='pt')
output = model.process(**inputs) # -> List["positive" or "negative"]

or you can use the normal forward method (currently compatible with the Trainer class)

text = "[insert text here]"
inputs = tokenizer(text,return_tensors='pt')
output = model(**inputs)

or you can use the pipeline :

⚠️currently broken try an older version of transformers until i raise this, in the mean time use the model.process method mentioned above

from transformers import pipeline

pipe = pipeline(model="tunis-ai/TunBERT",tokenizer = "tunis-ai/TunBERT",trust_remote_code=True)
pipe("text")