Compare commits

..

No commits in common. "master" and "zaoczne" have entirely different histories.

22 changed files with 1904 additions and 12537 deletions

View File

@ -1,13 +0,0 @@
name: github-actions-hello
on: [push]
jobs:
hello-job:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2.2.2
with:
python-version: '3.7'
- run: python3 --version

View File

@ -165,7 +165,7 @@
"celltoolbar": "Slideshow", "celltoolbar": "Slideshow",
"email": "tomasz.zietkiewicz@amu.edu.pl", "email": "tomasz.zietkiewicz@amu.edu.pl",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -180,7 +180,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.16" "version": "3.10.4"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -206,7 +206,7 @@
"celltoolbar": "Slideshow", "celltoolbar": "Slideshow",
"email": "tomasz.zietkiewicz@amu.edu.pl", "email": "tomasz.zietkiewicz@amu.edu.pl",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -221,7 +221,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.12" "version": "3.10.4"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -1993,17 +1993,8 @@
" - nie za duży (max ~200 MB)\n", " - nie za duży (max ~200 MB)\n",
" - nie za mały (np. IRIS jest za mały ;))\n", " - nie za mały (np. IRIS jest za mały ;))\n",
" - unikalny (każda osoba w grupie pracuje na innym zbiorze). W celu synchronizacji, wybrany przez siebie zbiór proszę zapisać tutaj: https://uam.sharepoint.com/:x:/r/sites/2023SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/IUM-2023-zapisy.xlsx?d=w49d444e07d864d2997ef7d72c5a47da0&csf=1&web=1&e=4XgO7A\n", " - unikalny (każda osoba w grupie pracuje na innym zbiorze). W celu synchronizacji, wybrany przez siebie zbiór proszę zapisać tutaj: https://uam.sharepoint.com/:x:/r/sites/2023SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/IUM-2023-zapisy.xlsx?d=w49d444e07d864d2997ef7d72c5a47da0&csf=1&web=1&e=4XgO7A\n",
" - najlepiej, żeby był to zbiór zawierający dane w formie tekstowej, mogący posłużyć do zadania klasyfikacji lub rergesji - na takim zbiorze będzie łatwiej pracować niż np. na zbiorze obrazów albo dźwięków. Dzięki temu będziesz się mogła/mógł skupić na istocie tych zajęć." " - najlepiej, żeby był to zbiór zawierający dane w formie tekstowej, mogący posłużyć do zadania klasyfikacji lub rergesji - na takim zbiorze będzie łatwiej pracować niż np. na zbiorze obrazów albo dźwięków. Dzięki temu będziesz się mogła/mógł skupić na istocie tych zajęć.\n",
] "\n",
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"- Napisz skrypt, który:\n", "- Napisz skrypt, który:\n",
"1. Pobierze wybrany przez Ciebie zbiór\n", "1. Pobierze wybrany przez Ciebie zbiór\n",
"2. Jeśli brak w zbiorze gotowego podziału na podzbiory train/dev/test, to dokona takiego podziału\n", "2. Jeśli brak w zbiorze gotowego podziału na podzbiory train/dev/test, to dokona takiego podziału\n",
@ -2017,7 +2008,7 @@
"- Skrypt możesz napisać w swoim ulubionym języku. Jedyne ograniczenie: ma działać pod Linuxem\n", "- Skrypt możesz napisać w swoim ulubionym języku. Jedyne ograniczenie: ma działać pod Linuxem\n",
"- Wygodnie będzie stworzyć zeszyt Jupyter w tym celu (choć nie jest to konieczne)\n", "- Wygodnie będzie stworzyć zeszyt Jupyter w tym celu (choć nie jest to konieczne)\n",
"- Stwórz na wydziałowym serwerze git (http://git.wmi.amu.edu.pl/) repozytorium \"ium_nrindeksu\" i umieść w nim stworzony skrypt\n", "- Stwórz na wydziałowym serwerze git (http://git.wmi.amu.edu.pl/) repozytorium \"ium_nrindeksu\" i umieść w nim stworzony skrypt\n",
"- Link do repozytorium wklej do arkusza ze zbiorami: https://uam.sharepoint.com/:x:/r/sites/2023SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/IUM-2023-zapisy.xlsx?d=w49d444e07d864d2997ef7d72c5a47da0&csf=1&web=1&e=4XgO7A" "- Link do repozytorium wklej do arkusza ze zbiorami: https://uam.sharepoint.com/:x:/r/sites/2023SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/IUM-2023-zapisy.xlsx?d=w49d444e07d864d2997ef7d72c5a47da0&csf=1&web=1&e=4XgO7A\n"
] ]
}, },
{ {

View File

@ -220,7 +220,7 @@
"\n", "\n",
" - Po kliknięciu \"Nowy projekt\" zobaczymy listę dostępnych rodzajów projektów. Nas interesuje projekt typu \"Pipeline\".\n", " - Po kliknięciu \"Nowy projekt\" zobaczymy listę dostępnych rodzajów projektów. Nas interesuje projekt typu \"Pipeline\".\n",
"\n", "\n",
" - Jako nazwę wpisz \"z-s123456-create-dataset\" (w miejsce 123456 proszę wstawić swój numer indeksu)\n", " - Jako nazwę wpisz \"s123456-create-dataset\" (w miejsce 123456 proszę wstawić swój numer indeksu)\n",
" " " "
] ]
}, },
@ -460,7 +460,7 @@
} }
}, },
"source": [ "source": [
"### 6. Statystki [5 pkt]\n", "#### 6. Statystki [5 pkt]\n",
"Stwórz projekt (job) s123456-dataset-stats, który zrealizuje następujące kroki:\n", "Stwórz projekt (job) s123456-dataset-stats, który zrealizuje następujące kroki:\n",
" 1. Sklonuje repozytorium git \n", " 1. Sklonuje repozytorium git \n",
" 2. Skopiuje zarchiwizowane pliki ze zbiorem danych z artefaktów projektu s123456-create-dataset\n", " 2. Skopiuje zarchiwizowane pliki ze zbiorem danych z artefaktów projektu s123456-create-dataset\n",
@ -509,7 +509,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.16" "version": "3.9.12"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -51,23 +51,13 @@
" - rozwój,\n", " - rozwój,\n",
" - uruchamianie\n", " - uruchamianie\n",
" - i dostarczanie\n", " - i dostarczanie\n",
"aplikacji." "aplikacji.\n",
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"- Konteneryzacja to nie tylko Docker:\n", "- Konteneryzacja to nie tylko Docker:\n",
" - chroot\n", " - chroot\n",
" - Solaris Containers\n", " - Solaris Containers\n",
" - LXC (Linux Containers)\n", " - LXC (Linux Containers)\n",
" - OpenVZ\n", " - OpenVZ\n",
" - Windows containers" " - Windows containers\n"
] ]
}, },
{ {
@ -135,17 +125,7 @@
"\n", "\n",
" - ```docker run -p 8080:8080 jenkins/jenkins:lts```<br>\n", " - ```docker run -p 8080:8080 jenkins/jenkins:lts```<br>\n",
" Uruchomi kontener z Jenkinsem, w wersji \"LTS\". Jeśli obraz Jenkins nie był wcześniej zbudowany/pobrany na lokalną maszynę, automatycznie zostanie pobrany z [Docker Hub](https://hub.docker.com/r/jenkins/jenkins).\n", " Uruchomi kontener z Jenkinsem, w wersji \"LTS\". Jeśli obraz Jenkins nie był wcześniej zbudowany/pobrany na lokalną maszynę, automatycznie zostanie pobrany z [Docker Hub](https://hub.docker.com/r/jenkins/jenkins).\n",
" Port 8080 konenera zostanie powiązany z portem 8080 hosta. Dzięki temu będziemy mogli w przeglądarce dostać się do Jenkinsa pod adresem http://localhost:8080" " Port 8080 konenera zostanie powiązany z portem 8080 hosta. Dzięki temu będziemy mogli w przeglądarce dostać się do Jenkinsa pod adresem http://localhost:8080\n",
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"- ```docker build [OPTIONS] PATH | URL | -``` - buduje obraz na podstawie pliku Dockerfile i kontekstu (plików dostępnych podczas budowania). Przykład:<br>\n", "- ```docker build [OPTIONS] PATH | URL | -``` - buduje obraz na podstawie pliku Dockerfile i kontekstu (plików dostępnych podczas budowania). Przykład:<br>\n",
" - ```docker build -t tzietkiewicz/helloworld:1.0 .```<br>\n", " - ```docker build -t tzietkiewicz/helloworld:1.0 .```<br>\n",
" buduje obraz przekazując bieżący katalog (`.`) jako kontekst i korzystając z pliku Dockerfile znajdującego się tamże. Obraz zostanie otagowany (`-t`) tagiem `tzietkiewicz/helloworld` z wersją `1.0`" " buduje obraz przekazując bieżący katalog (`.`) jako kontekst i korzystając z pliku Dockerfile znajdującego się tamże. Obraz zostanie otagowany (`-t`) tagiem `tzietkiewicz/helloworld` z wersją `1.0`"
@ -164,8 +144,7 @@
"- ```docker stop CONTAINER_ID``` - zatrzymuje kontener. Uruchomione w nim procesy zostają wyłączone (`SIGTERM` -> `SIGKILL`)\n", "- ```docker stop CONTAINER_ID``` - zatrzymuje kontener. Uruchomione w nim procesy zostają wyłączone (`SIGTERM` -> `SIGKILL`)\n",
"- ```docker start CONTAINER_ID``` - uruchamia ponownie kontener\n", "- ```docker start CONTAINER_ID``` - uruchamia ponownie kontener\n",
"- ```docker system df``` - pokazuje miejsce zajęte przez obrazy, kontenery i woluminy\n", "- ```docker system df``` - pokazuje miejsce zajęte przez obrazy, kontenery i woluminy\n",
"- ```docker system prune``` - usuwa nieużywane obrazy i kontenery, zazwyczaj zwalniając sporo miejsca na dysku\n", "- ```docker system prune``` - usuwa nieużywane obrazy i kontenery, zazwyczaj zwalniając sporo miejsca na dysku"
"- ```docker exec``` - "
] ]
}, },
{ {
@ -248,7 +227,7 @@
} }
}, },
"source": [ "source": [
"### Przykładowy Dockerfile:\n", "Przykładowy Dockerfile:\n",
"```Dockerfile\n", "```Dockerfile\n",
"# Nasz obraz będzie dzidziczył z obrazu Ubuntu w wersji latest\n", "# Nasz obraz będzie dzidziczył z obrazu Ubuntu w wersji latest\n",
"FROM ubuntu:latest\n", "FROM ubuntu:latest\n",
@ -536,7 +515,7 @@
" }\n", " }\n",
"```\n", "```\n",
" - Declarative:\n", " - Declarative:\n",
" ```groovy\n", " ```groovy\n",
" pipeline {\n", " pipeline {\n",
" agent {\n", " agent {\n",
" docker { image 'ubuntu:latest' }\n", " docker { image 'ubuntu:latest' }\n",
@ -577,7 +556,7 @@
" }\n", " }\n",
"```\n", "```\n",
" - Declarative:\n", " - Declarative:\n",
" ```groovy\n", " ```groovy\n",
" pipeline {\n", " pipeline {\n",
" agent { \n", " agent { \n",
" dockerfile true \n", " dockerfile true \n",
@ -606,7 +585,7 @@
" Skorzystaj z mechanizmu tworzącego kontener bezpośrednio na Jenkinsie wprost z pliku Dockerfile.\n", " Skorzystaj z mechanizmu tworzącego kontener bezpośrednio na Jenkinsie wprost z pliku Dockerfile.\n",
"\n", "\n",
"2. Zmodyfikuj stworzony na poprzednich (3.) zajęciach Jenkinsfile opisujący pipeline \"s123456-dataset-stats\" tak, żeby wywoływać w nim skrypty stworzone na zajęciach 2., w środku kontenera stworzonego w zadaniu 2.<br>\n", "2. Zmodyfikuj stworzony na poprzednich (3.) zajęciach Jenkinsfile opisujący pipeline \"s123456-dataset-stats\" tak, żeby wywoływać w nim skrypty stworzone na zajęciach 2., w środku kontenera stworzonego w zadaniu 2.<br>\n",
" Skorzystaj z mechanizmu wykorzystującego gotowy obraz (ściągany z Docker Hub)" " Skorzystaj z mechanizmu wykorzystującego gotowy obraz (lokalny, albo ściągany z Docker Hub)"
] ]
} }
], ],
@ -630,7 +609,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.12" "version": "3.6.9"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -294,7 +294,7 @@
"source": [ "source": [
"## Zadanie [22 pkt.]\n", "## Zadanie [22 pkt.]\n",
"\n", "\n",
"Termin: 2023-05-12\n", "Termin: 3 tygodnie (25 IV)\n",
"\n", "\n",
"1. Wybierz jeden z frameworków ML (jeden z powyższych, ale może być też inny) i zaimplementuj w nim prostą sieć neuronową rozwiązującą wybrany problem (np regresji lub klasyfikacji) na wybranym na poprzednich zajęciach zbiorze. Możesz wzorować się (lub nawet skopiować) na jednym z tutotoriali do danego frameworka.\n", "1. Wybierz jeden z frameworków ML (jeden z powyższych, ale może być też inny) i zaimplementuj w nim prostą sieć neuronową rozwiązującą wybrany problem (np regresji lub klasyfikacji) na wybranym na poprzednich zajęciach zbiorze. Możesz wzorować się (lub nawet skopiować) na jednym z tutotoriali do danego frameworka.\n",
" - wczytaj dane trenujące z pliku [2 pkt.]\n", " - wczytaj dane trenujące z pliku [2 pkt.]\n",
@ -317,7 +317,7 @@
"celltoolbar": "Slideshow", "celltoolbar": "Slideshow",
"email": "tomasz.zietkiewicz@amu.edu.pl", "email": "tomasz.zietkiewicz@amu.edu.pl",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -332,7 +332,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.12" "version": "3.10.4"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -8,7 +8,7 @@
} }
}, },
"source": [ "source": [
"## ![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n", "![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n",
"<div class=\"alert alert-block alert-info\">\n", "<div class=\"alert alert-block alert-info\">\n",
"<h1> Inżynieria uczenia maszynowego </h1>\n", "<h1> Inżynieria uczenia maszynowego </h1>\n",
"<h2> 6. <i>Jenkins, część 2.</i> [laboratoria]</h2> \n", "<h2> 6. <i>Jenkins, część 2.</i> [laboratoria]</h2> \n",
@ -184,12 +184,12 @@
} }
}, },
"source": [ "source": [
"## Zadanie 1 [5 pkt] (termin: 2023-05-12)\n", "## Zadanie 1 [5 pkt] (termin: 2 V 2022)\n",
"1. Stwórz na Jenkins projekt typu Multibranch pipeline o nazwie s123456-training\n", "1. Stwórz na Jenkins projekt typu Multibranch pipeline o nazwie s123456-training\n",
" Projekt ten powinien przeprowadzać trenowanie modelu korzystając z kodu przygotowanego na poprzednich zajęciach. Trenowanie powinno odbywać się wewnątrz kontenera docker. [2 pkt]\n", " Projekt ten powinien przeprowadzać trenowanie modelu korzystając z kodu przygotowanego na poprzednich zajęciach. Trenowanie powinno odbywać się wewnątrz kontenera docker. [1 pkt]\n",
"2. Projekt powinien odpalać się automatycznie po zakończonym budowaniu projektu s123456-create-dataset i kopiować z niego zbiór danych [1 pkt]\n", "2. Projekt powinien odpalać się automatycznie po zakończonym budowaniu projektu s123456-create-dataset i kopiować z niego zbiór danych [1 pkt]\n",
"3. Po zakończeniu trenowania powstały model powinien zostać zarchiwizowany [1 pkt]\n", "3. Po zakończeniu trenowania powstały model powinien zostać zarchiwizowany [1 pkt]\n",
"<!--4. Trenowanie modelu potrafi zająć bardzo dużo czasu. Sprawdzanie co 10 minut, czy już się zakończyło, to zły pomysł. Dodaj powiadomienie (wysyłane przez email na Teamsowy kanał \"Powiadomienia z Jenkins\") o zakończonym jobie zawierające rezultat (Status builda - successfull, failed, aborted itd) [1 pkt]-->\n", "4. Trenowanie modelu potrafi zająć bardzo dużo czasu. Sprawdzanie co 10 minut, czy już się zakończyło, to zły pomysł. Dodaj powiadomienie (wysyłane przez email na Teamsowy kanał \"Powiadomienia z Jenkins\") o zakończonym jobie zawierające rezultat (Status builda - successfull, failed, aborted itd) [1 pkt]\n",
"5. Dodaj parametr umożliwiający przekazanie do skryptu trenującego parametrów trenowania. Najprościej zrobić to dodając parametr typu String i doklejać jego wartość do wywołania skryptu trenującego. [1 pkt]" "5. Dodaj parametr umożliwiający przekazanie do skryptu trenującego parametrów trenowania. Najprościej zrobić to dodając parametr typu String i doklejać jego wartość do wywołania skryptu trenującego. [1 pkt]"
] ]
}, },
@ -201,12 +201,11 @@
} }
}, },
"source": [ "source": [
"## Zadanie 2 [15 pkt] (termin: 2023-05-12)\n", "## Zadanie 2 [15 pkt] (termin: 2 V 2022)\n",
"1. Stwórz na Jenkins projekt typu Multibranch pipeline o nazwie s123456-evaluation.eg\n", "1. Stwórz na Jenkins projekt typu Multibranch pipeline o nazwie s123456-evaluation.\n",
" Projekt ten będzie przeprowadzał ewaluację modelu stworzonego w s123456-training na danych ze zbioru testującego [1 pkt]\n", " Projekt ten będzie przeprowadzał ewaluację modelu stworzonego w s123456-training na danych ze zbioru trenującego [1 pkt]\n",
"2. Ewaluacja polega na:\n", "2. Ewaluacja polega na:\n",
" - skopiowanie modelu z artefaktu z projektu training\n", " - wczytaniu wytrenowanego wcześniej modelu\n",
" - wczytaniu tego modelu\n",
" - dokonaniu predykcji na zbiorze testowym za pomocą wczytanego modelu i zapisanie wyników tej predykcji do pliku\n", " - dokonaniu predykcji na zbiorze testowym za pomocą wczytanego modelu i zapisanie wyników tej predykcji do pliku\n",
" - wyliczeniu zbiorczych metryk (1-3 metryki) na zbiorze testującym (np. Accuracy, Micro-avg precission/recall, F1, RMSE - patrz [wykład 4. \"Metody ewaluacji\"])(https://git.wmi.amu.edu.pl/AITech/aitech-uma/src/branch/master/wyk/04_Metody_ewaluacji.ipynb) z przedmiotu Uczenie Maszynowe), \n", " - wyliczeniu zbiorczych metryk (1-3 metryki) na zbiorze testującym (np. Accuracy, Micro-avg precission/recall, F1, RMSE - patrz [wykład 4. \"Metody ewaluacji\"])(https://git.wmi.amu.edu.pl/AITech/aitech-uma/src/branch/master/wyk/04_Metody_ewaluacji.ipynb) z przedmiotu Uczenie Maszynowe), \n",
" - zapisaniu metryk do pliku\n", " - zapisaniu metryk do pliku\n",
@ -248,7 +247,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.16" "version": "3.6.9"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -12,7 +12,7 @@
"<div class=\"alert alert-block alert-info\">\n", "<div class=\"alert alert-block alert-info\">\n",
"<h1> Inżynieria uczenia maszynowego </h1>\n", "<h1> Inżynieria uczenia maszynowego </h1>\n",
"<h2> 7. <i>Sacred</i> [laboratoria]</h2> \n", "<h2> 7. <i>Sacred</i> [laboratoria]</h2> \n",
"<h3> Tomasz Ziętkiewicz (2023)</h3>\n", "<h3> Tomasz Ziętkiewicz (2021)</h3>\n",
"</div>\n", "</div>\n",
"\n", "\n",
"![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)" "![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)"
@ -35,21 +35,6 @@
" <cite>&mdash;https://github.com/IDSIA/sacred / [Sens życia według Monty Pythona](https://en.wikipedia.org/wiki/Every_Sperm_Is_Sacred) </cite>" " <cite>&mdash;https://github.com/IDSIA/sacred / [Sens życia według Monty Pythona](https://en.wikipedia.org/wiki/Every_Sperm_Is_Sacred) </cite>"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"- https://sacred.readthedocs.io/ - dokumentacja\n",
"- https://github.com/IDSIA/sacred - Github\n",
"- Open source\n",
"- Prosty w użyciu\n",
"- Wiele webowych frontendów"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@ -115,7 +100,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 4,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -126,18 +111,70 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Requirement already satisfied: sacred in /home/tomek/miniconda3/lib/python3.9/site-packages (0.8.4)\n", "Collecting sacred\n",
"Requirement already satisfied: jsonpickle>=1.2 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (3.0.1)\n", "\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"Requirement already satisfied: colorama>=0.4 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (0.4.6)\n", "\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"Requirement already satisfied: GitPython in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (3.1.31)\n", " Downloading https://files.pythonhosted.org/packages/f4/8c/b99f668e8ca9747dcd374bb46cac808e58f3cb8e446df1b3e667f6be9778/sacred-0.8.2-py2.py3-none-any.whl (106kB)\n",
"Requirement already satisfied: py-cpuinfo>=4.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (9.0.0)\n", "\u001b[K 100% |████████████████████████████████| 112kB 1.2MB/s ta 0:00:01\n",
"Requirement already satisfied: wrapt<2.0,>=1.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (1.15.0)\n", "\u001b[?25hCollecting py-cpuinfo>=4.0 (from sacred)\n",
"Requirement already satisfied: munch<3.0,>=2.5 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (2.5.0)\n", "\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"Requirement already satisfied: docopt<1.0,>=0.3 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (0.6.2)\n", "\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"Requirement already satisfied: packaging>=18.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (23.0)\n", " Downloading https://files.pythonhosted.org/packages/e6/ba/77120e44cbe9719152415b97d5bfb29f4053ee987d6cb63f55ce7d50fadc/py-cpuinfo-8.0.0.tar.gz (99kB)\n",
"Requirement already satisfied: six in /home/tomek/miniconda3/lib/python3.9/site-packages (from munch<3.0,>=2.5->sacred) (1.16.0)\n", "\u001b[K 100% |████████████████████████████████| 102kB 1.4MB/s a 0:00:01\n",
"Requirement already satisfied: gitdb<5,>=4.0.1 in /home/tomek/miniconda3/lib/python3.9/site-packages (from GitPython->sacred) (4.0.10)\n", "\u001b[?25hCollecting wrapt<2.0,>=1.0 (from sacred)\n",
"Requirement already satisfied: smmap<6,>=3.0.1 in /home/tomek/miniconda3/lib/python3.9/site-packages (from gitdb<5,>=4.0.1->GitPython->sacred) (5.0.0)\n" "\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/ba/8c/3d3dff02ae905157ba417b801f4a7aa4e6fedbc43882e9c765b7aae438ac/wrapt-1.14.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (74kB)\n",
"\u001b[K 100% |████████████████████████████████| 81kB 2.0MB/s ta 0:00:01\n",
"\u001b[?25hCollecting jsonpickle<2.0,>=1.2 (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/e9/ec/35910cf6ab87f8a013036f01f732f871a23b6058123a7bd0c7b08fbbc937/jsonpickle-1.5.2-py2.py3-none-any.whl\n",
"Collecting colorama>=0.4 (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl\n",
"Collecting munch<3.0,>=2.0.2 (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/cc/ab/85d8da5c9a45e072301beb37ad7f833cd344e04c817d97e0cc75681d248f/munch-2.5.0-py2.py3-none-any.whl\n",
"Collecting packaging>=18.0 (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Using cached https://files.pythonhosted.org/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl\n",
"Collecting GitPython (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/55/60/f884f01eef2a7255875862ec1b12d57d74113ec6e8d9e16c4d254cd6aa3c/GitPython-3.1.20-py3-none-any.whl (178kB)\n",
"\u001b[K 100% |████████████████████████████████| 184kB 1.9MB/s ta 0:00:01\n",
"\u001b[?25hCollecting docopt<1.0,>=0.3 (from sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz\n",
"Collecting importlib-metadata; python_version < \"3.8\" (from jsonpickle<2.0,>=1.2->sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Using cached https://files.pythonhosted.org/packages/a0/a1/b153a0a4caf7a7e3f15c2cd56c7702e2cf3d89b1b359d1f1c5e59d68f4ce/importlib_metadata-4.8.3-py3-none-any.whl\n",
"Collecting six (from munch<3.0,>=2.0.2->sacred)\n",
" Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl\n",
"Collecting pyparsing!=3.0.5,>=2.0.2 (from packaging>=18.0->sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Using cached https://files.pythonhosted.org/packages/d9/41/d9cfb4410589805cd787f8a82cddd13142d9bf7449d12adf2d05a4a7d633/pyparsing-3.0.8-py3-none-any.whl\n",
"Collecting gitdb<5,>=4.0.1 (from GitPython->sacred)\n",
" Downloading https://files.pythonhosted.org/packages/a3/7c/5d747655049bfbf75b5fcec57c8115896cb78d6fafa84f6d3ef4c0f13a98/gitdb-4.0.9-py3-none-any.whl (63kB)\n",
"\u001b[K 100% |████████████████████████████████| 71kB 1.9MB/s ta 0:00:01\n",
"\u001b[?25hCollecting typing-extensions>=3.7.4.3; python_version < \"3.10\" (from GitPython->sacred)\n",
" Using cached https://files.pythonhosted.org/packages/45/6b/44f7f8f1e110027cf88956b59f2fad776cca7e1704396d043f89effd3a0e/typing_extensions-4.1.1-py3-none-any.whl\n",
"Collecting zipp>=0.5 (from importlib-metadata; python_version < \"3.8\"->jsonpickle<2.0,>=1.2->sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Using cached https://files.pythonhosted.org/packages/bd/df/d4a4974a3e3957fd1c1fa3082366d7fff6e428ddb55f074bf64876f8e8ad/zipp-3.6.0-py3-none-any.whl\n",
"Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->GitPython->sacred)\n",
"\u001b[33m Cache entry deserialization failed, entry ignored\u001b[0m\n",
" Downloading https://files.pythonhosted.org/packages/6d/01/7caa71608bc29952ae09b0be63a539e50d2484bc37747797a66a60679856/smmap-5.0.0-py3-none-any.whl\n",
"Building wheels for collected packages: py-cpuinfo, docopt\n",
" Running setup.py bdist_wheel for py-cpuinfo ... \u001b[?25ldone\n",
"\u001b[?25h Stored in directory: /home/tomek/.cache/pip/wheels/2e/15/f5/aa2a056d223903b52cf4870134e3a01df0c723816835dd08db\n",
" Running setup.py bdist_wheel for docopt ... \u001b[?25ldone\n",
"\u001b[?25h Stored in directory: /home/tomek/.cache/pip/wheels/9b/04/dd/7daf4150b6d9b12949298737de9431a324d4b797ffd63f526e\n",
"Successfully built py-cpuinfo docopt\n",
"Installing collected packages: py-cpuinfo, wrapt, typing-extensions, zipp, importlib-metadata, jsonpickle, colorama, six, munch, pyparsing, packaging, smmap, gitdb, GitPython, docopt, sacred\n",
"Successfully installed GitPython-3.1.20 colorama-0.4.4 docopt-0.6.2 gitdb-4.0.9 importlib-metadata-4.8.3 jsonpickle-1.5.2 munch-2.5.0 packaging-21.3 py-cpuinfo-8.0.0 pyparsing-3.0.8 sacred-0.8.2 six-1.16.0 smmap-5.0.0 typing-extensions-4.1.1 wrapt-1.14.0 zipp-3.6.0\n"
] ]
} }
], ],
@ -186,7 +223,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 14,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -240,7 +277,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 15,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -278,7 +315,6 @@
" -f --force Disable warnings about suspicious changes for\r\n", " -f --force Disable warnings about suspicious changes for\r\n",
" this run.\r\n", " this run.\r\n",
" -h --help Print this help message and exit.\r\n", " -h --help Print this help message and exit.\r\n",
" -i VALUE --id=VALUE Set the id for this run.\r\n",
" -l VALUE --loglevel=VALUE Set the LogLevel. Loglevel either as 0 - 50 or\r\n", " -l VALUE --loglevel=VALUE Set the LogLevel. Loglevel either as 0 - 50 or\r\n",
" as string: DEBUG(10), INFO(20), WARNING(30),\r\n", " as string: DEBUG(10), INFO(20), WARNING(30),\r\n",
" ERROR(40), CRITICAL(50)\r\n", " ERROR(40), CRITICAL(50)\r\n",
@ -357,7 +393,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 5,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -386,7 +422,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 6,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -413,10 +449,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<sacred.run.Run at 0x7f89cc3175b0>" "<sacred.run.Run at 0x7f641e9ddba8>"
] ]
}, },
"execution_count": 9, "execution_count": 6,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -438,7 +474,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 19,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -451,7 +487,7 @@
"{'recipient': 'Świecie', 'greeting': 'Witaj', 'message': 'Witaj Świecie!'}" "{'recipient': 'Świecie', 'greeting': 'Witaj', 'message': 'Witaj Świecie!'}"
] ]
}, },
"execution_count": 10, "execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -500,7 +536,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 21,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -525,7 +561,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 24,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -542,7 +578,7 @@
" greeting = 'Witaj'\r\n", " greeting = 'Witaj'\r\n",
" message = 'Witaj Świecie!'\r\n", " message = 'Witaj Świecie!'\r\n",
" recipient = 'Świecie'\r\n", " recipient = 'Świecie'\r\n",
" seed = 269258424 \u001b[2m# the random seed for this experiment\u001b[0m\r\n", " seed = 539001265 \u001b[2m# the random seed for this experiment\u001b[0m\r\n",
"INFO - sacred_scopes - Completed after 0:00:00\r\n" "INFO - sacred_scopes - Completed after 0:00:00\r\n"
] ]
} }
@ -553,7 +589,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 90,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -570,7 +606,7 @@
" greeting = 'Witaj'\r\n", " greeting = 'Witaj'\r\n",
" message = 'Witaj Przygodo!'\r\n", " message = 'Witaj Przygodo!'\r\n",
"\u001b[34m recipient = 'Przygodo'\u001b[0m\r\n", "\u001b[34m recipient = 'Przygodo'\u001b[0m\r\n",
" seed = 667939214 \u001b[2m# the random seed for this experiment\u001b[0m\r\n", " seed = 215765170 \u001b[2m# the random seed for this experiment\u001b[0m\r\n",
"INFO - sacred_scopes - Completed after 0:00:00\r\n" "INFO - sacred_scopes - Completed after 0:00:00\r\n"
] ]
} }
@ -592,13 +628,24 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
}, },
"outputs": [], "outputs": [
{
"data": {
"text/plain": [
"{'recipient': 'samotności', 'greeting': 'Żegnaj'}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"# %load IUM_07/config.json\n", "# %load IUM_07/config.json\n",
"{\n", "{\n",
@ -609,7 +656,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 119,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -639,7 +686,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 120,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -670,7 +717,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 121,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -680,10 +727,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"{'recipient': 'samotności', 'greeting': 'Żegnaj', 'seed': 877272352}" "{'recipient': 'samotności', 'greeting': 'Żegnaj', 'seed': 529757761}"
] ]
}, },
"execution_count": 22, "execution_count": 121,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -705,7 +752,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 124,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -751,7 +798,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 193,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -779,10 +826,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<sacred.run.Run at 0x7f89a0db5550>" "<sacred.run.Run at 0x7f423c40d820>"
] ]
}, },
"execution_count": 24, "execution_count": 193,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -826,30 +873,8 @@
" - podstawowe informacje o środowisku (maszynie), na której przeprowadzono eksperyment\n", " - podstawowe informacje o środowisku (maszynie), na której przeprowadzono eksperyment\n",
" - użyte pliki źródłowe\n", " - użyte pliki źródłowe\n",
" - użyte zależności i ich wersje\n", " - użyte zależności i ich wersje\n",
" - pliki otwarte za pomocą [ex.open_resource()](https://sacred.readthedocs.io/en/stable/apidoc.html#sacred.Experiment.open_resource) albo [ex.add_resource()](https://sacred.readthedocs.io/en/stable/apidoc.html#sacred.Experiment.add_resource)\n", " - pliki otwarte za pomocą ex.open_resource\n",
" - pliki dodane za pomocą [ex.add_artifact()](https://sacred.readthedocs.io/en/stable/apidoc.html#sacred.run.Run.add_artifact)" " - pliki dodane za pomocą ex.add_artifact"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 20\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 1\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 2\r\n",
"drwxr-sr-x 2 tomek tomek 4096 Apr 12 15:11 3\r\n",
"drwxr-sr-x 2 tomek tomek 4096 Apr 12 15:11 _resources\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 _sources\r\n"
]
}
],
"source": [
"!ls -l my_runs"
] ]
}, },
{ {
@ -887,13 +912,21 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 9,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
} }
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting IUM_07/file_observer.py\n"
]
}
],
"source": [ "source": [
"%%writefile IUM_07/file_observer.py\n", "%%writefile IUM_07/file_observer.py\n",
"from sacred.observers import FileStorageObserver\n", "from sacred.observers import FileStorageObserver\n",
@ -919,7 +952,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 11,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
@ -931,7 +964,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO - file_observer - Running command 'my_main'\r\n", "INFO - file_observer - Running command 'my_main'\r\n",
"INFO - file_observer - Started run with ID \"4\"\r\n", "INFO - file_observer - Started run with ID \"1\"\r\n",
"Witaj Świecie!\r\n", "Witaj Świecie!\r\n",
"INFO - file_observer - Completed after 0:00:00\r\n" "INFO - file_observer - Completed after 0:00:00\r\n"
] ]
@ -954,7 +987,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 12,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -965,13 +998,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"total 24\r\n", "total 0\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 1\r\n", "drwxr-xr-x 1 tomek tomek 512 Apr 25 09:51 1\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 2\r\n", "drwxr-xr-x 1 tomek tomek 512 Apr 25 09:51 _sources\r\n"
"drwxr-sr-x 2 tomek tomek 4096 Apr 12 15:11 3\r\n",
"drwxr-sr-x 2 tomek tomek 4096 Apr 20 12:09 4\r\n",
"drwxr-sr-x 2 tomek tomek 4096 Apr 12 15:11 _resources\r\n",
"drwsrwsr-t 2 tomek tomek 4096 May 28 2022 _sources\r\n"
] ]
} }
], ],
@ -981,7 +1010,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 14,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -992,11 +1021,11 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"total 16\r\n", "total 4\r\n",
"-rw-r--r-- 1 tomek tomek 77 May 28 2022 config.json\r\n", "-rw-r--r-- 1 tomek tomek 77 Apr 25 09:51 config.json\r\n",
"-rw-r--r-- 1 tomek tomek 159 May 28 2022 cout.txt\r\n", "-rw-r--r-- 1 tomek tomek 159 Apr 25 09:51 cout.txt\r\n",
"-rw-r--r-- 1 tomek tomek 2 May 28 2022 metrics.json\r\n", "-rw-r--r-- 1 tomek tomek 2 Apr 25 09:51 metrics.json\r\n",
"-rw-r--r-- 1 tomek tomek 1659 May 28 2022 run.json\r\n" "-rw-r--r-- 1 tomek tomek 1659 Apr 25 09:51 run.json\r\n"
] ]
} }
], ],
@ -1024,7 +1053,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 16,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1130,7 +1159,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 170,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1142,7 +1171,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"total 4\r\n", "total 4\r\n",
"-rw-r--r-- 1 tomek tomek 464 May 28 2022 file_observer_cd34a0ef4a32fb0a966eaa01ea6371ad.py\r\n" "-rw-rw-r-- 1 tomek tomek 463 kwi 26 10:21 file_observer_bb0a5c4720d1072b641d23da080696b6.py\r\n"
] ]
} }
], ],
@ -1161,7 +1190,8 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# %load my_runs/_sources/file_observer_cd34a0ef4a32fb0a966eaa01ea6371ad.py\n", "## Źródła zostały zapisane\n",
"# %load my_runs/_sources/file_observer_bb0a5c4720d1072b641d23da080696b6.py\n",
"from sacred.observers import FileStorageObserver\n", "from sacred.observers import FileStorageObserver\n",
"from sacred import Experiment\n", "from sacred import Experiment\n",
"\n", "\n",
@ -1180,7 +1210,7 @@
"\n", "\n",
"@ex.automain\n", "@ex.automain\n",
"def my_main(recipient, greeting):\n", "def my_main(recipient, greeting):\n",
" print(prepare_message()) ## Nie musimy przekazywać wartości\n" " print(prepare_message()) ## Nie musimy przekazywać wartości"
] ]
}, },
{ {
@ -1196,7 +1226,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 22,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1208,7 +1238,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO - file_observer - Running command 'my_main'\n", "INFO - file_observer - Running command 'my_main'\n",
"INFO - file_observer - Started run with ID \"5\"\n", "INFO - file_observer - Started run with ID \"2\"\n",
"INFO - file_observer - Completed after 0:00:00\n" "INFO - file_observer - Completed after 0:00:00\n"
] ]
}, },
@ -1251,7 +1281,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 185,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1263,13 +1293,13 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{\r\n", "{\r\n",
" \"prepare_message_ts\": \"2023-04-20 12:10:28.197315\"\r\n", " \"prepare_message_ts\": \"2021-04-26 10:39:59.268539\"\r\n",
"}" "}"
] ]
} }
], ],
"source": [ "source": [
"cat my_runs/5/info.json" "cat my_runs/6/info.json"
] ]
}, },
{ {
@ -1289,107 +1319,6 @@
"```" "```"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Otwieranie zasobów\n",
"- Zmiana danych wejściowych wpłwa w oczywisty sposób na wyniki\n",
"- Dlatego warto śledzić te zmiany za pomocą:\n",
" - [ex.open_resource()](https://sacred.readthedocs.io/en/stable/apidoc.html#sacred.Experiment.open_resource)\n",
" - [ex.add_resource()](https://sacred.readthedocs.io/en/stable/apidoc.html#sacred.Experiment.add_resource)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - resources - Running command 'my_main'\n",
"INFO - resources - Started run with ID \"6\"\n",
"INFO - resources - Completed after 0:00:00\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species\n",
"\n"
]
},
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7f89a0db5a30>"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from sacred import Experiment\n",
"from sacred.observers import FileStorageObserver\n",
"\n",
"\n",
"ex = Experiment(\"resources\", interactive=True)\n",
"ex.observers.append(FileStorageObserver('my_runs'))\n",
"\n",
"@ex.main\n",
"def my_main():\n",
" f = ex.open_resource(\"Iris.csv\", \"r\")\n",
" print(f.readline())\n",
" \n",
"ex.run()"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 8\r\n",
"-rw-r--r-- 1 tomek tomek 5107 Apr 12 15:11 Iris_717820ef0af287ff346c5cabfb4c612c.csv\r\n"
]
}
],
"source": [
"!ls -l my_runs/_resources"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"my_runs/6/run.json: \"name\": \"resources\",\r\n",
"my_runs/6/run.json: \"resources\": [\r\n",
"my_runs/6/run.json: \"my_runs/_resources/Iris_717820ef0af287ff346c5cabfb4c612c.csv\"\r\n"
]
}
],
"source": [
"!grep -e \"resources\" -R my_runs/6"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@ -1407,7 +1336,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 19,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1418,8 +1347,11 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Requirement already satisfied: pymongo in /home/tomek/miniconda3/lib/python3.9/site-packages (4.3.3)\r\n", "Collecting pymongo\n",
"Requirement already satisfied: dnspython<3.0.0,>=1.16.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from pymongo) (2.3.0)\r\n" " Downloading https://files.pythonhosted.org/packages/10/3b/46541b4ee3000019b8ef5b1847292ddc77f492c162bc4d49c424db7fc97a/pymongo-4.1.1-cp36-cp36m-manylinux1_x86_64.whl (464kB)\n",
"\u001b[K 100% |████████████████████████████████| 471kB 959kB/s ta 0:00:01\n",
"\u001b[?25hInstalling collected packages: pymongo\n",
"Successfully installed pymongo-4.1.1\n"
] ]
} }
], ],
@ -1429,7 +1361,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 23,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -1441,7 +1373,76 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO - sacred_scopes - Running command 'my_main'\n", "INFO - sacred_scopes - Running command 'my_main'\n",
"ERROR - sacred_scopes - Failed after 0:00:30!\n" "ERROR - sacred_scopes - Failed after 0:00:30!\n",
"ERROR - sacred_scopes - Traceback (most recent call last):\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/run.py\", line 235, in __call__\n",
" self._emit_started()\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/run.py\", line 333, in _emit_started\n",
" _id=self._id,\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\", line 258, in started_event\n",
" self.insert()\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\", line 367, in insert\n",
" c.next()[\"_id\"] + 1 if self.runs.count_documents({}, limit=1) else 1\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/collection.py\", line 1811, in count_documents\n",
" return self._retryable_non_cursor_read(_cmd, session)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/collection.py\", line 1816, in _retryable_non_cursor_read\n",
" with client._tmp_session(session) as s:\n",
" File \"/usr/lib/python3.6/contextlib.py\", line 81, in __enter__\n",
" return next(self.gen)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\", line 1676, in _tmp_session\n",
" s = self._ensure_session(session)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\", line 1663, in _ensure_session\n",
" return self.__start_session(True, causal_consistency=False)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\", line 1608, in __start_session\n",
" self._topology._check_implicit_session_support()\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/topology.py\", line 519, in _check_implicit_session_support\n",
" self._check_session_support()\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/topology.py\", line 536, in _check_session_support\n",
" readable_server_selector, self._settings.server_selection_timeout, None\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/pymongo/topology.py\", line 229, in _select_servers_loop\n",
" % (self._error_message(selector), timeout, self.description)\n",
"pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 6266603d3269f60a67f61383, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused',)>]>\n",
"\n",
"During handling of the above exception, another exception occurred:\n",
"\n",
"Traceback (most recent call last):\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/run.py\", line 429, in _final_call\n",
" getattr(observer, method)(**kwargs)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\", line 283, in failed_event\n",
" self.final_save(attempts=1)\n",
" File \"/home/tomek/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\", line 421, in final_save\n",
" os.makedirs(self.failure_dir, exist_ok=True)\n",
" File \"/usr/lib/python3.6/os.py\", line 205, in makedirs\n",
" head, tail = path.split(name)\n",
" File \"/usr/lib/python3.6/posixpath.py\", line 107, in split\n",
" p = os.fspath(p)\n",
"TypeError: expected str, bytes or os.PathLike object, not NoneType\n",
"\n"
]
},
{
"ename": "ServerSelectionTimeoutError",
"evalue": "localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 6266603d3269f60a67f61383, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused',)>]>",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mServerSelectionTimeoutError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-23-95f1b404dde7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprepare_message\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m## Nie musimy przekazywać wartości\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0mex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/sacred/experiment.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, command_name, config_updates, named_configs, info, meta_info, options)\u001b[0m\n\u001b[1;32m 274\u001b[0m \u001b[0mcommand_name\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig_updates\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnamed_configs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minfo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmeta_info\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 275\u001b[0m )\n\u001b[0;32m--> 276\u001b[0;31m \u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 277\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mrun\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 278\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/sacred/run.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *args)\u001b[0m\n\u001b[1;32m 233\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 234\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mcapture_stdout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_output_file\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 235\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_emit_started\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 236\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_start_heartbeat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 237\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execute_pre_run_hooks\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/sacred/run.py\u001b[0m in \u001b[0;36m_emit_started\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 331\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 332\u001b[0m \u001b[0mmeta_info\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmeta_info\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 333\u001b[0;31m \u001b[0m_id\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_id\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 334\u001b[0m )\n\u001b[1;32m 335\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_id\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\u001b[0m in \u001b[0;36mstarted_event\u001b[0;34m(self, ex_info, command, host_info, start_time, config, meta_info, _id)\u001b[0m\n\u001b[1;32m 256\u001b[0m \u001b[0;31m# save sources\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 257\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_entry\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"experiment\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"sources\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msave_sources\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mex_info\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 258\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 259\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_entry\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"_id\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 260\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/sacred/observers/mongo.py\u001b[0m in \u001b[0;36minsert\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 365\u001b[0m \u001b[0mc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"_id\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpymongo\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDESCENDING\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlimit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 366\u001b[0m self.run_entry[\"_id\"] = (\n\u001b[0;32m--> 367\u001b[0;31m \u001b[0mc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"_id\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mruns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcount_documents\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlimit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 368\u001b[0m )\n\u001b[1;32m 369\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/collection.py\u001b[0m in \u001b[0;36mcount_documents\u001b[0;34m(self, filter, session, comment, **kwargs)\u001b[0m\n\u001b[1;32m 1809\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"n\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1810\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1811\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_retryable_non_cursor_read\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_cmd\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1812\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1813\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_retryable_non_cursor_read\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/collection.py\u001b[0m in \u001b[0;36m_retryable_non_cursor_read\u001b[0;34m(self, func, session)\u001b[0m\n\u001b[1;32m 1814\u001b[0m \u001b[0;34m\"\"\"Non-cursor read helper to handle implicit session creation.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1815\u001b[0m \u001b[0mclient\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__database\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1816\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_tmp_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1817\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_retryable_read\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_read_preference_for\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1818\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.6/contextlib.py\u001b[0m in \u001b[0;36m__enter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__enter__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 81\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgen\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 82\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"generator didn't yield\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\u001b[0m in \u001b[0;36m_tmp_session\u001b[0;34m(self, session, close)\u001b[0m\n\u001b[1;32m 1674\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1675\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1676\u001b[0;31m \u001b[0ms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ensure_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1677\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1678\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\u001b[0m in \u001b[0;36m_ensure_session\u001b[0;34m(self, session)\u001b[0m\n\u001b[1;32m 1661\u001b[0m \u001b[0;31m# Don't make implicit sessions causally consistent. Applications\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1662\u001b[0m \u001b[0;31m# should always opt-in.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1663\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__start_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcausal_consistency\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1664\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mConfigurationError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mInvalidOperation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1665\u001b[0m \u001b[0;31m# Sessions not supported.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/mongo_client.py\u001b[0m in \u001b[0;36m__start_session\u001b[0;34m(self, implicit, **kwargs)\u001b[0m\n\u001b[1;32m 1606\u001b[0m \u001b[0;31m# Raises ConfigurationError if sessions are not supported.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1607\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mimplicit\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1608\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_topology\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_implicit_session_support\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1609\u001b[0m \u001b[0mserver_session\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_EmptyServerSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1610\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/topology.py\u001b[0m in \u001b[0;36m_check_implicit_session_support\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 517\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_check_implicit_session_support\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 518\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_lock\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 519\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_session_support\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 520\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 521\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_check_session_support\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/topology.py\u001b[0m in \u001b[0;36m_check_session_support\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 534\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_description\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadable_servers\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m self._select_servers_loop(\n\u001b[0;32m--> 536\u001b[0;31m \u001b[0mreadable_server_selector\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_settings\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mserver_selection_timeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 537\u001b[0m )\n\u001b[1;32m 538\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.6/site-packages/pymongo/topology.py\u001b[0m in \u001b[0;36m_select_servers_loop\u001b[0;34m(self, selector, timeout, address)\u001b[0m\n\u001b[1;32m 227\u001b[0m raise ServerSelectionTimeoutError(\n\u001b[1;32m 228\u001b[0m \u001b[0;34m\"%s, Timeout: %ss, Topology Description: %r\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 229\u001b[0;31m \u001b[0;34m%\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_error_message\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mselector\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdescription\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 230\u001b[0m )\n\u001b[1;32m 231\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mServerSelectionTimeoutError\u001b[0m: localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 6266603d3269f60a67f61383, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused',)>]>"
] ]
} }
], ],
@ -1450,9 +1451,9 @@
"from sacred import Experiment\n", "from sacred import Experiment\n",
"\n", "\n",
"ex = Experiment(\"sacred_scopes\", interactive=True)\n", "ex = Experiment(\"sacred_scopes\", interactive=True)\n",
"ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017',\n", "ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password@localhost:27017',\n",
" db_name='sacred')) # Tutaj podajemy dane uwierzytelniające i nazwę bazy skonfigurowane w pliku .env podczas uruchamiania bazy.\n", " db_name='sacred')) # Tutaj podajemy dane uwierzytelniające i nazwę bazy skonfigurowane w pliku .env podczas uruchamiania bazy.\n",
"# W przypadku instancji na Jenkinsie url będzie wyglądał następująco: mongodb://admin:IUM_2021@172.17.0.1:27017\n", "# W przypadku instancji na Jenkinsie url będzie wyglądał następująco: mongodb://mongo_user:mongo_password_IUM_2021@localhost:27017\n",
"@ex.config\n", "@ex.config\n",
"def my_config():\n", "def my_config():\n",
" recipient = \"Świecie\"\n", " recipient = \"Świecie\"\n",
@ -1500,13 +1501,46 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 192,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
} }
}, },
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Running command 'my_main'\n",
"INFO - sacred_scopes - Started run with ID \"9\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Witaj Świecie!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Completed after 0:00:50\n"
]
},
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7f423c2de550>"
]
},
"execution_count": 192,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"from sacred.observers import MongoObserver\n", "from sacred.observers import MongoObserver\n",
"from sacred import Experiment\n", "from sacred import Experiment\n",
@ -1514,9 +1548,9 @@
"import time\n", "import time\n",
"\n", "\n",
"ex = Experiment(\"sacred_scopes\", interactive=True)\n", "ex = Experiment(\"sacred_scopes\", interactive=True)\n",
"ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017',\n", "ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password@localhost:27017',\n",
" db_name='sacred')) # Tutaj podajemy dane uwierzytelniające i nazwę bazy skonfigurowane w pliku .env podczas uruchamiania bazy.\n", " db_name='sacred')) # Tutaj podajemy dane uwierzytelniające i nazwę bazy skonfigurowane w pliku .env podczas uruchamiania bazy.\n",
"# W przypadku instancji na Jenkinsie url będzie wyglądał następująco: mongodb://admin:IUM_2021@172.17.0.1:27017\n", "# W przypadku instancji na Jenkinsie url będzie wyglądał następująco: mongodb://mongo_user:mongo_password_IUM_2021@localhost:27017\n",
"@ex.config\n", "@ex.config\n",
"def my_config():\n", "def my_config():\n",
" recipient = \"Świecie\"\n", " recipient = \"Świecie\"\n",
@ -1567,12 +1601,11 @@
} }
}, },
"source": [ "source": [
"## Zadanie [15 pkt] (do 2023-06-?)\n", "## Zadanie [15 pkt] (do 9 V 2021)\n",
"1. \"Owiń\" wywołanie swojego eksperymentu za pomocą Sacred, w ten sposób, żeby zapisane zostały [10pkt]:\n", "1. \"Owiń\" wywołanie swojego eksperymentu za pomocą Sacred, w ten sposób, żeby zapisane zostały [10pkt]:\n",
" - parametry, z którymi wywołany był trening\n", " - parametry, z którymi wywołany był trening\n",
" - powstały plik z modelem (jako artefakt)\n", " - powstały plik z modelem (jako artefakt)\n",
" - kod źródłowy użyty do przeprowadzenia treningu\n", " - kod źródłowy użyty do przeprowadzenia treningu\n",
" - pliki wejściowe otwarte za pomocą open_resource\n",
" - metryki\n", " - metryki\n",
" \n", " \n",
"Jako nazwę eksperymentu użyj swojego numeru indeksu tak, żebyś mogła/mógł je odnaleźć w Omniboard\n", "Jako nazwę eksperymentu użyj swojego numeru indeksu tak, żebyś mogła/mógł je odnaleźć w Omniboard\n",
@ -1588,7 +1621,7 @@
"celltoolbar": "Slideshow", "celltoolbar": "Slideshow",
"email": "tomasz.zietkiewicz@amu.edu.pl", "email": "tomasz.zietkiewicz@amu.edu.pl",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -1603,7 +1636,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.12" "version": "3.10.4"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

View File

@ -1,9 +0,0 @@
FROM ubuntu:latest
RUN apt update && apt install -y \
git \
python3-pip \
python3
RUN python3 -m pip install sacred pymongo

13
IUM_07/Jenkinsfile vendored
View File

@ -1,13 +0,0 @@
node {
checkout scm
//Pierwszy argument to tag, który zostania nadany zbudowanemu obrazowi
//Jeśli chcemy użyć Dockerfile z innej ścieżki niż ./Dockerfile, możemy ją podać jako drugi argument
def testImage = docker.build("sacred_pymongo", "./IUM_07/")
//Wszystkie polecenia poniżej wykonają się w kontenerze, z podmontowanym Workspace Jenkinsa
testImage.inside {
dir ("IUM_07"){
sh 'python3 mongo_observer.py'
}
}
}

View File

@ -1,39 +0,0 @@
from sacred.observers import MongoObserver
from sacred import Experiment
import random
import time
ex = Experiment("sacred_scopes", interactive=True)
ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017', db_name='sacred'))
#ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password@localhost:27017',
# db_name='sacred')) # Tutaj podajemy dane uwierzytelniające i nazwę bazy skonfigurowane w pliku .env podczas uruchamiania bazy.
# W przypadku instancji na Jenkinsie url będzie wyglądał następująco: mongodb://mongo_user:mongo_password_IUM_2021@localhost:27017
@ex.config
def my_config():
recipient = "Świecie"
greeting = "Witaj"
@ex.capture
def prepare_message(recipient, greeting):
return "{0} {1}!".format(greeting, recipient)
@ex.main
def my_main(recipient, greeting, _run):
print(prepare_message()) ## Nie musimy przekazywać wartości
counter = 0
while counter < 20:
counter+=1
value = counter
ms_to_wait = random.randint(5, 5000)
time.sleep(ms_to_wait/1000)
noise = 1.0 + 0.1 * (random.randint(0, 10) - 5)
# This will add an entry for training.loss metric in every second iteration.
# The resulting sequence of steps for training.loss will be 0, 2, 4, ...
if counter % 2 == 0:
_run.log_scalar("training.loss", value * 1.5 * noise, counter)
# Implicit step counter (0, 1, 2, 3, ...)
# incremented with each call for training.accuracy:
_run.log_scalar("training.accuracy", value * 2 * noise)
ex.run()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,8 @@
"![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n", "![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n",
"<div class=\"alert alert-block alert-info\">\n", "<div class=\"alert alert-block alert-info\">\n",
"<h1> Inżynieria uczenia maszynowego </h1>\n", "<h1> Inżynieria uczenia maszynowego </h1>\n",
"<h2> 11. <i>Github actions</i> [laboratoria]</h2> \n", "<h2> 11. <i>Github actions i CML</i> [laboratoria]</h2> \n",
"<h3> Tomasz Ziętkiewicz (2023)</h3>\n", "<h3> Tomasz Ziętkiewicz (2022)</h3>\n",
"</div>\n", "</div>\n",
"\n", "\n",
"![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)" "![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)"
@ -70,8 +70,8 @@
"source": [ "source": [
"### Terminologia Github Actions\n", "### Terminologia Github Actions\n",
" - *Workflow* - workflow odpowiada \"Pipeline\" z Jenkinsa.\n", " - *Workflow* - workflow odpowiada \"Pipeline\" z Jenkinsa.\n",
" - *Event* - zdarzenie, które odapala (\"triggers\") \"Workflow\". Np. wypchnięcie zmiany do repozytorium (\"push\"), utworzenie Pull requesta. [Pełna lista](https://docs.github.com/en/actions/reference/events-that-trigger-workflows)\n", " - *Event* - zdażenie, które odapala (\"triggers\") uruchomienie \"Workflow\". Np. wypchnięcie zmiany do repozytorium (\"push\"), utworzenie Pull requesta. [Pełna lista](https://docs.github.com/en/actions/reference/events-that-trigger-workflows)\n",
" - *Job* - workflow składa się z jednego lub kilku zadań (\"jobs\"). Każde z nich może być wykonywane równolegle na innej maszynie (patrz \"runner\")\n", " - *Job* - workflow składa się z jednego lub kilku \"jobs\". Każdy z nich może być wykonywany równolegle na innej maszynie (patrz \"runner\")\n",
" - *Step* - odpowiednik \"Stage\" z Jenkinsa - służu do grupowania \"Actions\"\n", " - *Step* - odpowiednik \"Stage\" z Jenkinsa - służu do grupowania \"Actions\"\n",
" - *Action/command* - odpowiednik \"Step\" z Jenkinsa - pojedyncze polecenie do wykonania, np. dodanie komentarze do Pull requesta, wykonanie polecenia systemowego itp.\n", " - *Action/command* - odpowiednik \"Step\" z Jenkinsa - pojedyncze polecenie do wykonania, np. dodanie komentarze do Pull requesta, wykonanie polecenia systemowego itp.\n",
" - *Runner* - odpowiednik Jenkinsowego \"Agent\" - serwer, na którym mogą być wykonywane zadania (\"jobs\")\n", " - *Runner* - odpowiednik Jenkinsowego \"Agent\" - serwer, na którym mogą być wykonywane zadania (\"jobs\")\n",
@ -103,7 +103,33 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 1,
"id": "955585a9",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/home/tomek/AITech/repo/aitech-ium-private/IUM_11\n",
"Initialized empty Git repository in /home/tomek/AITech/repo/aitech-ium-private/IUM_11/github-actions-hello/.git/\r\n"
]
}
],
"source": [
"%cd IUM_11\n",
"!mkdir github-actions-hello;\\\n",
"cd github-actions-hello;\\\n",
"git init"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f4916c1f", "id": "f4916c1f",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
@ -115,53 +141,18 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"/home/tomek/repos/aitech-ium/IUM_11/github-actions-hello\n" "/home/tomek/AITech/repo/aitech-ium-private/IUM_11/github-actions-hello\n"
] ]
} }
], ],
"source": [ "source": [
"!mkdir -p IUM_11/github-actions-hello\n", "%cd github-actions-hello\n",
"%cd IUM_11/github-actions-hello\n",
"!mkdir -p .github/workflows" "!mkdir -p .github/workflows"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 6,
"id": "88ce689f",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reinitialized existing Git repository in /home/tomek/repos/aitech-ium/IUM_11/github-actions-hello/.git/\n",
"Enumerating objects: 6, done.\n",
"Counting objects: 100% (6/6), done.\n",
"Delta compression using up to 4 threads\n",
"Compressing objects: 100% (4/4), done.\n",
"Writing objects: 100% (6/6), 780 bytes | 780.00 KiB/s, done.\n",
"Total 6 (delta 0), reused 0 (delta 0), pack-reused 0\n",
"To github.com:TomekZet/ium-ga-hello.git\n",
" * [new branch] main -> main\n",
"Branch 'main' set up to track remote branch 'main' from 'origin'.\n"
]
}
],
"source": [
"!git init\n",
"!git branch -M main\n",
"!git remote add origin git@github.com:TomekZet/ium-ga-hello.git\n",
"!git push -u origin main"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "dde8d432", "id": "dde8d432",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
@ -173,7 +164,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Overwriting .github/workflows/workflow.yml\n" "Writing .github/workflows/workflow.yml\n"
] ]
} }
], ],
@ -194,164 +185,6 @@
" - run: python3 --version" " - run: python3 --version"
] ]
}, },
{
"cell_type": "code",
"execution_count": 22,
"id": "ff1e011e",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"On branch main\n",
"Your branch is up to date with 'origin/main'.\n",
"\n",
"nothing to commit, working tree clean\n",
"Everything up-to-date\n"
]
}
],
"source": [
"!git add .github/workflows/workflow.yml\n",
"!git commit -m \"Github Actions Workflow\"\n",
"!git push"
]
},
{
"cell_type": "markdown",
"id": "3e237076",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Zakładka actions na stronie repozytorium:\n",
"https://github.com/TomekZet/ium-ga-hello/actions"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "32701383",
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 16\r\n",
"drwxr-sr-x 2 tomek tomek 4096 May 17 11:51 .\r\n",
"drwxr-sr-x 3 tomek tomek 4096 May 17 11:51 ..\r\n",
"-rw-r--r-- 1 tomek tomek 456 May 17 11:51 parametrized.yml\r\n",
"-rw-r--r-- 1 tomek tomek 305 May 17 12:01 workflow.yml\r\n"
]
}
],
"source": [
"!ls -al .github/workflows"
]
},
{
"cell_type": "markdown",
"id": "1c01acb5",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Ręczne wywoływanie\n",
"Workflow można również wywołać ręcznie, podając parametry.\n",
"Więcej informacji np. tutaj: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "a7250bf7",
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting .github/workflows/parametrized.yml\n"
]
}
],
"source": [
"%%writefile .github/workflows/parametrized.yml\n",
"name: github-actions-hello-parametrized\n",
"on: \n",
" workflow_dispatch:\n",
" inputs:\n",
" input_text:\n",
" description: 'Text to display' \n",
" required: true\n",
" default: 'Hello World'\n",
"jobs:\n",
" hello-job:\n",
" runs-on: ubuntu-latest\n",
" steps:\n",
" - name: Checkout repo\n",
" uses: actions/checkout@v2\n",
" - name: Install dependencies\n",
" run:\n",
" sudo apt update;\n",
" sudo apt install -y figlet\n",
" - name: Write\n",
" run:\n",
" figlet \"${{ github.event.inputs.input_text }}\""
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "36ddaac0",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[main a98938d] just dispatch\n",
" 1 file changed, 6 deletions(-)\n",
"Enumerating objects: 9, done.\n",
"Counting objects: 100% (9/9), done.\n",
"Delta compression using up to 4 threads\n",
"Compressing objects: 100% (3/3), done.\n",
"Writing objects: 100% (5/5), 411 bytes | 411.00 KiB/s, done.\n",
"Total 5 (delta 1), reused 0 (delta 0), pack-reused 0\n",
"remote: Resolving deltas: 100% (1/1), completed with 1 local object.\u001b[K\n",
"To github.com:TomekZet/ium-ga-hello.git\n",
" 6c4a361..a98938d main -> main\n"
]
}
],
"source": [
"!git add -u .github/workflows\n",
"!git commit -m \"just dispatch\"\n",
"!git push"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ed780dea", "id": "ed780dea",
@ -386,339 +219,6 @@
" - z [Github Marketplace](https://github.com/marketplace?type=actions)" " - z [Github Marketplace](https://github.com/marketplace?type=actions)"
] ]
}, },
{
"cell_type": "markdown",
"id": "a764cc0d",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Akcje wykonywane w kontenerze Docker\n",
"Akcja może być wywołana w kontenerze Docker (pobranym z Docker hub albo zbudowanym z Dockerfile)\n",
"W tym celu należy stworzyć własną akcję w pliku action.yaml i potem użyć jej w Workflow"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "ff4dab8c",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting action.yml\n"
]
}
],
"source": [
"%%writefile action.yml\n",
"name: 'Hello World'\n",
"description: 'Greet someone and record the time'\n",
"inputs:\n",
" who-to-greet: # id of input\n",
" description: 'Who to greet'\n",
" required: true\n",
" default: 'World'\n",
"outputs:\n",
" time: # id of output\n",
" description: 'The time we greeted you'\n",
"runs:\n",
" using: 'docker'\n",
" image: 'Dockerfile'\n",
" args:\n",
" - ${{ inputs.who-to-greet }}"
]
},
{
"cell_type": "code",
"execution_count": 80,
"id": "f1aaff7c",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting Dockerfile\n"
]
}
],
"source": [
"%%writefile Dockerfile\n",
"# Container image that runs your code\n",
"FROM ubuntu:latest\n",
" \n",
"RUN apt update && apt install -y figlet\n",
"\n",
"# Copies your code file from your action repository to the filesystem path `/` of the container\n",
"COPY entrypoint.sh /entrypoint.sh\n",
"\n",
"VOLUME /github/workspace/\n",
"\n",
"WORKDIR /github/workspace/\n",
"\n",
"# Code file to execute when the docker container starts up (`entrypoint.sh`)\n",
"ENTRYPOINT [\"/entrypoint.sh\"]"
]
},
{
"cell_type": "code",
"execution_count": 84,
"id": "7f778025",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting entrypoint.sh\n"
]
}
],
"source": [
"%%writefile entrypoint.sh\n",
"#!/bin/sh -l\n",
"\n",
"figlet \"Hello $1\" | tee figlet.txt\n",
"echo \"Entrypoint invoked in: $PWD\"\n",
"readlink -f figlet.txt\n",
"time=$(date)\n",
"echo \"time=$time\" >> $GITHUB_OUTPUT"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "911975de",
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"!chmod +x entrypoint.sh"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "483e0498",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting .github/workflows/docker.yml\n"
]
}
],
"source": [
"%%writefile .github/workflows/docker.yml\n",
"name: github-actions-hello-docker\n",
"on: \n",
" workflow_dispatch:\n",
" inputs:\n",
" input_text:\n",
" description: 'Who to greet' \n",
" required: true\n",
" default: 'World'\n",
"jobs:\n",
" hello-job:\n",
" runs-on: ubuntu-latest\n",
" steps:\n",
" - name: Checkout repo\n",
" uses: actions/checkout@v2\n",
" - name: Use docker action\n",
" id: hello\n",
" uses: ./\n",
" with:\n",
" who-to-greet: \"${{ github.event.inputs.input_text }}\"\n",
" # Use the output from the `hello` step\n",
" - name: Get the output time\n",
" run: echo \"The time was ${{ steps.hello.outputs.time }}\"\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 63,
"id": "bc24dff3",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[main 22a5094] Fix path\n",
" 1 file changed, 1 insertion(+)\n",
"Enumerating objects: 9, done.\n",
"Counting objects: 100% (9/9), done.\n",
"Delta compression using up to 4 threads\n",
"Compressing objects: 100% (5/5), done.\n",
"Writing objects: 100% (5/5), 570 bytes | 570.00 KiB/s, done.\n",
"Total 5 (delta 1), reused 0 (delta 0), pack-reused 0\n",
"remote: Resolving deltas: 100% (1/1), completed with 1 local object.\u001b[K\n",
"To github.com:TomekZet/ium-ga-hello.git\n",
" 97c7272..22a5094 main -> main\n"
]
}
],
"source": [
"!git add .github entrypoint.sh Dockerfile\n",
"!git commit -m \"Fix path\"\n",
"!git push"
]
},
{
"cell_type": "markdown",
"id": "12af9d1b",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"### Archiwizowanie artefaktów\n",
"https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts\n",
"\n",
"Do archiwizowania artefaktów służy akcja \"upload-artifact\":\n",
"\n",
"```yaml\n",
" - name: Archive artifacts\n",
" uses: actions/upload-artifact@v3\n",
" with:\n",
" name: figlet-output\n",
" path: figlet.txt\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "245f7c8a",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting .github/workflows/docker-artifact.yml\n"
]
}
],
"source": [
"%%writefile .github/workflows/docker-artifact.yml\n",
"name: github-actions-hello-docker-artifact\n",
"on: \n",
" workflow_dispatch:\n",
" inputs:\n",
" input_text:\n",
" description: 'Who to greet' \n",
" required: true\n",
" default: 'World'\n",
"jobs:\n",
" hello-job:\n",
" name: \"Do all the hard stuff\"\n",
" runs-on: ubuntu-latest\n",
" steps:\n",
" - name: Checkout repo\n",
" uses: actions/checkout@v2\n",
" - name: Use docker action\n",
" id: hello\n",
" uses: ./\n",
" with:\n",
" who-to-greet: \"${{ github.event.inputs.input_text }}\"\n",
" # Use the output from the `hello` step\n",
" - name: Get the output time\n",
" run: echo \"The time was ${{ steps.hello.outputs.time }}\" > time.txt\n",
" - name: Archive artifacts\n",
" uses: actions/upload-artifact@v3\n",
" with:\n",
" name: figlet-output\n",
" path: |\n",
" figlet.txt\n",
" time.txt\n",
" publish:\n",
" name: \"Publish as github comment\"\n",
" runs-on: ubuntu-latest\n",
" needs: hello-job\n",
" steps:\n",
" - uses: actions/checkout@v3\n",
" #We need to download the artifact first, jobs do not share workflow files\n",
" - name: get-artifact \n",
" uses: actions/download-artifact@v3\n",
" with:\n",
" name: figlet-output\n",
" - name: display_artifact_contents\n",
" run:\n",
" cat time.txt ; tr ' ' '#' < figlet.txt\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "47e301f9",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[main 5a40228] Archive in one job, use in other\n",
" 1 file changed, 1 insertion(+)\n",
"Enumerating objects: 9, done.\n",
"Counting objects: 100% (9/9), done.\n",
"Delta compression using up to 4 threads\n",
"Compressing objects: 100% (5/5), done.\n",
"Writing objects: 100% (5/5), 622 bytes | 622.00 KiB/s, done.\n",
"Total 5 (delta 2), reused 0 (delta 0), pack-reused 0\n",
"remote: Resolving deltas: 100% (2/2), completed with 2 local objects.\u001b[K\n",
"To github.com:TomekZet/ium-ga-hello.git\n",
" 4df6dc0..5a40228 main -> main\n"
]
}
],
"source": [
"!git add -u\n",
"!git commit -m \"Archive in one job, use in other\"\n",
"!git push"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "805622e8", "id": "805622e8",
@ -1047,26 +547,22 @@
} }
}, },
"source": [ "source": [
"## Zadania [20 pkt] (termin: 24.05.2023)\n", "## Zadania [15 pkt]\n",
"1. Utwórz konto na Github (jeśli jeszcze nie masz)\n", "1. Utwórz konto na Github (jeśli jeszcze nie masz)\n",
"2. Stwórz publiczne repozytorium. Link do niego wklej do kolumny \"Link Github\" w arkuszu [\"Zapisy na zbiory\"](https://teams.microsoft.com/l/file/F62B5988-A797-418D-B085-52E0AF8BD55E?tenantId=73689ee1-b42f-4e25-a5f6-66d1f29bc092&fileType=xlsx&objectUrl=https%3A%2F%2Fuam.sharepoint.com%2Fsites%2F2021SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11%2FShared%20Documents%2FGeneral%2FZapisy%20na%20zbiory.xlsx&baseUrl=https%3A%2F%2Fuam.sharepoint.com%2Fsites%2F2021SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11&serviceName=teams&threadId=19:d67b0dc2ee0849eba517a2aa8507df9c@thread.tacv2&groupId=8cd6b30e-edd9-48db-85ab-259fc11d0c5b) [1 pkt]\n", "2. Stwórz publiczne repozytorium. Link do niego wklej do kolumny \"Link Github\" w arkuszu [\"Zapisy na zbiory\"](https://teams.microsoft.com/l/file/F62B5988-A797-418D-B085-52E0AF8BD55E?tenantId=73689ee1-b42f-4e25-a5f6-66d1f29bc092&fileType=xlsx&objectUrl=https%3A%2F%2Fuam.sharepoint.com%2Fsites%2F2021SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11%2FShared%20Documents%2FGeneral%2FZapisy%20na%20zbiory.xlsx&baseUrl=https%3A%2F%2Fuam.sharepoint.com%2Fsites%2F2021SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11&serviceName=teams&threadId=19:d67b0dc2ee0849eba517a2aa8507df9c@thread.tacv2&groupId=8cd6b30e-edd9-48db-85ab-259fc11d0c5b) [1 pkt]\n",
"2. Stwórz prosty Github workflow który:\n", "2. Stwórz prosty Github workflow wykorzystujący akcje CML, który:\n",
" - zrobi checkout Twojego repozytorium [1 pkt]\n", " - zrobi checkout Twojego repozytorium [2 pkt]\n",
" - ściągnie pliki trenujące. Najlepiej byłoby to zrobić za pomocą DVC, ale tym razem uprośćmy zadanie ze względu na komplikacje, które mogą się pojawić przy konfiguracji uwierzytelniania. Pliki można po prostu dodać do repozytorium albo ściągnąć przez wget jeśli są publicznie dostępne [2 pkt]\n", " - ściągnie pliki trenujące. Najlepiej byłoby to zrobić za pomocą DVC, ale tym razem uprośćmy zadanie ze względu na koplikacje, które mogą się pojawić przy konfiguracji uwierzytelniania. Pliki można po prostu dodać do repozytorium albo ściągnąć przez wget jeśli są publicznie dostępne [2 pkt]\n",
" - będzie wywoływalny przez \"Workflow dispatch\" z parametrami trenowania [2 pkt]\n", " - dokona trenowania i ewaluacji [8 pkt]\n",
" - składał się będzie z co najmniej 3 jobów:\n", " - wyniki opublikuje za pomocą `cml-send-github-check` i/lub `cml-send-comment` [2 pkt]"
" 1. dokona trenowania jako osobnej akcji wykonanej w Dockerze [8 pkt]\n",
" 2. dokona ewaluacji modelu [6 pkt]\n",
" 3. zarchiwizuje plik z modelem"
] ]
} }
], ],
"metadata": { "metadata": {
"author": "Tomasz Ziętkiewicz", "author": "Tomasz Ziętkiewicz",
"celltoolbar": "Slideshow",
"email": "tomasz.zietkiewicz@amu.edu.pl", "email": "tomasz.zietkiewicz@amu.edu.pl",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -1081,7 +577,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.16" "version": "3.10.4"
}, },
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"

@ -1 +0,0 @@
Subproject commit 5a40228be54897d47e0480318adcdbdec0e74d60

View File

@ -22,11 +22,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a5f10a0e", "id": "a5f10a0e",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"# Abstract\n", "# Abstract\n",
"- Umiejętność pisania artykułu naukowego może okazać się przydatna dla osób zajmujących się uczeniem maszynowym.\n", "- Umiejętność pisania artykułu naukowego może okazać się przydatna dla osób zajmujących się uczeniem maszynowym.\n",
@ -37,17 +33,13 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "35d3630d", "id": "35d3630d",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"# Introduction\n", "## Introduction\n",
"\n", "\n",
"- Uczenie maszynowe i jego zastosowania to prężnie rozwijająca się dziedzina nauki\n", "- Uczenie maszynowe i jego zastosowania to prężnie rozwijająca się dziedzina nauki\n",
"- Żeby nadążyć za jej rozwojem musimy czytać artykuły naukowe\n", "- Żeby nadążyć za jej rozwojem musimy czytać artykuły naukowe\n",
"- A jeśli nasza praca ma charakter badawczy, to warto efekty naszej pracy od zebrać w postaci artykułu i opublikować\n", "- A jeśli nasza praca ma charakter badawczy, to warto taki artykuł napisać i opublikować\n",
"- Nasz pracodawca może od nas tego wymagać lub przynajmniej zachęcać\n", "- Nasz pracodawca może od nas tego wymagać lub przynajmniej zachęcać\n",
"- Dlatego zapoznamy się z:\n", "- Dlatego zapoznamy się z:\n",
"1. Strukturą artykułu naukowego\n", "1. Strukturą artykułu naukowego\n",
@ -57,13 +49,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "1033fc4d", "id": "1033fc4d",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"# Related work\n", "### Related work\n",
"\n", "\n",
"Jak napisać artykuł naukowy z dziedziny ML:\n", "Jak napisać artykuł naukowy z dziedziny ML:\n",
"- http://www.isle.org/~langley/papers/craft.ml2k.pdf / https://icml.cc/Conferences/2002/craft.html\n", "- http://www.isle.org/~langley/papers/craft.ml2k.pdf / https://icml.cc/Conferences/2002/craft.html\n",
@ -78,13 +66,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "2c7eb238", "id": "2c7eb238",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"# Methods" "## Methods"
] ]
}, },
{ {
@ -92,7 +76,7 @@
"id": "changed-president", "id": "changed-president",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "slide"
} }
}, },
"source": [ "source": [
@ -101,7 +85,8 @@
"\n", "\n",
"0. Abstrakt (**A**bstract) - Dlaczego, jak, \n", "0. Abstrakt (**A**bstract) - Dlaczego, jak, \n",
"1. Wprowadzenie (**I**ntroduction) - \"Dlaczego?\"\n", "1. Wprowadzenie (**I**ntroduction) - \"Dlaczego?\"\n",
" 1. Related work - \"Kontekst naukowy\"\n", " \n",
" 1.1 Related work - \"Kontekst naukowy\"\n",
"2. Metody (**M**ethod) - \"Jak?\"\n", "2. Metody (**M**ethod) - \"Jak?\"\n",
"3. Wyniki (**R**esults) - \"Co?\"\n", "3. Wyniki (**R**esults) - \"Co?\"\n",
"4. Wnioski (**D**iscussion/Conclusions) - \"Interpretacja wyników\"" "4. Wnioski (**D**iscussion/Conclusions) - \"Interpretacja wyników\""
@ -110,11 +95,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "8cb9b025", "id": "8cb9b025",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/7/75/Wineglass_model_for_IMRaD_structure..png\"/>" "<img src=\"https://upload.wikimedia.org/wikipedia/commons/7/75/Wineglass_model_for_IMRaD_structure..png\"/>"
] ]
@ -122,11 +103,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "d3e245eb", "id": "d3e245eb",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Tytuł\n", "#### Tytuł\n",
"- powinien odzwierciedlać treść artykułu ;)\n", "- powinien odzwierciedlać treść artykułu ;)\n",
@ -139,11 +116,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "1f150ddb", "id": "1f150ddb",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Abstrakt\n", "#### Abstrakt\n",
"\n", "\n",
@ -155,15 +128,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "6005b4bd", "id": "6005b4bd",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Wprowadzenie\n", "#### Wprowadzenie\n",
" - Kontekst badań\n", " - Kontekst badań\n",
" - Od ogółu do szczegółu\n",
" - Motywacja\n", " - Motywacja\n",
" - Co chcemy właściwie zbadać - sformułowanie hipotezy badawczej" " - Co chcemy właściwie zbadać - sformułowanie hipotezy badawczej"
] ]
@ -171,28 +139,20 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "1308de25", "id": "1308de25",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Related work\n", "#### Related work\n",
" - Kontekst naukowy\n", " - Kontekst naukowy\n",
" - Co zrobiono przed nami\n", " - Co zrobiono przed nami\n",
" - Musimy się do tego odnieść w dalszej części i zaznaczyć co nasze badania wnoszą nowego do dziedziny\n", " - Musimy się do tego odnieść w dalszej części i zaznaczyć co nasze badania wnoszą nowego do dziedziny\n",
" - Cytujemy najważniejsze prace\n", " - Cytujemy najważniejsze prace\n",
" - Najlepiej zacząć szeroko i w przeszłości i stopniowo przechodzili do coraz nowszych i bardziej szczegółowych badań, bliżej związanych z tematyką poruszaną w naszym artykule." " - Najlepiej zaczącć szeroko i w przeszłości i stopniowo przechodzili do coraz nowszych i bardziej szczegółowych badań, bliżej związanych z tematyką poruszaną w naszym artykule."
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "b6cf4464", "id": "b6cf4464",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Metody\n", "#### Metody\n",
"- Jak przeprowadziliśmy nasze badania/eksperymenty\n", "- Jak przeprowadziliśmy nasze badania/eksperymenty\n",
@ -208,11 +168,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "5aee7988", "id": "5aee7988",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Wyniki\n", "#### Wyniki\n",
"- Jakie wyniki otrzymaliśmy\n", "- Jakie wyniki otrzymaliśmy\n",
@ -223,11 +179,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "7be88b24", "id": "7be88b24",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"#### Konkluzje\n", "#### Konkluzje\n",
"- Interpretacja wyników\n", "- Interpretacja wyników\n",
@ -239,13 +191,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "4753cf22", "id": "4753cf22",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"## Latex\n", "### Latex\n",
"\n", "\n",
"- LaTeX (wym. *Latech*) to system składu tekstu\n", "- LaTeX (wym. *Latech*) to system składu tekstu\n",
"- Najbardziej popularny w dziedzinach technicznych\n", "- Najbardziej popularny w dziedzinach technicznych\n",
@ -261,11 +209,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "918e3b39", "id": "918e3b39",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"### Struktura\n", "### Struktura\n",
"```latex\n", "```latex\n",
@ -401,11 +345,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "3ea5c879", "id": "3ea5c879",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"```bibtex\n", "```bibtex\n",
"\n", "\n",
@ -468,29 +408,10 @@
" - intagracja z Git/GitHub" " - intagracja z Git/GitHub"
] ]
}, },
{
"cell_type": "markdown",
"id": "ba75e390",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## arXiv.org\n",
" - https://arxiv.org/\n",
" - baza artykułów, uporządkowanych według kategorii\n",
" - umożliwia samodzielne opublikowanie artykułu jeszcze przed wysłaniem go do czasopisma/na konferencję. Artykuły tam dostępne nie są recenzowane, ale jest to sposób na otrzymanie feedbacku od społeczności poza oficjalnym procesem publikacyjnym."
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "e1822b3c", "id": "e1822b3c",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"### JupyterBook\n", "### JupyterBook\n",
"https://jupyterbook.org/en/stable/intro.html\n" "https://jupyterbook.org/en/stable/intro.html\n"
@ -499,11 +420,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ceef2f3f", "id": "ceef2f3f",
"metadata": { "metadata": {},
"slideshow": {
"slide_type": "slide"
}
},
"source": [ "source": [
"### The Turing Way\n", "### The Turing Way\n",
"*The Turing Way handbook to reproducible, ethical and collaborative data science*\n", "*The Turing Way handbook to reproducible, ethical and collaborative data science*\n",
@ -520,11 +437,11 @@
} }
}, },
"source": [ "source": [
"### Conclusions\n", "## Conclusions\n",
"### Zadanie [30pkt][2023-06-07] (zmiana terminu!)\n", "### Zadanie [30pkt]\n",
"1. Wybierz konferencję naukową z dziedziny ML/AI/Computer Science\n", "1. Wybierz konferencję naukową z dziedziny ML/AI/Computer Science\n",
"2. Używając szablonu Latex udostępnionego przez organizatorów konferencji, stwórz szkic artykułu naukowego opisującego wyniki eksperymentów ML, które przeprowadziłaś/eś w trakcie zajęć.\n", "2. Używając szablonu Latex udostępnionego przez organizatorów konferencji, stwórz szkic artykułu naukowego opisującego wyniki eksperymentów ML, które przeprowadziłaś/eś w trakcie zajęć.\n",
"3. Napisz artykuł używając Overleaf. Udostępnij w [arkuszu z zapisami](https://uam.sharepoint.com/:x:/r/sites/2023SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/IUM-2023-zapisy.xlsx?d=w49d444e07d864d2997ef7d72c5a47da0&csf=1&web=1&e=RT11aP) link udostępniający dokument ([jak stworzyć taki link](https://www.overleaf.com/learn/how-to/What_is_Link_Sharing%3F))\n", "3. Napisz artykuł używając Overleaf. Udostępnij w [arkuszu z zapisami](https://uam.sharepoint.com/:x:/r/sites/2022SL06-DIUMUI0LABInynieriauczeniamaszynowego-Grupa11/Shared%20Documents/General/Zapisy%20zbiory%20danych.xlsx?d=wb3e003a2d1364e88871c4bf951f13e88&csf=1&web=1&e=cXzeeV) link udostępniający dokument ([jak stworzyć taki link](https://www.overleaf.com/learn/how-to/What_is_Link_Sharing%3F))\n",
"4. Artykuł musi zawierać co najmniej:\n", "4. Artykuł musi zawierać co najmniej:\n",
" - 6 niepustych sekcji (abstract, introduction, related work, method, results, conclusions)\n", " - 6 niepustych sekcji (abstract, introduction, related work, method, results, conclusions)\n",
" - jedną tabelkę (np. opisującą dane lub wyniki)\n", " - jedną tabelkę (np. opisującą dane lub wyniki)\n",
@ -532,7 +449,6 @@
" - 5 cytowań (można np. zacytować artykuły opisujące użytą metodę, zbiory danych, narzędzia. Zazwyczaj popularne biblioteki, datasety podają w README jak należy je cytować)\n", " - 5 cytowań (można np. zacytować artykuły opisujące użytą metodę, zbiory danych, narzędzia. Zazwyczaj popularne biblioteki, datasety podają w README jak należy je cytować)\n",
" - 1 wzór matematyczny\n", " - 1 wzór matematyczny\n",
"5. Artykuł powinien być zgodny z wytycznymi konferencji dotyczącymi formy artykułów (oczywiście poza liczbą stron)\n", "5. Artykuł powinien być zgodny z wytycznymi konferencji dotyczącymi formy artykułów (oczywiście poza liczbą stron)\n",
"6. Na przedostatnich i ostatnich zajęciach będą Państwo prezentować artykuł i wtedy też zostanie on oceniony\n",
" \n", " \n",
"\n", "\n",
"Zapewne w napisanym artykule nie opiszą państwo niczego nowatorskiego i wartego publikacji - tutaj udajemy, że zastosowaliśmy metodę po raz pierwszy, osiągnęliśmy nieosiągalne dotąd wyniki itp. Liczy się forma i struktura pracy. Można dodać komentarz wyjaśniający prawdziwy cel artykuły w sekcji/przypisie \"Disclaimer\", żeby nikt Państwa nie posądzał o pisanie nieprawdy.\n", "Zapewne w napisanym artykule nie opiszą państwo niczego nowatorskiego i wartego publikacji - tutaj udajemy, że zastosowaliśmy metodę po raz pierwszy, osiągnęliśmy nieosiągalne dotąd wyniki itp. Liczy się forma i struktura pracy. Można dodać komentarz wyjaśniający prawdziwy cel artykuły w sekcji/przypisie \"Disclaimer\", żeby nikt Państwa nie posądzał o pisanie nieprawdy.\n",
@ -555,7 +471,7 @@
"metadata": { "metadata": {
"celltoolbar": "Slideshow", "celltoolbar": "Slideshow",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -569,7 +485,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.16" "version": "3.10.4"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -1,159 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3c047009",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Kubernetes\n",
"\n",
"<img style=\"height: 150px;\" src=\"img/kubernetes_logo.png\"/>"
]
},
{
"cell_type": "markdown",
"id": "9a21632b",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"Kubernetes (aka. K8s) - system służący do automatyzacji:\n",
" - deploymentu\n",
" - skalowania\n",
" - zarządzania\n",
" \n",
" skonteneryzowanymi aplikacjami"
]
},
{
"cell_type": "markdown",
"id": "7bb1198e",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Motywacja\n",
"- Kubernetes jest środowiskiem, w którym działa Kubeflow - system stworzony z myślą o rozwoju i deploymencie modeli ML"
]
},
{
"cell_type": "markdown",
"id": "abe1d606",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Instalacja\n",
"- Instalacja do nauki i eksperymentów (nieprodukcyjna): https://minikube.sigs.k8s.io/docs/start/"
]
},
{
"cell_type": "markdown",
"id": "4ed97706",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Hello Minikube - interaktywny samouczek\n",
"1. Otwórz stronę: https://kubernetes.io/pl/docs/tutorials/hello-minikube/\n",
"2. Kliknij na \"Launch Terminal\" i wykonuj polecenia w otwartym terminalu (możesz klikać na fragmentach kodu a same przekopiują się do terminala i uruchomią)\n",
"\n",
"Większość interaktywnych samouczków z kubernetes.io przestała działać z końcem marca (https://kubernetes.io/blog/2023/02/14/kubernetes-katacoda-tutorials-stop-from-2023-03-31/), ale ten powyżej (i czasami niektóre inne, jeśli macie szczęście) wciąż działa"
]
},
{
"cell_type": "markdown",
"id": "eded46b6",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Terminologia\n",
"- Pod - (z angielskiego \"strąk\", np. strąk groszku, ale też grupa wielorybów <\"pod of whales\">)\n",
" grupa jednego lub więcej kontenerów wraz z przynależnymi wolumenami (volumes), adresem IP i informacją jak mogą być uruchomione\n",
"<img style=\"height: 200px;\" src=\"img/pod.jpg\"/>\n",
"- Node (węzeł) - pody (jeden lub więcej) są uruchamiane na węzłach - maszynach (fizycznych lub wirtualnych). Na każdym węźle jest uruchomiony proces \"kublet\", służący do komunikacji z \"control plane\", czyli serwerem kontrolującym klaster"
]
},
{
"cell_type": "markdown",
"id": "9d5b11fe",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"- Cluster - grupa węzłów\n",
"- Service - abstrakcja zapewniająca stabilny dostęp do Podów. Ponieważ Pod-y są efemeryczne, mogą być uruchamiane automatczynie np. w wyniki awarii węzła. Service definiuje jakie Pod-y (np. z jaką etykietą) są dostępne pod danym portem (więcej informacji: https://kubernetes.io/docs/concepts/services-networking/service/)\n",
"\n",
"- Schemat klastra: https://kubernetes.io/docs/concepts/overview/components/"
]
},
{
"cell_type": "markdown",
"id": "70932230",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Materiały\n",
"Zapoznaj się z następującymi materiałami:\n",
"1. https://kubernetes.io/pl/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/\n",
"1. https://kubernetes.io/pl/docs/tutorials/kubernetes-basics/explore/explore-intro/\n",
"2. https://kubernetes.io/pl/docs/tutorials/kubernetes-basics/expose/expose-intro/"
]
},
{
"cell_type": "markdown",
"id": "8af62811",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Zadanie\n",
"Brak ;) ale patrz nowy termin zadania z zajęć \"12. Publikacja\" (07.06.2023)"
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB