{"id":13717397,"url":"https://github.com/Erotemic/netharn","last_synced_at":"2025-05-07T07:31:22.539Z","repository":{"id":66135960,"uuid":"127506937","full_name":"Erotemic/netharn","owner":"Erotemic","description":"Parameterized fit and prediction harnesses for pytorch ","archived":false,"fork":false,"pushed_at":"2020-10-23T12:47:46.000Z","size":3437,"stargazers_count":39,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-10T07:52:06.677Z","etag":null,"topics":["deep-learning","python","pytorch"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Erotemic.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-31T06:49:03.000Z","updated_at":"2024-01-04T16:21:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e501b82-2f46-4e12-89e8-7d63d7417d8f","html_url":"https://github.com/Erotemic/netharn","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erotemic%2Fnetharn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erotemic%2Fnetharn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erotemic%2Fnetharn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erotemic%2Fnetharn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Erotemic","download_url":"https://codeload.github.com/Erotemic/netharn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224573523,"owners_count":17333804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","python","pytorch"],"created_at":"2024-08-03T00:01:21.695Z","updated_at":"2024-11-14T05:31:38.925Z","avatar_url":"https://github.com/Erotemic.png","language":"Python","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Python","Pytorch \u0026 related libraries"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"\nNetHarn - a PyTorch Network Harness\n-----------------------------------\n\n|GitlabCIPipeline| |GitlabCICoverage| |Pypi| |Downloads| \n\nThe main webpage for this project is: https://gitlab.kitware.com/computer-vision/netharn\n\nIf you want a framework for your pytorch training loop that\n(1) chooses directory names based on hashes of hyperparameters,\n(2) can write a single-file deployment of your model by statically auto-extracting the in-code definition of the model topology and zipping it with the weights, \n(3) has brief terminal output and a rich logging output, \n(4) has rule-based monitoring of validation loss and can reduce the learning rate or early stop, \n(5) has tensorboard and/or matplotlib visualizations of training statistics, and \n(6) is designed to be extended, then you might be interested in NetHarn. \n\nNAME:\n    NetHarn (pronounced \"net-harn\")\nFRAMEWORK:\n    PyTorch\nFEATURES: \n    * hyperparameter tracking\n    * training directory management\n    * callback-based public API \n    * XPU - code abstraction for [cpu, gpu, multi-gpu].\n    * single-file deployments (NEW in version ``0.1.0``).\n    * reasonable test coverage using pytest and xdoctest\n    * CI testing on appveyor and travis (note a few tests are failing due to minor issues)\n    * A rich utility set\n    * Extensions of PyTorch objects (e.g. critions, initializers, layers,\n      optimizers, schedulers)\nBUILTINS:\n   - training loop boilerplate\n   - snapshots / checkpoints\n   - progress bars (backend_choices: [progiter, tqdm])\n   - data provenance of training history in ``train_info.json``\n   - tensorboard metric visualization (optional)\nDESIGN PHILOSOPHY: \n   Avoid boilerplate, built-it yourself when you need to, and don't repeat yourself.\n   Experiments should be strongly tied to the choice of hyperparameters, and\n   the framework should be able to construct a directory heirarchy based on\n   these hyperparameters.\nSLOGAN: \n    Rein and train.\nUSAGE PATTERNS:\n    (1) Write code for a torch object  (i.e. Dataset, Model, Criterion, Initializer, and Scheduler) just as you normally would.\n    (2) Inherit from the ``netharn.FitHarn`` object, define ``run_batch``, ``on_batch``, ``on_epoch``, etc...\n    (3) Create an instance of ``netharn.HyperParams`` to specify your dataset, model, criterion, etc...\n    (4) Create an instance of your ``FitHarn`` object with those hyperparameters.\n    (5) Then execute its ``run`` method.\n    (6) ???\n    (7) profit\nEXAMPLES:\n    * ToyData2d classification with netharn.models.ToyNet2d (see doctest in netharn/fit_harn.py:__DOC__:0)\n    * MNIST digit classification with MnistNet (netharn/examples/mnist.py)\n    * Cifar10 category classification with ResNet50 / dpn91 (netharn/examples/cifar.py)\n    * Voc2007+2012 object detection with YOLOv2 (netharn/examples/yolo_voc.py)\n    * IBEIS metric learning with SiameseLP (netharn/examples/siam_ibeis.py)\nSTABILITY:\n   Mostly harmless. Most tests pass, the current failures are probably not\n   critical. I'm able to use it on my machine (tm). In this early stage of\n   development, there are still a few pain points. Issues and PRs welcome.\nKNOWN BUGS:\n   * The metrics for computing detection mAP / AP might not be correct.\n   * The YOLO example gets to about 70% mAP (using Girshik's mAP code) whereas we should be hitting 74-76%\nAUTHORS COMMENTS:\n   * The MNIST, CIFAR, and VOC examples will download the data as needed.\n   * The CIFAR example for ResNet50 achieves 95.72% accuracy, outperforming the\n     best DPN92 result (95.16%) that I'm aware of.\n     This result seems real, I do not believe I've made an error in measurement\n     (but this has need been peer-reviewed so, caveat emptor).  I've reproduced\n     this results a few times. You can use the code in examples/cifar.py to see\n     if you can too (please tell me if you cannot). \n   * The YOLO example is based of of EAVise's excellent lightnet (https://gitlab.com/EAVISE/lightnet/) package.\n   * I reimplemented the CocoAPI (see netharn.data.coco_api), because I had some\n     (probably minor) issue with the original implementation. I've extended it\n     quite a bit, and I'd recommend using it.\n   * The metric-learning example requires code requires the ibeis software:\n     `https://github.com/Erotemic/ibeis`.\nDEPENDENCIES:\n    * torch\n    * numpy\n    * Cython\n    * ubelt\n    * xdoctest\n    * ... (see requirements.txt)\n\n\nFeatures (continued)\n====================\n\n* Hyperparameter tracking: The hash of your hyperparameters determines the\n  directory data will be written to. We also allow for a \"nicer\" means to\n  manage directory structures. Given a ``HyperParams`` object, we create the\n  symlink ``{workdir}/fit/nice/{nice}`` which points to\n  ``{workdir}/fit/runs/{nice}/{hashid}``.\n\n* Automatic restarts: \n  Calling ``FitHarn.run`` twice restarts training from where you left off by\n  default (as long as the hyperparams haven't changed).\n\n* \"Smart\" Snapshot cleanup:  \n  Maintaining model weights files can be a memory hog. Depending the settings\n  of ``harn.preferences``, ``netharn.FitHarn`` will periodically remove\n  less-recent or low-scoring snapshots.\n\n* Deployment files: \n  Model weights and architecture are together written as one\n  reasonably-portable zip-file. We also package training metadata to maintain\n  data provinence and make reproducing experiments easier. \n\n* Restart from any pretrained state: \n  use ``netharn.initializers.PretainedInitializer``. \n\n* Utilities for building networks in torch:\n  Layers like ``netharn.layers.ConvNormNd`` make it easy to build networks for\n  n=1, 2, or 3 dimensional data. \n\n* Analytic output shape and receptive field:\n  Netharn defines a ``netharn.layers.AnalyticModule``, which can automatically\n  define ``forward``, ``output_shape_for`` and ``receptive_field_for`` if users\n  define a special ``_output_for`` method, written with the\n  ``netharn.analytic_for.Output``, ``netharn.analytic_for.Hidden``, and\n  ``netharn.analytic_for.OutputFor`` special callables.\n\n* Example tasks:\n  Baseline code for standard tasks like: object segmentation, classification,\n  and detection are defined in ``netharn.examples``. The examples also provide\n  example use cases for ``ndsampler``, ``kwimage``, ``kwannot``, and\n  ``kwplot``. \n\n\nInstallation\n============\n\nIn the future these instructions may actually be different than the developer\nsetup instructions, but for now they are the same.\n\n.. code-block:: bash\n\n    mkdir -p ~/code\n    git clone git@github.com:Erotemic/netharn.git ~/code/netharn\n    cd ~/code/netharn\n    ./run_developer_setup.sh\n\n\nWhile all netharn dependencies should be available on pypi (with manylinux2010\nwheels for binary packages), there are other packages developed concurrently\nwith netharn. To install the development version of these dependencies then run\n``python super_setup.py ensure`` to check out the repos and ensure they are on\nthe correct branch, ``python super_setup.py develop`` to build everything in\ndevelopment mode, and ``python super_setup.py pull`` to update to the latest on\nthe branch.\n\nDescription\n===========\n\nParameterized fit harnesses for PyTorch.\n\nTrains models and keeps track of your hyperparameters.\n\nThis is a clean port of the good parts developed in my research repo: ``clab``. \n\nSee the netharn/examples folder for example usage. The doctests are also a good\nresource. It would be nice if we had better docs.\n\nNetHarn is a research framework for training and deploying arbitrary PyTorch\nmodels.  It was designed for the purpose of minimizing training-loop\nboilerplate and tracking hyperparameters to encourage reproducible research.\nNetHarn separates the problem of training a model into the following core\nhyperparameter components: the datasets, model, criterion, initializer,\noptimizer, and learning rate scheduler.  Runs with different hyperparameters\nare automatically logged to separate directories which makes it simple to\ncompare the results of two experiments.  NetHarn also has the ability to create\na single-file deployment of a trained model that is independent of the system\nused to train it.  This makes it fast and simple for research results to be\nexternally verified and moved into production.\n\n\n\nDeveloper Setup:\n================\n\n\nIn the future these instructions might be different from the install\ninstructions, but for now they are the same.\n\n.. code-block:: bash\n\n    sudo apt-get install python3 python-dev python3-dev \\\n     build-essential libssl-dev libffi-dev \\\n     libxml2-dev libxslt1-dev zlib1g-dev \\\n     python-pip\n\n    mkdir -p ~/code\n    git clone git@github.com:Erotemic/netharn.git ~/code/netharn\n    cd ~/code/netharn\n\n    ./run_developer_setup.sh\n\n\nDocumentation\n=============\n\nNetharn's documentation is currently sparse. I typically do most of my\ndocumenting in the code itself using docstrings. In the future much of this\nwill likely be consolidated in a read-the-docs style documentation page, but\nfor now you'll need to look at the code to read the docs.\n\nThe main concept provided by netharn is the \"FitHarn\", which has a decent\nmodule level docstring, and a lot of good class / method level docstrings: \nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/fit_harn.py\n\nThe examples folder has better docstrings with task-level documentation: \n\nThe simplest is the mnist example:\nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/mnist.py\n\nThe CIFAR example builds on the mnist example:\nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/cifar.py\n\nI'd recommend going through those two examples, as they have the best documentation. \n\nThe segmentation example:\nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/segmentation.py\n\nand object detection example: \nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/object_detection.py\n\nhave less documentation, but provide more real-world style examples of how netharn is used. \n\nThere is an applied segmentation example that is specific to the CAMVID dataset:\nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/sseg_camvid.py\n\nAnd there is an applied VOC detection example:\nhttps://gitlab.kitware.com/computer-vision/netharn/-/blob/master/netharn/examples/yolo_voc.py\n\nThis README also contains a toy example.\n\nToy Example:\n============\n\nThis following example is the doctest in ``netharn/fit_harn.py``. It\ndemonstrates how to use NetHarn to train a model to solve a toy problem.  \n\nIn this toy problem, we do not extend the netharn.FitHarn object, so we are using\nthe default behavior of ``run_batch``. The default ``on_batch``, and\n``on_epoch`` do nothing, so only loss will be the only measurement of\nperformance.\n\nFor further examples please see the examples directory. These example show how\nto extend netharn.FitHarn to measure performance wrt a particular problem.  The\nMNIST and CIFAR examples are the most simple. The YOLO example is more complex.\nThe IBEIS example depends on non-public data / software, but can still be\nuseful to look at.  Its complexity is more than CIFAR but less than YOLO.\n\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import netharn \n    \u003e\u003e\u003e hyper = netharn.HyperParams(**{\n    \u003e\u003e\u003e     # ================\n    \u003e\u003e\u003e     # Environment Components\n    \u003e\u003e\u003e     'name'        : 'demo',\n    \u003e\u003e\u003e     'workdir'     : ub.ensure_app_cache_dir('netharn/demo'),\n    \u003e\u003e\u003e     'xpu'         : netharn.XPU.coerce('auto'),\n    \u003e\u003e\u003e     # workdir is a directory where intermediate results can be saved\n    \u003e\u003e\u003e     # \"nice\" symlinks \u003cworkdir\u003e/fit/name/\u003cname\u003e -\u003e ../runs/\u003chashid\u003e\n    \u003e\u003e\u003e     # XPU auto select a gpu if idle and VRAM\u003e6GB else a cpu\n    \u003e\u003e\u003e     # ================\n    \u003e\u003e\u003e     # Data Components\n    \u003e\u003e\u003e     'datasets'    : {  # dict of plain ol torch.data.Dataset instances\n    \u003e\u003e\u003e         'train': netharn.data.ToyData2d(size=3, border=1, n=256, rng=0),\n    \u003e\u003e\u003e         'vali': netharn.data.ToyData2d(size=3, border=1, n=64, rng=1),\n    \u003e\u003e\u003e         'test': netharn.data.ToyData2d(size=3, border=1, n=64, rng=2),\n    \u003e\u003e\u003e     },\n    \u003e\u003e\u003e     'loaders'     : {'batch_size': 4}, # DataLoader instances or kw\n    \u003e\u003e\u003e     # ================\n    \u003e\u003e\u003e     # Algorithm Components\n    \u003e\u003e\u003e     # Note the (cls, kw) tuple formatting\n    \u003e\u003e\u003e     'model'       : (netharn.models.ToyNet2d, {}),\n    \u003e\u003e\u003e     'optimizer'   : (netharn.optimizers.SGD, {\n    \u003e\u003e\u003e         'lr': 0.01\n    \u003e\u003e\u003e     }),\n    \u003e\u003e\u003e     # focal loss is usually better than netharn.criterions.CrossEntropyLoss\n    \u003e\u003e\u003e     'criterion'   : (netharn.criterions.FocalLoss, {}),\n    \u003e\u003e\u003e     'initializer' : (netharn.initializers.KaimingNormal, {\n    \u003e\u003e\u003e         'param': 0,\n    \u003e\u003e\u003e     }),\n    \u003e\u003e\u003e     # The scheduler adjusts learning rate over the training run\n    \u003e\u003e\u003e     'scheduler'   : (netharn.schedulers.ListedScheduler, {\n    \u003e\u003e\u003e         'points': {'lr': {0: 0.1, 2: 10.0, 4: .15, 6: .05, 9: .01}},\n    \u003e\u003e\u003e         'interpolation': 'linear',\n    \u003e\u003e\u003e     }),\n    \u003e\u003e\u003e     'monitor'     : (netharn.Monitor, {\n    \u003e\u003e\u003e         'max_epoch': 10,\n    \u003e\u003e\u003e         'patience': 7,\n    \u003e\u003e\u003e     }),\n    \u003e\u003e\u003e     # dynamics are a config option that modify the behavior of the main\n    \u003e\u003e\u003e     # training loop. These parameters effect the learned model.\n    \u003e\u003e\u003e     'dynamics'   : {'batch_step': 2},\n    \u003e\u003e\u003e })\n    \u003e\u003e\u003e harn = netharn.FitHarn(hyper)\n    \u003e\u003e\u003e # non-algorithmic behavior preferences (do not change learned models)\n    \u003e\u003e\u003e harn.preferences['num_keep'] = 10\n    \u003e\u003e\u003e # start training.\n    \u003e\u003e\u003e harn.initialize(reset='delete')  # delete removes an existing run\n    \u003e\u003e\u003e harn.run()  # note: run calls initialize it hasn't already been called.\n    \u003e\u003e\u003e # xdoc: +IGNORE_WANT\n\nRunning this code produes the following output:\n\n.. code-block:: \n\n   RESET HARNESS BY DELETING EVERYTHING IN TRAINING DIR\n   Symlink: /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum -\u003e /home/joncrall/.cache/netharn/demo/_mru\n   ... already exists\n   Symlink: /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum -\u003e /home/joncrall/.cache/netharn/demo/fit/nice/demo\n   ... already exists\n   ... and points to the right place\n   INFO: Initializing tensorboard (dont forget to start the tensorboard server)\n   INFO: Model has 824 parameters\n   INFO: Mounting ToyNet2d model on GPU(0)\n   INFO: Exported model topology to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/ToyNet2d_2a3f49.py\n   INFO: Initializing model weights with: \u003cnetharn.initializers.nninit_core.KaimingNormal object at 0x7fc67eff0278\u003e\n   INFO:  * harn.train_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum'\n   INFO:  * harn.nice_dpath  = '/home/joncrall/.cache/netharn/demo/fit/nice/demo'\n   INFO: Snapshots will save to harn.snapshot_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots'\n   INFO: ARGV:\n       /home/joncrall/.local/conda/envs/py36/bin/python /home/joncrall/.local/conda/envs/py36/bin/ipython\n   INFO: dont forget to start:\n       tensorboard --logdir ~/.cache/netharn/demo/fit/nice\n   INFO: === begin training 0 / 10 : demo ===\n   epoch lr:0.0001 │ vloss is unevaluated  0/10... rate=0 Hz, eta=?, total=0:00:00, wall=19:36 EST\n   train loss:0.173 │ 100.00% of 64x8... rate=11762.01 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   vali loss:0.170 │ 100.00% of 64x4... rate=9991.94 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   test loss:0.170 │ 100.00% of 64x4... rate=24809.37 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   INFO: === finish epoch 0 / 10 : demo ===\n   epoch lr:0.00505 │ vloss: 0.1696 (n_bad=00, best=0.1696)  1/10... rate=1.24 Hz, eta=0:00:07, total=0:00:00, wall=19:36 EST\n   train loss:0.175 │ 100.00% of 64x8... rate=13522.14 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   vali loss:0.167 │ 100.00% of 64x4... rate=23598.31 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   test loss:0.167 │ 100.00% of 64x4... rate=20354.22 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   INFO: === finish epoch 1 / 10 : demo ===\n   epoch lr:0.01 │ vloss: 0.1685 (n_bad=00, best=0.1685)  2/10... rate=1.28 Hz, eta=0:00:06, total=0:00:01, wall=19:36 EST\n   train loss:0.177 │ 100.00% of 64x8... rate=15723.99 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   vali loss:0.163 │ 100.00% of 64x4... rate=29375.56 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   test loss:0.163 │ 100.00% of 64x4... rate=29664.69 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   INFO: === finish epoch 2 / 10 : demo ===\n\n   \u003cJUST MORE OF THE SAME; REMOVED FOR BREVITY\u003e\n\n   epoch lr:0.001 │ vloss: 0.1552 (n_bad=00, best=0.1552)  9/10... rate=1.11 Hz, eta=0:00:00, total=0:00:08, wall=19:36 EST\n   train loss:0.164 │ 100.00% of 64x8... rate=13795.93 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   vali loss:0.154 │ 100.00% of 64x4... rate=19796.72 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   test loss:0.154 │ 100.00% of 64x4... rate=21396.73 Hz, eta=0:00:00, total=0:00:00, wall=19:36 EST\n   INFO: === finish epoch 9 / 10 : demo ===\n   epoch lr:0.001 │ vloss: 0.1547 (n_bad=00, best=0.1547) 10/10... rate=1.13 Hz, eta=0:00:00, total=0:00:08, wall=19:36 EST\n\n\n\n\n   INFO: Maximum harn.epoch reached, terminating ...\n   INFO: \n\n\n\n   INFO: training completed\n   INFO: harn.train_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum'\n   INFO: harn.nice_dpath  = '/home/joncrall/.cache/netharn/demo/fit/nice/demo'\n   INFO: view tensorboard results for this run via:\n       tensorboard --logdir ~/.cache/netharn/demo/fit/nice\n   [DEPLOYER] Deployed zipfpath=/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/deploy_ToyNet2d_lnejaaum_009_GAEYQT.zip\n   INFO: wrote single-file deployment to: '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/deploy_ToyNet2d_lnejaaum_009_GAEYQT.zip'\n   INFO: exiting fit harness.\n\nFurthermore, if you were to run that code when ``'--verbose' in sys.argv``,\nthen it would produce this more detailed description of what it was doing:\n\n.. code-block:: \n\n   RESET HARNESS BY DELETING EVERYTHING IN TRAINING DIR\n   Symlink: /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum -\u003e /home/joncrall/.cache/netharn/demo/_mru\n   ... already exists\n   Symlink: /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum -\u003e /home/joncrall/.cache/netharn/demo/fit/nice/demo\n   ... already exists\n   ... and points to the right place\n   DEBUG: Initialized logging\n   INFO: Initializing tensorboard (dont forget to start the tensorboard server)\n   DEBUG: harn.train_info[hyper] = {\n       'model': (\n           'netharn.models.toynet.ToyNet2d',\n           {\n               'input_channels': 1,\n               'num_classes': 2,\n           },\n       ),\n       'initializer': (\n           'netharn.initializers.nninit_core.KaimingNormal',\n           {\n               'mode': 'fan_in',\n               'param': 0,\n           },\n       ),\n       'optimizer': (\n           'torch.optim.sgd.SGD',\n           {\n               'dampening': 0,\n               'lr': 0.0001,\n               'momentum': 0,\n               'nesterov': False,\n               'weight_decay': 0,\n           },\n       ),\n       'scheduler': (\n           'netharn.schedulers.scheduler_redesign.ListedScheduler',\n           {\n               'interpolation': 'linear',\n               'optimizer': None,\n               'points': {'lr': {0: 0.0001, 2: 0.01, 5: 0.015, 6: 0.005, 9: 0.001}},\n           },\n       ),\n       'criterion': (\n           'netharn.criterions.focal.FocalLoss',\n           {\n               'focus': 2,\n               'ignore_index': -100,\n               'reduce': None,\n               'reduction': 'mean',\n               'size_average': None,\n               'weight': None,\n           },\n       ),\n       'loader': (\n           'torch.utils.data.dataloader.DataLoader',\n           {\n               'batch_size': 64,\n           },\n       ),\n       'dynamics': (\n           'Dynamics',\n           {\n               'batch_step': 4,\n               'grad_norm_max': None,\n           },\n       ),\n   }\n   DEBUG: harn.hyper = \u003cnetharn.hyperparams.HyperParams object at 0x7fb19b4b8748\u003e\n   DEBUG: make XPU\n   DEBUG: harn.xpu = \u003cXPU(GPU(0)) at 0x7fb12af24668\u003e\n   DEBUG: Criterion: FocalLoss\n   DEBUG: Optimizer: SGD\n   DEBUG: Scheduler: ListedScheduler\n   DEBUG: Making loaders\n   DEBUG: Making model\n   DEBUG: ToyNet2d(\n     (layers): Sequential(\n       (0): Conv2d(1, 8, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n       (1): BatchNorm2d(8, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n       (2): ReLU(inplace)\n       (3): Conv2d(8, 8, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n       (4): BatchNorm2d(8, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n       (5): ReLU(inplace)\n       (6): Conv2d(8, 2, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n     )\n     (softmax): Softmax()\n   )\n   INFO: Model has 824 parameters\n   INFO: Mounting ToyNet2d model on GPU(0)\n   DEBUG: Making initializer\n   DEBUG: Move FocalLoss() model to GPU(0)\n   DEBUG: Make optimizer\n   DEBUG: Make scheduler\n   DEBUG: Make monitor\n   DEBUG: Make dynamics\n   INFO: Exported model topology to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/ToyNet2d_2a3f49.py\n   INFO: Initializing model weights with: \u003cnetharn.initializers.nninit_core.KaimingNormal object at 0x7fb129e732b0\u003e\n   DEBUG: calling harn.initializer=\u003cnetharn.initializers.nninit_core.KaimingNormal object at 0x7fb129e732b0\u003e\n   INFO:  * harn.train_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum'\n   INFO:  * harn.nice_dpath  = '/home/joncrall/.cache/netharn/demo/fit/nice/demo'\n   INFO: Snapshots will save to harn.snapshot_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots'\n   INFO: ARGV:\n       /home/joncrall/.local/conda/envs/py36/bin/python /home/joncrall/.local/conda/envs/py36/bin/ipython --verbose\n   INFO: dont forget to start:\n       tensorboard --logdir ~/.cache/netharn/demo/fit/nice\n   INFO: === begin training 0 / 10 : demo ===\n   DEBUG: epoch lr:0.0001 │ vloss is unevaluated\n   epoch lr:0.0001 │ vloss is unevaluated  0/10... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 EST\n   DEBUG: === start epoch 0 ===\n   DEBUG: log_value(epoch lr, 0.0001, 0\n   DEBUG: log_value(epoch momentum, 0, 0\n   DEBUG: _run_epoch 0, tag=train, learn=True\n   DEBUG:  * len(loader) = 8\n   DEBUG:  * loader.batch_size = 64\n   train loss:-1.000 │ 0.00% of 64x8... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=train, epoch=0\n   train loss:0.224 │ 100.00% of 64x8... rate=12052.25 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(train epoch loss, 0.22378234565258026, 0\n   DEBUG: Finished batch iteration for tag=train, epoch=0\n   DEBUG: _run_epoch 0, tag=vali, learn=False\n   DEBUG:  * len(loader) = 4\n   DEBUG:  * loader.batch_size = 64\n   vali loss:-1.000 │ 0.00% of 64x4... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=vali, epoch=0\n   vali loss:0.175 │ 100.00% of 64x4... rate=23830.75 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(vali epoch loss, 0.1749105490744114, 0\n   DEBUG: Finished batch iteration for tag=vali, epoch=0\n   DEBUG: epoch lr:0.0001 │ vloss: 0.1749 (n_bad=00, best=0.1749)\n   DEBUG: _run_epoch 0, tag=test, learn=False\n   DEBUG:  * len(loader) = 4\n   DEBUG:  * loader.batch_size = 64\n   test loss:-1.000 │ 0.00% of 64x4... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=test, epoch=0\n   test loss:0.176 │ 100.00% of 64x4... rate=28606.65 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(test epoch loss, 0.17605290189385414, 0\n   DEBUG: Finished batch iteration for tag=test, epoch=0\n   DEBUG: Saving snapshot to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots/_epoch_00000000.pt\n   DEBUG: Snapshot saved to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots/_epoch_00000000.pt\n   DEBUG: new best_snapshot /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots/_epoch_00000000.pt\n   DEBUG: Plotting tensorboard data\n   Populating the interactive namespace from numpy and matplotlib\n   INFO: === finish epoch 0 / 10 : demo ===\n\n   \u003cJUST MORE OF THE SAME; REMOVED FOR BREVITY\u003e\n\n   INFO: === finish epoch 8 / 10 : demo ===\n   DEBUG: epoch lr:0.001 │ vloss: 0.2146 (n_bad=08, best=0.1749)\n   epoch lr:0.001 │ vloss: 0.2146 (n_bad=08, best=0.1749)  9/10... rate=1.20 Hz, eta=0:00:00, total=0:00:07, wall=19:56 EST\n   DEBUG: === start epoch 9 ===\n   DEBUG: log_value(epoch lr, 0.001, 9\n   DEBUG: log_value(epoch momentum, 0, 9\n   DEBUG: _run_epoch 9, tag=train, learn=True\n   DEBUG:  * len(loader) = 8\n   DEBUG:  * loader.batch_size = 64\n   train loss:-1.000 │ 0.00% of 64x8... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=train, epoch=9\n   train loss:0.207 │ 100.00% of 64x8... rate=13580.13 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(train epoch loss, 0.2070118673145771, 9\n   DEBUG: Finished batch iteration for tag=train, epoch=9\n   DEBUG: _run_epoch 9, tag=vali, learn=False\n   DEBUG:  * len(loader) = 4\n   DEBUG:  * loader.batch_size = 64\n   vali loss:-1.000 │ 0.00% of 64x4... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=vali, epoch=9\n   vali loss:0.215 │ 100.00% of 64x4... rate=29412.91 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(vali epoch loss, 0.21514184772968292, 9\n   DEBUG: Finished batch iteration for tag=vali, epoch=9\n   DEBUG: epoch lr:0.001 │ vloss: 0.2148 (n_bad=09, best=0.1749)\n   DEBUG: _run_epoch 9, tag=test, learn=False\n   DEBUG:  * len(loader) = 4\n   DEBUG:  * loader.batch_size = 64\n   test loss:-1.000 │ 0.00% of 64x4... rate=0 Hz, eta=?, total=0:00:00, wall=19:56 ESTDEBUG: Making batch iterator\n   DEBUG: Starting batch iteration for tag=test, epoch=9\n   test loss:0.216 │ 100.00% of 64x4... rate=25906.58 Hz, eta=0:00:00, total=0:00:00, wall=19:56 EST\n   DEBUG: log_value(test epoch loss, 0.21618007868528366, 9\n   DEBUG: Finished batch iteration for tag=test, epoch=9\n   DEBUG: Saving snapshot to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots/_epoch_00000009.pt\n   DEBUG: Snapshot saved to /home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/torch_snapshots/_epoch_00000009.pt\n   DEBUG: Plotting tensorboard data\n   INFO: === finish epoch 9 / 10 : demo ===\n   DEBUG: epoch lr:0.001 │ vloss: 0.2148 (n_bad=09, best=0.1749)\n   epoch lr:0.001 │ vloss: 0.2148 (n_bad=09, best=0.1749) 10/10... rate=1.21 Hz, eta=0:00:00, total=0:00:08, wall=19:56 EST\n\n\n\n\n   INFO: Maximum harn.epoch reached, terminating ...\n   INFO: \n\n\n\n   INFO: training completed\n   INFO: harn.train_dpath = '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum'\n   INFO: harn.nice_dpath  = '/home/joncrall/.cache/netharn/demo/fit/nice/demo'\n   INFO: view tensorboard results for this run via:\n       tensorboard --logdir ~/.cache/netharn/demo/fit/nice\n   [DEPLOYER] Deployed zipfpath=/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/deploy_ToyNet2d_lnejaaum_000_JWPNDC.zip\n   INFO: wrote single-file deployment to: '/home/joncrall/.cache/netharn/demo/fit/runs/demo/lnejaaum/deploy_ToyNet2d_lnejaaum_000_JWPNDC.zip'\n   INFO: exiting fit harness.\n\n\n.. |Pypi| image:: https://img.shields.io/pypi/v/netharn.svg\n   :target: https://pypi.python.org/pypi/netharn\n\n.. |Downloads| image:: https://img.shields.io/pypi/dm/netharn.svg\n   :target: https://pypistats.org/packages/netharn\n\n.. |ReadTheDocs| image:: https://readthedocs.org/projects/netharn/badge/?version=latest\n    :target: http://netharn.readthedocs.io/en/latest/\n\n.. # See: https://ci.appveyor.com/project/jon.crall/netharn/settings/badges\n.. .. |Appveyor| image:: https://ci.appveyor.com/api/projects/status/py3s2d6tyfjc8lm3/branch/master?svg=true\n.. :target: https://ci.appveyor.com/project/jon.crall/netharn/branch/master\n\n.. |GitlabCIPipeline| image:: https://gitlab.kitware.com/computer-vision/netharn/badges/master/pipeline.svg\n   :target: https://gitlab.kitware.com/computer-vision/netharn/-/jobs\n\n.. |GitlabCICoverage| image:: https://gitlab.kitware.com/computer-vision/netharn/badges/master/coverage.svg?job=coverage\n    :target: https://gitlab.kitware.com/computer-vision/netharn/commits/master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErotemic%2Fnetharn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FErotemic%2Fnetharn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FErotemic%2Fnetharn/lists"}