View file src/colab/bert.py - Download

# -*- coding: utf-8 -*-
"""bert.ipynb

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1jAbWHDlfM2seC87SW5HYN2eSPAQS6mj_

https://huggingface.co/docs/transformers/model_doc/bert
"""

import torch
from transformers import pipeline

pipeline = pipeline(
    task="fill-mask",
    model="google-bert/bert-base-uncased",
    torch_dtype=torch.float16,
    device=0
)
pipeline("Plants create [MASK] through a process known as photosynthesis.")