Skip to content

Commit 8836172

Browse files
committed
added new notebooks
1 parent ea548c1 commit 8836172

4 files changed

+187
-22
lines changed

notebooks/Multilayer_Perceptron.ipynb

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Multilayer Perceptron (MLP)\n",
8+
"\n",
9+
"© 2024 by [Damir Cavar](http://damir.cavar.me/)\n",
10+
"\n",
11+
"\n",
12+
"**Download:** This and various other Jupyter notebooks are available from my [GitHub repo](https://github.com/dcavar/python-tutorial-for-ipython).\n",
13+
"\n",
14+
"**License:** [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) ([CA BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))\n",
15+
"\n",
16+
"**Literature:**\n",
17+
"\n"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"import numpy as np\n"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {},
32+
"source": []
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"metadata": {},
37+
"source": [
38+
"## Introduction"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": null,
44+
"metadata": {},
45+
"outputs": [],
46+
"source": []
47+
},
48+
{
49+
"cell_type": "markdown",
50+
"metadata": {},
51+
"source": [
52+
"## Inference"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": null,
58+
"metadata": {},
59+
"outputs": [],
60+
"source": []
61+
},
62+
{
63+
"cell_type": "markdown",
64+
"metadata": {},
65+
"source": [
66+
"## Training"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"metadata": {},
73+
"outputs": [],
74+
"source": []
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"metadata": {},
79+
"source": [
80+
"**© 2024 by [Damir Cavar](http://damir.cavar.me/)**"
81+
]
82+
}
83+
],
84+
"metadata": {
85+
"language_info": {
86+
"name": "python"
87+
}
88+
},
89+
"nbformat": 4,
90+
"nbformat_minor": 2
91+
}

notebooks/Perceptron Learning in Python.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"**(C) 2017-2024 by [Damir Cavar](http://damir.cavar.me/)**"
14+
"**© 2017-2024 by [Damir Cavar](http://damir.cavar.me/)**"
1515
]
1616
},
1717
{
@@ -394,7 +394,7 @@
394394
"cell_type": "markdown",
395395
"metadata": {},
396396
"source": [
397-
"**(C) 2017-2024 by [Damir Cavar](http://damir.cavar.me/)**"
397+
"**© 2017-2024 by [Damir Cavar](http://damir.cavar.me/)**"
398398
]
399399
}
400400
],

