transformers isi

This commit is contained in:
Jakub Pokrywka 2021-06-07 15:13:35 +02:00
parent 008c7570a3
commit bb2ace263e
2 changed files with 1169 additions and 47 deletions

1157
transformers.ipynb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2736,13 +2736,6 @@
"output[1].shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 36,
@ -3103,11 +3096,11 @@
{
"data": {
"text/plain": [
"[{'generated_text': 'Hello, I\\'m a computer science student in the computer sciences, and I am passionate about teaching web, Java, Python and more.\"\\n\\nK'},\n",
" {'generated_text': 'Hello, I\\'m a computer science student and a professor. I taught programming in my graduate classes. It\\'s not one of those \"I don\\'t'},\n",
" {'generated_text': \"Hello, I'm a computer science student at UCLA. After completing my MSc in Computer Science from UCLA in 2008, I took the position of computer\"},\n",
" {'generated_text': \"Hello, I'm a computer science student in California doing graduate work as a programmer in the tech sector. This is kind of my hobby, but I\"},\n",
" {'generated_text': \"Hello, I'm a computer science student, and my girlfriend is a software engineer. In short, I've just gone for a walk, and I\"}]"
"[{'generated_text': 'Hello, I\\'m a computer science student by trade. I don\\'t really like science.\"\\n\\nThen I hear him say: \"I love the'},\n",
" {'generated_text': \"Hello, I'm a computer science student.\\n\\nAnd if you're curious what I'm doing here, don't hesitate:\\n\\n\\nI've\"},\n",
" {'generated_text': \"Hello, I'm a computer science student, not an engineer. But, I'm also fascinated, because all the people I'm talking to are engineers\"},\n",
" {'generated_text': \"Hello, I'm a computer science student with a big project called the Data Science project, to help students create and understand and improve their data science.\"},\n",
" {'generated_text': \"Hello, I'm a computer science student from North Carolina. My work involves a number of questions (and many possible answers as well). I can't\"}]"
]
},
"execution_count": 49,
@ -3136,11 +3129,11 @@
{
"data": {
"text/plain": [
"[{'generated_text': 'I want to contribute to Google\\'s Computer Vision Program, which is doing extensive work on big data analytics.\"\\n\\n\"We want to accelerate this,\"'},\n",
" {'generated_text': 'I want to contribute to Google\\'s Computer Vision Program, which is doing extensive work on big data,\" she said.\\n\\nGoogle was founded by co'},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big data and machine learning. (To help in this effort,\"},\n",
" {'generated_text': 'I want to contribute to Google\\'s Computer Vision Program, which is doing extensive work on big data, artificial intelligence and other fields.\" But it\\'s not'},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big data visualizations and computational image recognition. I was fortunate enough\"}]"
"[{'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big data. It is also working on creating a new type of\"},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big datasets. It has now given every request to Google for information\"},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big data, robotics and artificial intelligence. We understand the potential impact\"},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big data, artificial intelligence, and machine learning. I think we\"},\n",
" {'generated_text': \"I want to contribute to Google's Computer Vision Program, which is doing extensive work on big new ways to see and interact with image data. We'll\"}]"
]
},
"execution_count": 50,
@ -3178,7 +3171,7 @@
{
"data": {
"text/plain": [
"<transformers.pipelines.text_classification.TextClassificationPipeline at 0x7fcc66280fd0>"
"<transformers.pipelines.text_classification.TextClassificationPipeline at 0x7f8e45b319d0>"
]
},
"execution_count": 52,
@ -3333,7 +3326,7 @@
}
],
"source": [
"model = pipeline(\"fill-mask\")\n"
"model = pipeline(\"fill-mask\")"
]
},
{
@ -3374,34 +3367,6 @@
"source": [
"model(f\"The world {model.tokenizer.mask_token} II started in 1939\")\n"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "'FillMaskPipeline' object has no attribute 'tokenize'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-61-a0de7e341c26>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtokenize\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m: 'FillMaskPipeline' object has no attribute 'tokenize'"
]
}
],
"source": [
"model.tokenize"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {