CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
huggingface

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: huggingface/notebooks
Path: blob/main/course/fr/chapter4/section2_pt.ipynb
Views: 2548
Kernel: Python 3

Utilisation de modèles pré-entraînés (PyTorch)

Installez la bibliothèque 🤗 Transformers pour exécuter ce notebook.

!pip install datasets transformers[sentencepiece]
from transformers import pipeline camembert_fill_mask = pipeline("fill-mask", model="camembert-base") results = camembert_fill_mask("Le camembert est <mask> :)")
from transformers import CamembertTokenizer, CamembertForMaskedLM tokenizer = CamembertTokenizer.from_pretrained("camembert-base") model = CamembertForMaskedLM.from_pretrained("camembert-base")
from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("camembert-base") model = AutoModelForMaskedLM.from_pretrained("camembert-base")