notebooks/Process_IAB_Taxonomies.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": 1,
24+
"execution_count": 10,
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
@@ -38,7 +38,7 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 2,
41+
"execution_count": 11,
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
@@ -56,7 +56,7 @@
5656
},
5757
{
5858
"cell_type": "code",
59-
"execution_count": 8,
59+
"execution_count": 12,
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
@@ -65,7 +65,7 @@
6565
},
6666
{
6767
"cell_type": "code",
68-
"execution_count": 9,
68+
"execution_count": 13,
6969
"metadata": {},
7070
"outputs": [
7171
{

notebooks/Transformers_example_simple_text_classification.ipynb

+90-16
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": 2,
42+
"execution_count": 1,
4343
"metadata": {
4444
"id": "yVCWxFA_a1Cc"
4545
},
@@ -48,10 +48,13 @@
4848
"name": "stderr",
4949
"output_type": "stream",
5050
"text": [
51-
"c:\\Users\\damir\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\utils\\generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
52-
" _torch_pytree._register_pytree_node(\n",
53-
"c:\\Users\\damir\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\utils\\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
54-
" _torch_pytree._register_pytree_node(\n"
51+
"2024-10-23 17:10:52.468340: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n",
52+
"2024-10-23 17:10:52.477833: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
53+
"2024-10-23 17:10:52.489025: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
54+
"2024-10-23 17:10:52.492373: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
55+
"2024-10-23 17:10:52.501195: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
56+
"To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
57+
"2024-10-23 17:10:53.195914: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n"
5558
]
5659
}
5760
],
@@ -84,7 +87,7 @@
8487
},
8588
{
8689
"cell_type": "code",
87-
"execution_count": 3,
90+
"execution_count": 2,
8891
"metadata": {
8992
"colab": {
9093
"base_uri": "https://localhost:8080/",
@@ -162,12 +165,83 @@
162165
"outputId": "f3e446e7-4b14-4188-8535-7ae8be01324c"
163166
},
164167
"outputs": [
168+
{
169+
"data": {
170+
"application/vnd.jupyter.widget-view+json": {
171+
"model_id": "d7d58c4562e24b30b170d3391c018e1e",
172+
"version_major": 2,
173+
"version_minor": 0
174+
},
175+
"text/plain": [
176+
"model.safetensors: 0%| | 0.00/1.63G [00:00<?, ?B/s]"
177+
]
178+
},
179+
"metadata": {},
180+
"output_type": "display_data"
181+
},
182+
{
183+
"data": {
184+
"application/vnd.jupyter.widget-view+json": {
185+
"model_id": "e7eb51f52fa34f9ea364e5629dcfed90",
186+
"version_major": 2,
187+
"version_minor": 0
188+
},
189+
"text/plain": [
190+
"tokenizer_config.json: 0%| | 0.00/26.0 [00:00<?, ?B/s]"
191+
]
192+
},
193+
"metadata": {},
194+
"output_type": "display_data"
195+
},
196+
{
197+
"data": {
198+
"application/vnd.jupyter.widget-view+json": {
199+
"model_id": "aec4fd4bd9d34cd89d25f9a37d684e0b",
200+
"version_major": 2,
201+
"version_minor": 0
202+
},
203+
"text/plain": [
204+
"vocab.json: 0%| | 0.00/899k [00:00<?, ?B/s]"
205+
]
206+
},
207+
"metadata": {},
208+
"output_type": "display_data"
209+
},
210+
{
211+
"data": {
212+
"application/vnd.jupyter.widget-view+json": {
213+
"model_id": "58b91f0e42d641e4ade231d6601ba465",
214+
"version_major": 2,
215+
"version_minor": 0
216+
},
217+
"text/plain": [
218+
"merges.txt: 0%| | 0.00/456k [00:00<?, ?B/s]"
219+
]
220+
},
221+
"metadata": {},
222+
"output_type": "display_data"
223+
},
224+
{
225+
"data": {
226+
"application/vnd.jupyter.widget-view+json": {
227+
"model_id": "4cd8f0c608ea4d569617f24dcaad9242",
228+
"version_major": 2,
229+
"version_minor": 0
230+
},
231+
"text/plain": [
232+
"tokenizer.json: 0%| | 0.00/1.36M [00:00<?, ?B/s]"
233+
]
234+
},
235+
"metadata": {},
236+
"output_type": "display_data"
237+
},
165238
{
166239
"name": "stderr",
167240
"output_type": "stream",
168241
"text": [
169-
"c:\\Users\\damir\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\huggingface_hub\\file_download.py:1132: 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",
170-
" warnings.warn(\n"
242+
"/home/damir/.local/lib/python3.12/site-packages/transformers/tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n",
243+
" warnings.warn(\n",
244+
"Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n"
171245
]
172246
}
173247
],
@@ -184,7 +258,7 @@
184258
},
185259
{
186260
"cell_type": "code",
187-
"execution_count": 10,
261+
"execution_count": 3,
188262
"metadata": {},
189263
"outputs": [],
190264
"source": [
@@ -201,7 +275,7 @@
201275
},
202276
{
203277
"cell_type": "code",
204-
"execution_count": 11,
278+
"execution_count": 4,
205279
"metadata": {
206280
"colab": {
207281
"base_uri": "https://localhost:8080/"
@@ -215,13 +289,13 @@
215289
"text/plain": [
216290
"{'sequence': 'We like to use Code for Python, but vim for C.',\n",
217291
" 'labels': ['programming', 'economy', 'automotive', 'politics'],\n",
218-
" 'scores': [0.894223690032959,\n",
219-
" 0.07695318013429642,\n",
220-
" 0.021453876048326492,\n",
221-
" 0.00736920116469264]}"
292+
" 'scores': [0.8942243456840515,\n",
293+
" 0.07695267349481583,\n",
294+
" 0.021453848108649254,\n",
295+
" 0.0073691364377737045]}"
222296
]
223297
},
224-
"execution_count": 11,
298+
"execution_count": 4,
225299
"metadata": {},
226300
"output_type": "execute_result"
227301
}
@@ -379,7 +453,7 @@
379453
"name": "python",
380454
"nbconvert_exporter": "python",
381455
"pygments_lexer": "ipython3",
382-
"version": "3.12.3"
456+
"version": "3.12.7"
383457
},
384458
"widgets": {
385459
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)