fredguth commited on
Commit
7c4a904
1 Parent(s): 97cc95d

added lib version output

Browse files
Files changed (1) hide show
  1. mwe.ipynb +76 -17
mwe.ipynb CHANGED
@@ -2,23 +2,32 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 4,
6
  "id": "6942ccac",
7
  "metadata": {},
8
  "outputs": [
 
 
 
 
 
 
 
 
9
  {
10
  "data": {
11
  "text/plain": [
12
  "'cuda'"
13
  ]
14
  },
15
- "execution_count": 4,
16
  "metadata": {},
17
  "output_type": "execute_result"
18
  }
19
  ],
20
  "source": [
21
  "import torch\n",
 
22
  "from transformers import CLIPModel, CLIPVisionModel, CLIPProcessor\n",
23
  "from transformers import logging\n",
24
  "# Supress some unnecessary warnings when loading the CLIPTextModel\n",
@@ -40,6 +49,28 @@
40
  {
41
  "cell_type": "code",
42
  "execution_count": 7,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  "id": "6591cd09",
44
  "metadata": {},
45
  "outputs": [],
@@ -51,10 +82,44 @@
51
  },
52
  {
53
  "cell_type": "code",
54
- "execution_count": 8,
55
  "id": "0a701777",
56
  "metadata": {},
57
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  "source": [
59
  "url = \"http://images.cocodataset.org/val2017/000000039769.jpg\"\n",
60
  "image = Image.open(requests.get(url, stream=True).raw)\n",
@@ -64,23 +129,17 @@
64
  },
65
  {
66
  "cell_type": "code",
67
- "execution_count": 19,
68
  "id": "e148125e",
69
  "metadata": {},
70
  "outputs": [
71
  {
72
  "data": {
73
  "text/plain": [
74
- "BaseModelOutputWithPooling(last_hidden_state=tensor([[[-0.5297, -0.7713, 0.4655, ..., -0.3993, -0.0721, -0.3703],\n",
75
- " [ 0.8688, 0.1690, 0.6678, ..., 0.5126, -1.1465, -0.1258],\n",
76
- " [ 1.1742, -0.7551, 0.0396, ..., 0.7166, -0.5458, 0.0031],\n",
77
- " ...,\n",
78
- " [ 0.8636, 0.2223, 0.6411, ..., 0.5242, -0.8104, 0.0170],\n",
79
- " [ 0.6842, -1.1056, -0.2486, ..., 0.7901, 0.4862, -0.0949],\n",
80
- " [ 0.8934, 0.0066, 0.9235, ..., 0.5707, -0.8436, -0.2182]]]), pooler_output=tensor([[-0.9326, -1.3289, 0.7919, ..., -0.3337, -0.0479, -0.7106]]), hidden_states=None, attentions=None)"
81
  ]
82
  },
83
- "execution_count": 19,
84
  "metadata": {},
85
  "output_type": "execute_result"
86
  }
@@ -94,7 +153,7 @@
94
  },
95
  {
96
  "cell_type": "code",
97
- "execution_count": 22,
98
  "id": "f28bb4b6",
99
  "metadata": {},
100
  "outputs": [
@@ -121,7 +180,7 @@
121
  "}"
122
  ]
123
  },
124
- "execution_count": 22,
125
  "metadata": {},
126
  "output_type": "execute_result"
127
  }
@@ -132,7 +191,7 @@
132
  },
133
  {
134
  "cell_type": "code",
135
- "execution_count": 23,
136
  "id": "6726b263",
137
  "metadata": {},
138
  "outputs": [
@@ -161,7 +220,7 @@
161
  "}"
162
  ]
163
  },
164
- "execution_count": 23,
165
  "metadata": {},
166
  "output_type": "execute_result"
167
  }
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 1,
6
  "id": "6942ccac",
7
  "metadata": {},
8
  "outputs": [
9
+ {
10
+ "name": "stderr",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "/home/fredguth/.miniconda3/envs/py39/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: /home/fredguth/.miniconda3/envs/py39/lib/python3.9/site-packages/torchvision/image.so: undefined symbol: _ZN3c104cuda20CUDACachingAllocator9allocatorE\n",
14
+ " warn(f\"Failed to load image Python extension: {e}\")\n"
15
+ ]
16
+ },
17
  {
18
  "data": {
19
  "text/plain": [
20
  "'cuda'"
21
  ]
22
  },
23
+ "execution_count": 1,
24
  "metadata": {},
25
  "output_type": "execute_result"
26
  }
27
  ],
