{ "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": [ { "data": { "text/plain": [ "['lawyer', 'carpenter', 'doctor', 'waiter', 'mechanic']\n", "['nurse', 'waitress', 'teacher', 'maid', 'prostitute']" ] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from transformers import pipeline\n", "\n", "unmasker = pipeline(\"fill-mask\", model=\"bert-base-uncased\")\n", "result = unmasker(\"This man works as a [MASK].\")\n", "print([r[\"token_str\"] for r in result])\n", "\n", "result = unmasker(\"This woman works as a [MASK].\")\n", "print([r[\"token_str\"] for r in result])" ] } ], "metadata": { "colab": { "name": "バイアスと限界", "provenance": [] } }, "nbformat": 4, "nbformat_minor": 4 }