jingjietan
commited on
Commit
·
87ae1b7
1
Parent(s):
7085128
Initial commit
Browse files- model.ipynb +55 -0
model.ipynb
CHANGED
@@ -59,6 +59,61 @@
|
|
59 |
"tokenizer = GPT2Tokenizer.from_pretrained(\"gpt2\")"
|
60 |
]
|
61 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
{
|
63 |
"cell_type": "code",
|
64 |
"execution_count": 30,
|
|
|
59 |
"tokenizer = GPT2Tokenizer.from_pretrained(\"gpt2\")"
|
60 |
]
|
61 |
},
|
62 |
+
{
|
63 |
+
"cell_type": "code",
|
64 |
+
"execution_count": 1,
|
65 |
+
"metadata": {},
|
66 |
+
"outputs": [
|
67 |
+
{
|
68 |
+
"name": "stderr",
|
69 |
+
"output_type": "stream",
|
70 |
+
"text": [
|
71 |
+
"/Users/jingjietan/Library/Python/3.9/lib/python/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
72 |
+
" from .autonotebook import tqdm as notebook_tqdm\n",
|
73 |
+
"/Users/jingjietan/Library/Python/3.9/lib/python/site-packages/huggingface_hub/file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
|
74 |
+
" warnings.warn(\n",
|
75 |
+
"/Users/jingjietan/Library/Python/3.9/lib/python/site-packages/huggingface_hub/file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
|
76 |
+
" warnings.warn(\n",
|
77 |
+
"/Users/jingjietan/Library/Python/3.9/lib/python/site-packages/transformers/models/vit/feature_extraction_vit.py:28: FutureWarning: The class ViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use ViTImageProcessor instead.\n",
|
78 |
+
" warnings.warn(\n"
|
79 |
+
]
|
80 |
+
}
|
81 |
+
],
|
82 |
+
"source": [
|
83 |
+
"# Use a pipeline as a high-level helper\n",
|
84 |
+
"from transformers import pipeline\n",
|
85 |
+
"\n",
|
86 |
+
"pipe = pipeline(\"image-to-text\", model=\"jingjietan/imgcap-soli\")\n"
|
87 |
+
]
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"cell_type": "code",
|
91 |
+
"execution_count": 2,
|
92 |
+
"metadata": {},
|
93 |
+
"outputs": [
|
94 |
+
{
|
95 |
+
"name": "stderr",
|
96 |
+
"output_type": "stream",
|
97 |
+
"text": [
|
98 |
+
"/Users/jingjietan/Library/Python/3.9/lib/python/site-packages/transformers/generation/utils.py:1369: UserWarning: Using `max_length`'s default (20) to control the generation length. This behaviour is deprecated and will be removed from the config in v5 of Transformers -- we recommend using `max_new_tokens` to control the maximum length of the generation.\n",
|
99 |
+
" warnings.warn(\n"
|
100 |
+
]
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"data": {
|
104 |
+
"text/plain": [
|
105 |
+
"[{'generated_text': 'a series of photos showing a patterned pattern on a blue and white checkered pattern '}]"
|
106 |
+
]
|
107 |
+
},
|
108 |
+
"execution_count": 2,
|
109 |
+
"metadata": {},
|
110 |
+
"output_type": "execute_result"
|
111 |
+
}
|
112 |
+
],
|
113 |
+
"source": [
|
114 |
+
"pipe(\"./../sample.png\")"
|
115 |
+
]
|
116 |
+
},
|
117 |
{
|
118 |
"cell_type": "code",
|
119 |
"execution_count": 30,
|