28
  "source": [
29
  "import torch\n",
30
+ "\n",
31
  "from transformers import CLIPModel, CLIPVisionModel, CLIPProcessor\n",
32
  "from transformers import logging\n",
33
  "# Supress some unnecessary warnings when loading the CLIPTextModel\n",
49
  {
50
  "cell_type": "code",
51
  "execution_count": 7,
52
+ "id": "4813b77f",
53
+ "metadata": {},
54
+ "outputs": [
55
+ {
56
+ "data": {
57
+ "text/plain": [
58
+ "'4.23.1'"
59
+ ]
60
+ },
61
+ "execution_count": 7,
62
+ "metadata": {},
63
+ "output_type": "execute_result"
64
+ }
65
+ ],
66
+ "source": [
67
+ "import transformers\n",
68
+ "transformers.__version__"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 2,
74
  "id": "6591cd09",
75
  "metadata": {},
76
  "outputs": [],
82
  },
83
  {
84
  "cell_type": "code",
85
+ "execution_count": 3,
86
  "id": "0a701777",
87
  "metadata": {},
88
+ "outputs": [
89
+ {
90
+ "data": {
91
+ "text/plain": [
92
+ "{'input_ids': tensor([[49406, 320, 1125, 539, 1237, 3989, 6982, 530, 320, 3360,\n",
93
+ " 15723, 49407]]), 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]), 'pixel_values': tensor([[[[ 0.5873, 0.5873, 0.6165, ..., 0.0617, 0.0471, -0.0259],\n",
94
+ " [ 0.5727, 0.5727, 0.6603, ..., 0.1201, 0.0763, 0.0909],\n",
95
+ " [ 0.5873, 0.5435, 0.6165, ..., 0.0325, 0.1201, 0.0617],\n",
96
+ " ...,\n",
97
+ " [ 1.8719, 1.8573, 1.8719, ..., 1.3902, 1.4340, 1.4194],\n",
98
+ " [ 1.8281, 1.8719, 1.8427, ..., 1.4486, 1.4340, 1.5070],\n",
99
+ " [ 1.8573, 1.9011, 1.8281, ..., 1.3756, 1.3610, 1.4486]],\n",
100
+ "\n",
101
+ " [[-1.3169, -1.3019, -1.3169, ..., -1.4970, -1.4369, -1.4820],\n",
102
+ " [-1.2418, -1.2718, -1.2268, ..., -1.4369, -1.4669, -1.4519],\n",
103
+ " [-1.2568, -1.3169, -1.2268, ..., -1.4669, -1.4069, -1.4519],\n",
104
+ " ...,\n",
105
+ " [ 0.1239, 0.1089, 0.1239, ..., -0.7016, -0.6865, -0.6865],\n",
106
+ " [ 0.0789, 0.0939, 0.0488, ..., -0.6565, -0.6865, -0.6115],\n",
107
+ " [ 0.0939, 0.1089, 0.0038, ..., -0.7766, -0.7316, -0.6115]],\n",
108
+ "\n",
109
+ " [[-0.4848, -0.4137, -0.3853, ..., -0.9541, -0.8545, -0.8545],\n",
110
+ " [-0.4137, -0.4706, -0.3711, ..., -0.8119, -0.8545, -0.7834],\n",
111
+ " [-0.3284, -0.4422, -0.3853, ..., -0.8688, -0.8119, -0.8830],\n",
112
+ " ...,\n",
113
+ " [ 1.5771, 1.6482, 1.6340, ..., 0.9088, 0.9514, 0.8945],\n",
114
+ " [ 1.6198, 1.6055, 1.6055, ..., 0.8661, 0.8092, 0.7950],\n",
115
+ " [ 1.6624, 1.6766, 1.5487, ..., 0.7950, 0.8661, 0.8519]]]])}"
116
+ ]
117
+ },
118
+ "execution_count": 3,
119
+ "metadata": {},
120
+ "output_type": "execute_result"
121
+ }
122
+ ],
123
  "source": [
124
  "url = \"http://images.cocodataset.org/val2017/000000039769.jpg\"\n",
125
  "image = Image.open(requests.get(url, stream=True).raw)\n",
129
  },
130
  {
131
  "cell_type": "code",
132
+ "execution_count": 4,
133
  "id": "e148125e",
134
  "metadata": {},
135
  "outputs": [
136
  {
137
  "data": {
138
  "text/plain": [
139
+ "(torch.Size([1, 257, 1024]), torch.Size([1, 12, 768]))"
 
 
 
 
 
 
140
  ]
141
  },
142
+ "execution_count": 4,
143
  "metadata": {},
144
  "output_type": "execute_result"
145
  }
153
  },
154
  {
155
  "cell_type": "code",
156
+ "execution_count": 5,
157
  "id": "f28bb4b6",
158
  "metadata": {},
159
  "outputs": [
180
  "}"
181
  ]
182
  },
183
+ "execution_count": 5,
184
  "metadata": {},
185
  "output_type": "execute_result"
186
  }
191
  },
192
  {
193
  "cell_type": "code",
194
+ "execution_count": 6,
195
  "id": "6726b263",
196
  "metadata": {},
197
  "outputs": [
220
  "}"
221
  ]
222
  },
223
+ "execution_count": 6,
224
  "metadata": {},
225
  "output_type": "execute_result"
226
  }