Aktualizacja lab. 7

This commit is contained in:
Paweł Skórzewski 2024-04-17 08:00:40 +02:00
parent fa3867ce5a
commit c85669d700
2 changed files with 316 additions and 190 deletions

View File

@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -121,18 +121,36 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: sacred in /home/tomek/miniconda3/lib/python3.9/site-packages (0.8.4)\n",
"Requirement already satisfied: jsonpickle>=1.2 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (3.0.1)\n",
"Requirement already satisfied: colorama>=0.4 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (0.4.6)\n",
"Requirement already satisfied: GitPython in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (3.1.31)\n",
"Requirement already satisfied: py-cpuinfo>=4.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (9.0.0)\n",
"Requirement already satisfied: wrapt<2.0,>=1.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (1.15.0)\n",
"Requirement already satisfied: munch<3.0,>=2.5 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (2.5.0)\n",
"Requirement already satisfied: docopt<1.0,>=0.3 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (0.6.2)\n",
"Requirement already satisfied: packaging>=18.0 in /home/tomek/miniconda3/lib/python3.9/site-packages (from sacred) (23.0)\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",
"Requirement already satisfied: gitdb<5,>=4.0.1 in /home/tomek/miniconda3/lib/python3.9/site-packages (from GitPython->sacred) (4.0.10)\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"
"Collecting sacred\n",
" Downloading sacred-0.8.5-py2.py3-none-any.whl (107 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m107.9/107.9 KB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting jsonpickle>=2.2.0\n",
" Downloading jsonpickle-3.0.4-py3-none-any.whl (39 kB)\n",
"Collecting colorama>=0.4\n",
" Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)\n",
"Collecting munch<5.0,>=2.5\n",
" Downloading munch-4.0.0-py2.py3-none-any.whl (9.9 kB)\n",
"Requirement already satisfied: packaging>=18.0 in ./venv/lib/python3.10/site-packages (from sacred) (24.0)\n",
"Collecting wrapt<2.0,>=1.0\n",
" Downloading wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (80 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m80.3/80.3 KB\u001b[0m \u001b[31m12.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting docopt<1.0,>=0.3\n",
" Downloading docopt-0.6.2.tar.gz (25 kB)\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting GitPython\n",
" Downloading GitPython-3.1.43-py3-none-any.whl (207 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.3/207.3 KB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting py-cpuinfo>=4.0\n",
" Downloading py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)\n",
"Collecting gitdb<5,>=4.0.1\n",
" Downloading gitdb-4.0.11-py3-none-any.whl (62 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.7/62.7 KB\u001b[0m \u001b[31m15.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting smmap<6,>=3.0.1\n",
" Downloading smmap-5.0.1-py3-none-any.whl (24 kB)\n",
"Using legacy 'setup.py install' for docopt, since package 'wheel' is not installed.\n",
"Installing collected packages: py-cpuinfo, docopt, wrapt, smmap, munch, jsonpickle, colorama, gitdb, GitPython, sacred\n",
" Running setup.py install for docopt ... \u001b[?25ldone\n",
"\u001b[?25hSuccessfully installed GitPython-3.1.43 colorama-0.4.6 docopt-0.6.2 gitdb-4.0.11 jsonpickle-3.0.4 munch-4.0.0 py-cpuinfo-9.0.0 sacred-0.8.5 smmap-5.0.1 wrapt-1.16.0\n"
]
}
],
@ -153,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 11,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -164,12 +182,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting sacred_hello.py\n"
"Overwriting IUM_07/sacred_hello.py\n"
]
}
],
"source": [
"%%writefile sacred_hello.py\n",
"%%writefile IUM_07/sacred_hello.py\n",
"from sacred import Experiment\n",
"\n",
"ex = Experiment()\n",
@ -181,7 +199,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 12,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -192,11 +210,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING - sacred_hello - No observers have been added to this run\r\n",
"INFO - sacred_hello - Running command 'my_main'\r\n",
"INFO - sacred_hello - Started\r\n",
"Witaj świecie!\r\n",
"INFO - sacred_hello - Completed after 0:00:00\r\n"
"WARNING - sacred_hello - No observers have been added to this run\n",
"INFO - sacred_hello - Running command 'my_main'\n",
"INFO - sacred_hello - Started\n",
"Witaj świecie!\n",
"INFO - sacred_hello - Completed after 0:00:00\n"
]
}
],
@ -235,7 +253,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -246,73 +264,73 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Usage:\r\n",
" sacred_hello.py [(with UPDATE...)] [options]\r\n",
" sacred_hello.py help [COMMAND]\r\n",
" sacred_hello.py (-h | --help)\r\n",
" sacred_hello.py COMMAND [(with UPDATE...)] [options]\r\n",
"\r\n",
"\r\n",
"\r\n",
"Options:\r\n",
" -b VALUE --beat-interval=VALUE Set the heart-beat interval for this run. Time\r\n",
" between two heartbeat events is measured in\r\n",
" seconds.\r\n",
" -C VALUE --capture=VALUE Control the way stdout and stderr are captured.\r\n",
" The argument value must be one of [no, sys, fd]\r\n",
" -c VALUE --comment=VALUE Add a comment to this run.\r\n",
" -d --debug Set this run to debug mode. Suppress warnings\r\n",
" about missing observers and don't filter the\r\n",
" stacktrace. Also enables usage with ipython\r\n",
" `--pdb`.\r\n",
" -e --enforce_clean Fail if any version control repository is\r\n",
" dirty.\r\n",
" -F VALUE --file_storage=VALUE Add a file-storage observer to the experiment.\r\n",
" The value of the arguement should be the base-\r\n",
" directory to write the runs to\r\n",
" -f --force Disable warnings about suspicious changes for\r\n",
" this run.\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",
" as string: DEBUG(10), INFO(20), WARNING(30),\r\n",
" ERROR(40), CRITICAL(50)\r\n",
" -m VALUE --mongo_db=VALUE Add a MongoDB Observer to the experiment. The\r\n",
" argument value is the database specification.\r\n",
" Should be in the form: `[host:port:]db_name[.c\r\n",
" ollection[:id]][!priority]`\r\n",
" -n VALUE --name=VALUE Set the name for this run.\r\n",
" -D --pdb Automatically enter post-mortem debugging with\r\n",
" pdb on failure.\r\n",
" -p --print-config Always print the configuration first.\r\n",
" -P VALUE --priority=VALUE Sets the priority for a queued up experiment.\r\n",
" `--priority=NUMBER` The number represent the\r\n",
" priority for this run.\r\n",
" -q --queue Only queue this run, do not start it.\r\n",
" -S VALUE --s3=VALUE Add a S3 File observer to the experiment. The\r\n",
" argument value should be\r\n",
" `s3://<bucket>/path/to/exp`.\r\n",
" -s VALUE --sql=VALUE Add a SQL Observer to the experiment. The\r\n",
" typical form is:\r\n",
" dialect://username:password@host:port/database\r\n",
" -t VALUE --tiny_db=VALUE Add a TinyDB Observer to the experiment. The\r\n",
" argument is the path to be given to the\r\n",
" TinyDbObserver.\r\n",
" -u --unobserved Ignore all observers for this run.\r\n",
"\r\n",
"\r\n",
"Arguments:\r\n",
" COMMAND Name of command to run (see below for list of commands)\r\n",
" UPDATE Configuration assignments of the form foo.bar=17\r\n",
"\r\n",
"\r\n",
"Commands:\r\n",
" print_config Print the updated configuration and exit.\r\n",
" print_dependencies Print the detected source-files and dependencies.\r\n",
" save_config Store the updated configuration in a file.\r\n",
" print_named_configs Print the available named configs and exit.\r\n",
" my_main \r\n",
"\r\n"
"Usage:\n",
" sacred_hello.py [(with UPDATE...)] [options]\n",
" sacred_hello.py help [COMMAND]\n",
" sacred_hello.py (-h | --help)\n",
" sacred_hello.py COMMAND [(with UPDATE...)] [options]\n",
"\n",
"\n",
"\n",
"Options:\n",
" -b VALUE --beat-interval=VALUE Set the heart-beat interval for this run. Time\n",
" between two heartbeat events is measured in\n",
" seconds.\n",
" -C VALUE --capture=VALUE Control the way stdout and stderr are captured.\n",
" The argument value must be one of [no, sys, fd]\n",
" -c VALUE --comment=VALUE Add a comment to this run.\n",
" -d --debug Set this run to debug mode. Suppress warnings\n",
" about missing observers and don't filter the\n",
" stacktrace. Also enables usage with ipython\n",
" `--pdb`.\n",
" -e --enforce_clean Fail if any version control repository is\n",
" dirty.\n",
" -F VALUE --file_storage=VALUE Add a file-storage observer to the experiment.\n",
" The value of the arguement should be the base-\n",
" directory to write the runs to\n",
" -f --force Disable warnings about suspicious changes for\n",
" this run.\n",
" -h --help Print this help message and exit.\n",
" -i VALUE --id=VALUE Set the id for this run.\n",
" -l VALUE --loglevel=VALUE Set the LogLevel. Loglevel either as 0 - 50 or\n",
" as string: DEBUG(10), INFO(20), WARNING(30),\n",
" ERROR(40), CRITICAL(50)\n",
" -m VALUE --mongo_db=VALUE Add a MongoDB Observer to the experiment. The\n",
" argument value is the database specification.\n",
" Should be in the form: `[host:port:]db_name[.c\n",
" ollection[:id]][!priority]`\n",
" -n VALUE --name=VALUE Set the name for this run.\n",
" -D --pdb Automatically enter post-mortem debugging with\n",
" pdb on failure.\n",
" -p --print-config Always print the configuration first.\n",
" -P VALUE --priority=VALUE Sets the priority for a queued up experiment.\n",
" `--priority=NUMBER` The number represent the\n",
" priority for this run.\n",
" -q --queue Only queue this run, do not start it.\n",
" -S VALUE --s3=VALUE Add a S3 File observer to the experiment. The\n",
" argument value should be\n",
" `s3://<bucket>/path/to/exp`.\n",
" -s VALUE --sql=VALUE Add a SQL Observer to the experiment. The\n",
" typical form is:\n",
" dialect://username:password@host:port/database\n",
" -t VALUE --tiny_db=VALUE Add a TinyDB Observer to the experiment. The\n",
" argument is the path to be given to the\n",
" TinyDbObserver.\n",
" -u --unobserved Ignore all observers for this run.\n",
"\n",
"\n",
"Arguments:\n",
" COMMAND Name of command to run (see below for list of commands)\n",
" UPDATE Configuration assignments of the form foo.bar=17\n",
"\n",
"\n",
"Commands:\n",
" print_config Print the updated configuration and exit.\n",
" print_dependencies Print the detected source-files and dependencies.\n",
" save_config Store the updated configuration in a file.\n",
" print_named_configs Print the available named configs and exit.\n",
" my_main \n",
"\n"
]
}
],
@ -352,7 +370,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 5,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -381,7 +399,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 6,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -408,10 +426,10 @@
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7f89cc3175b0>"
"<sacred.run.Run at 0x7ff6cf76d600>"
]
},
"execution_count": 9,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@ -433,7 +451,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -446,7 +464,7 @@
"{'recipient': 'Świecie', 'greeting': 'Witaj', 'message': 'Witaj Świecie!'}"
]
},
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@ -469,15 +487,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting IUM_07/sacred_scopes.py\n"
]
}
],
"source": [
"# %load IUM_07/sacred_scopes.py\n",
"%%writefile IUM_07/sacred_scopes.py\n",
"from sacred import Experiment\n",
"\n",
"ex = Experiment()\n",
@ -506,11 +532,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING - sacred_scopes - No observers have been added to this run\r\n",
"INFO - sacred_scopes - Running command 'my_main'\r\n",
"INFO - sacred_scopes - Started\r\n",
"Witaj Przygodo!\r\n",
"INFO - sacred_scopes - Completed after 0:00:00\r\n"
"WARNING - sacred_scopes - No observers have been added to this run\n",
"INFO - sacred_scopes - Running command 'my_main'\n",
"INFO - sacred_scopes - Started\n",
"Witaj Przygodo!\n",
"INFO - sacred_scopes - Completed after 0:00:00\n"
]
}
],
@ -531,14 +557,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Running command 'print_config'\r\n",
"INFO - sacred_scopes - Started\r\n",
"Configuration (\u001b[34mmodified\u001b[0m, \u001b[32madded\u001b[0m, \u001b[31mtypechanged\u001b[0m, \u001b[2mdoc\u001b[0m):\r\n",
" greeting = 'Witaj'\r\n",
" message = 'Witaj Świecie!'\r\n",
" recipient = 'Świecie'\r\n",
" seed = 269258424 \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 - Running command 'print_config'\n",
"INFO - sacred_scopes - Started\n",
"Configuration (\u001b[34mmodified\u001b[0m, \u001b[32madded\u001b[0m, \u001b[31mtypechanged\u001b[0m, \u001b[2mdoc\u001b[0m):\n",
" greeting = 'Witaj'\n",
" message = 'Witaj Świecie!'\n",
" recipient = 'Świecie'\n",
" seed = 166269169 \u001b[2m# the random seed for this experiment\u001b[0m\n",
"INFO - sacred_scopes - Completed after 0:00:00\n"
]
}
],
@ -559,14 +585,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Running command 'print_config'\r\n",
"INFO - sacred_scopes - Started\r\n",
"Configuration (\u001b[34mmodified\u001b[0m, \u001b[32madded\u001b[0m, \u001b[31mtypechanged\u001b[0m, \u001b[2mdoc\u001b[0m):\r\n",
" greeting = 'Witaj'\r\n",
" message = 'Witaj Przygodo!'\r\n",
"\u001b[34m recipient = 'Przygodo'\u001b[0m\r\n",
" seed = 667939214 \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 - Running command 'print_config'\n",
"INFO - sacred_scopes - Started\n",
"Configuration (\u001b[34mmodified\u001b[0m, \u001b[32madded\u001b[0m, \u001b[31mtypechanged\u001b[0m, \u001b[2mdoc\u001b[0m):\n",
" greeting = 'Witaj'\n",
" message = 'Witaj Przygodo!'\n",
"\u001b[34m recipient = 'Przygodo'\u001b[0m\n",
" seed = 496449715 \u001b[2m# the random seed for this experiment\u001b[0m\n",
"INFO - sacred_scopes - Completed after 0:00:00\n"
]
}
],
@ -587,13 +613,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'recipient': 'samotności', 'greeting': 'Żegnaj'}"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# %load IUM_07/config.json\n",
"{\n",
@ -604,7 +641,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 18,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -634,7 +671,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 19,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -665,7 +702,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 20,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -675,10 +712,10 @@
{
"data": {
"text/plain": [
"{'recipient': 'samotności', 'greeting': 'Żegnaj', 'seed': 877272352}"
"{'recipient': 'samotności', 'greeting': 'Żegnaj', 'seed': 557578089}"
]
},
"execution_count": 22,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
@ -700,7 +737,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 21,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -746,7 +783,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 22,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -774,10 +811,10 @@
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7f89a0db5550>"
"<sacred.run.Run at 0x7ff69f8c0610>"
]
},
"execution_count": 24,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
@ -827,19 +864,16 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 27,
"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"
"total 8\n",
"drwxr-xr-x 2 pawel pawel 4096 Apr 17 07:51 1\n",
"drwxr-xr-x 2 pawel pawel 4096 Apr 17 07:51 _sources\n"
]
}
],
@ -882,13 +916,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting IUM_07/file_observer.py\n"
]
}
],
"source": [
"%%writefile IUM_07/file_observer.py\n",
"from sacred.observers import FileStorageObserver\n",
@ -914,7 +956,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 25,
"metadata": {
"slideshow": {
"slide_type": "fragment"
@ -925,10 +967,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO - file_observer - Running command 'my_main'\r\n",
"INFO - file_observer - Started run with ID \"4\"\r\n",
"Witaj Świecie!\r\n",
"INFO - file_observer - Completed after 0:00:00\r\n"
"INFO - file_observer - Running command 'my_main'\n",
"INFO - file_observer - Started run with ID \"1\"\n",
"Witaj Świecie!\n",
"INFO - file_observer - Completed after 0:00:00\n"
]
}
],
@ -949,7 +991,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 28,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -960,13 +1002,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"total 24\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 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"
"total 8\n",
"drwxr-xr-x 2 pawel pawel 4096 Apr 17 07:51 1\n",
"drwxr-xr-x 2 pawel pawel 4096 Apr 17 07:51 _sources\n"
]
}
],
@ -976,7 +1014,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 29,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -987,11 +1025,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"total 16\r\n",
"-rw-r--r-- 1 tomek tomek 77 May 28 2022 config.json\r\n",
"-rw-r--r-- 1 tomek tomek 159 May 28 2022 cout.txt\r\n",
"-rw-r--r-- 1 tomek tomek 2 May 28 2022 metrics.json\r\n",
"-rw-r--r-- 1 tomek tomek 1659 May 28 2022 run.json\r\n"
"total 16\n",
"-rw-r--r-- 1 pawel pawel 77 Apr 17 07:51 config.json\n",
"-rw-r--r-- 1 pawel pawel 159 Apr 17 07:51 cout.txt\n",
"-rw-r--r-- 1 pawel pawel 2 Apr 17 07:51 metrics.json\n",
"-rw-r--r-- 1 pawel pawel 1715 Apr 17 07:51 run.json\n"
]
}
],
@ -1001,13 +1039,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'greeting': 'Witaj', 'recipient': 'Świecie', 'seed': 805857632}"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# %load my_runs/1/config.json\n",
"{\n",
@ -1030,10 +1079,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO - file_observer - Running command 'my_main'\r\n",
"INFO - file_observer - Started run with ID \"1\"\r\n",
"Witaj Świecie!\r\n",
"INFO - file_observer - Completed after 0:00:00\r\n"
"INFO - file_observer - Running command 'my_main'\n",
"INFO - file_observer - Started run with ID \"1\"\n",
"Witaj Świecie!\n",
"INFO - file_observer - Completed after 0:00:00\n"
]
}
],
@ -1136,8 +1185,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"total 4\r\n",
"-rw-r--r-- 1 tomek tomek 464 May 28 2022 file_observer_cd34a0ef4a32fb0a966eaa01ea6371ad.py\r\n"
"total 4\n",
"-rw-r--r-- 1 pawel pawel 464 Apr 17 07:51 file_observer_cd34a0ef4a32fb0a966eaa01ea6371ad.py\n"
]
}
],
@ -1148,13 +1197,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"outputs": [
{
"ename": "RuntimeError",
"evalue": "Defining an experiment in interactive mode! The sourcecode cannot be stored and the experiment won't be reproducible. If you still want to run it pass interactive=True",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[33], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msacred\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mobservers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m FileStorageObserver\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msacred\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Experiment\n\u001b[0;32m----> 5\u001b[0m ex \u001b[38;5;241m=\u001b[39m \u001b[43mExperiment\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfile_observer\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 7\u001b[0m ex\u001b[38;5;241m.\u001b[39mobservers\u001b[38;5;241m.\u001b[39mappend(FileStorageObserver(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmy_runs\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m 9\u001b[0m \u001b[38;5;129m@ex\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmy_config\u001b[39m():\n",
"File \u001b[0;32m~/ium/venv/lib/python3.10/site-packages/sacred/experiment.py:119\u001b[0m, in \u001b[0;36mExperiment.__init__\u001b[0;34m(self, name, ingredients, interactive, base_dir, additional_host_info, additional_cli_options, save_git_info)\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m name\u001b[38;5;241m.\u001b[39mendswith(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.pyc\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[1;32m 118\u001b[0m name \u001b[38;5;241m=\u001b[39m name[:\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m4\u001b[39m]\n\u001b[0;32m--> 119\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 120\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 121\u001b[0m \u001b[43m \u001b[49m\u001b[43mingredients\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mingredients\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 122\u001b[0m \u001b[43m \u001b[49m\u001b[43minteractive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minteractive\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 123\u001b[0m \u001b[43m \u001b[49m\u001b[43mbase_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbase_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 124\u001b[0m \u001b[43m \u001b[49m\u001b[43m_caller_globals\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcaller_globals\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 125\u001b[0m \u001b[43m \u001b[49m\u001b[43msave_git_info\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msave_git_info\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 126\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 127\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_command \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcommand(print_config, unobserved\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
"File \u001b[0;32m~/ium/venv/lib/python3.10/site-packages/sacred/ingredient.py:79\u001b[0m, in \u001b[0;36mIngredient.__init__\u001b[0;34m(self, path, ingredients, interactive, _caller_globals, base_dir, save_git_info)\u001b[0m\n\u001b[1;32m 71\u001b[0m (\n\u001b[1;32m 72\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmainfile,\n\u001b[1;32m 73\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msources,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 76\u001b[0m _caller_globals, save_git_info, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbase_dir\n\u001b[1;32m 77\u001b[0m )\n\u001b[1;32m 78\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmainfile \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m interactive:\n\u001b[0;32m---> 79\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 80\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDefining an experiment in interactive mode! \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 81\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThe sourcecode cannot be stored and the \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 82\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexperiment won\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt be reproducible. If you still\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 83\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m want to run it pass interactive=True\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 84\u001b[0m )\n",
"\u001b[0;31mRuntimeError\u001b[0m: Defining an experiment in interactive mode! The sourcecode cannot be stored and the experiment won't be reproducible. If you still want to run it pass interactive=True"
]
}
],
"source": [
"# %load my_runs/_sources/file_observer_cd34a0ef4a32fb0a966eaa01ea6371ad.py\n",
"from sacred.observers import FileStorageObserver\n",
@ -1191,7 +1254,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 37,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1203,7 +1266,7 @@
"output_type": "stream",
"text": [
"INFO - file_observer - Running command 'my_main'\n",
"INFO - file_observer - Started run with ID \"5\"\n",
"INFO - file_observer - Started run with ID \"3\"\n",
"INFO - file_observer - Completed after 0:00:00\n"
]
},
@ -1246,7 +1309,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 40,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1257,14 +1320,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{\r\n",
" \"prepare_message_ts\": \"2023-04-20 12:10:28.197315\"\r\n",
"{\n",
" \"prepare_message_ts\": \"2024-04-17 07:53:12.105121\"\n",
"}"
]
}
],
"source": [
"cat my_runs/5/info.json"
"cat my_runs/3/info.json"
]
},
{
@ -1402,7 +1465,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 41,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1413,8 +1476,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pymongo in /home/tomek/miniconda3/lib/python3.9/site-packages (4.3.3)\r\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"
"Collecting pymongo\n",
" Downloading pymongo-4.6.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (676 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m676.9/676.9 KB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting dnspython<3.0.0,>=1.16.0\n",
" Downloading dnspython-2.6.1-py3-none-any.whl (307 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m307.7/307.7 KB\u001b[0m \u001b[31m1.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hInstalling collected packages: dnspython, pymongo\n",
"Successfully installed dnspython-2.6.1 pymongo-4.6.3\n"
]
}
],
@ -1424,7 +1493,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 44,
"metadata": {
"slideshow": {
"slide_type": "slide"
@ -1435,9 +1504,33 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Running command 'my_main'\n",
"ERROR - sacred_scopes - Failed after 0:00:30!\n"
"INFO - sacred_scopes - Running command 'my_main'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Started run with ID \"641\"\n",
"INFO - sacred_scopes - Completed after 0:00:00\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Witaj Świecie!\n"
]
},
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7ff69f7a74f0>"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
@ -1445,9 +1538,9 @@
"from sacred import Experiment\n",
"\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://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017',\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://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017\n",
"@ex.config\n",
"def my_config():\n",
" recipient = \"Świecie\"\n",
@ -1495,13 +1588,46 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 45,
"metadata": {
"slideshow": {
"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 \"642\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Witaj Świecie!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO - sacred_scopes - Completed after 0:00:39\n"
]
},
{
"data": {
"text/plain": [
"<sacred.run.Run at 0x7ff6c726dcf0>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from sacred.observers import MongoObserver\n",
"from sacred import Experiment\n",
@ -1509,9 +1635,9 @@
"import time\n",
"\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://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017',\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://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017\n",
"@ex.config\n",
"def my_config():\n",
" recipient = \"Świecie\"\n",
@ -1573,7 +1699,7 @@
"Jako nazwę eksperymentu użyj swojego numeru indeksu tak, żebyś mogła/mógł je odnaleźć w Omniboard\n",
"\n",
"2. Wykorzystaj 2 obserwatory [5pkt]: \n",
" - MongoObserver, skorzytaj nastęþującego URL: `mongodb://admin:IUM_2021@172.17.0.1:27017` (będziesz mógł przeglądać wyniki na http://tzietkiewicz.vm.wmi.amu.edu.pl:9000/sacred)\n",
" - MongoObserver, skorzytaj nastęþującego URL: `mongodb://admin:IUM_2021@tzietkiewicz.vm.wmi.amu.edu.pl:27017` (będziesz mógł przeglądać wyniki na http://tzietkiewicz.vm.wmi.amu.edu.pl:9000/sacred)\n",
" - FileObserver - zapisane pliki zarchiwizuj na Jenkinsie jako jego artefakty\n"
]
}
@ -1598,7 +1724,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.10.12"
},
"slideshow": {
"slide_type": "slide"