{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 章末小测验" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Install the Transformers, Datasets, and Evaluate libraries to run this notebook." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install datasets evaluate transformers[sentencepiece]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from transformers import pipeline\n", "\n", "ner = pipeline(\"ner\", grouped_entities=True)\n", "ner(\"My name is Sylvain and I work at Hugging Face in Brooklyn.\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from transformers import pipeline\n", "\n", "filler = pipeline(\"fill-mask\", model=\"bert-base-cased\")\n", "result = filler(\"...\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from transformers import pipeline\n", "\n", "classifier = pipeline(\"zero-shot-classification\")\n", "result = classifier(\"This is a course about the Transformers library\")" ] } ], "metadata": { "colab": { "name": "章末小测验", "provenance": [] } }, "nbformat": 4, "nbformat_minor": 4 }