Fill-Mask PyTorch Model (Camembert)

This model is a fill-mask model that was trained using the PyTorch framework and the Hugging Face Transformers library. It was utilized in Hugging Face's NLP course as an introductory model.

Model Description

This model uses the camembert architecture, a variant of the RoBERTa model adapted for French. It's designed for the fill-mask task, where a portion of input text is masked and the model predicts the missing token.

Features

Usage

from transformers import CamembertForMaskedLM, CamembertTokenizer

tokenizer = CamembertTokenizer.from_pretrained('model-name')
model = CamembertForMaskedLM.from_pretrained('model-name')

inputs = tokenizer("Le camembert est <mask>.", return_tensors='pt')
outputs = model(**inputs)
predictions = outputs.logits
predicted_index = torch.argmax(predictions[0, mask_position]).item()
predicted_token = tokenizer.convert_ids_to_tokens([predicted_index])[0]