Any pytorch tools to monitor neural network's training? - neural-network

Are there any tools to monitor network's training in PyTorch? Like tensorboard in tensorflow.

PyTorch 1.1.0 supports TensorBoard natively with torch.utils.tensorboard. The API is very similar to tensorboardX. See the documentation for more details.

I am using tensorboardX. It supports most (if not all) of the features of TensorBoard. I am using the Scalar, Images, Distributions, Histograms and Text. I haven't tried the rest, like audio and graph, but the repo also contains examples for those use cases. The installation can be done easily with pip. It's all explained in the README file of the repo.
There are also other github repos which implement a wrapper for PyTorch (and other languages/frameworks) to tensorboard. As far as I know they support fewer functionalities. But have a look at:
Crayon
Tensorboard-Logger

I have asked this question before in the forums. Tensorboard seems very convenient for Tensorflow and it is also made part of the library/framework itself. However, PyTorch wouldn't take the same approach. But there is a library called visdom here that is released by Facebook, that helps you log the training information. This gives you the flexibility of logging information the way you want. While this means a lot of flexibility, it also means you need to write some extra code to make things work.

Following up on blckbird's answer, I'm also a big fan of Tensorboard-PyTorch. However I also found that its API is relatively low level and I was writing a lot of similar code over and over to do the logging. So (shameless plug) I've written a small package on top of it to automate monitoring network training experiments with minimal code. Hopefully someone else finds it helpful. pytorch-monitor

Minetorch helps me a lot at the past 2 Kaggle competitions. I think it's ready for others to use. It has built-in tensorboard or matplotlib supported. And many other features which make the work easy, includes:
Logger
Tensorboard supported
Matplotlib (to generate png to file)
Auto resume training
Auto best model saving
Hook points for customize
...
It's still in developing so any issues or PRs are very welcomed : )

Related

How to fine tune fine tune GitHub Copilot?

We can fine tune language models like BERT, GPT-3.
Can I fine tune GitHub Copilot model?
I have already looked into examples from https://copilot.github.com/ but cant find the details.
Would really appreciate if someone had fine tuned Github Copilot.
OpenAI API offers the "Davinci Codex" machine learning model with a pay-per-hit subscription, similar to the the non-coding version of the davinci model.
OpenAI should enable the fine-tuning option to Davinci Codex as well. When they do it you will be able to use it via API calls.
After checking that prerequisite, I think you could link the OpenAI API to your local installation of Github Copilot via some code changes, in theory that should be possible.
The first step is probably to have a fork of the copilot VSCode extension that calls the OpenAI Codex API (or an entirely custom extension which inserts text in your code)
Then you would point it to your fine-tuned version of the model. To learn about fine-tuning OpenAI models you should look at their documentation:
https://beta.openai.com/docs/guides/fine-tuning
Note that they have also a openai CLI that allows you to do most of the data loading and fine tuning tasks.
Unfortunately at the moment you can only fine tune the non-coding version of OpenAI models, hope that they will make available Codex soon.
There does not seem to be a client-facing feature allowing you to fine-tune Copilot directly.
Here are two illustration as to why this feature is, for now (Q2 2022) missing.
The Copilot feature page initially included this:
How will GitHub Copilot get better over time?
GitHub Copilot doesn’t actually test the code it suggests, so the code may not even compile or run. GitHub Copilot can only hold a very limited context, so even single source files longer than a few hundred lines are clipped and only the immediately preceding context is used. And GitHub Copilot may suggest old or deprecated uses of libraries and languages. You can use the code anywhere, but you do so at your own risk.
As Tomek Korbak explains on Twitter:
Actually, Copilot's completions will always be optimised for human's liking, not necessarily compiler's liking.
That's because the language model training objective (predicting the next token in text) is great at capturing short-term dependencies (which explains the human feel of generated snippets).
But it struggles to capture long-term, global, semantic properties of generated sequences such as compilability. And there's no easy way of including compilability as a signal for their training.
The standard way -- fine-tuning language models using RL with compilability as a reward -- notoriously leads to catastrophic forgetting: less diverse and less accurate completions.
Tomek references "Energy-Based Models for Code Generation under Compilability Constraints (pdf)"
Our solution (KL-DPG) boosts compilability rate of generated sequences from 55% to 70%.
RL fine-tuning can do better but at a cost of catastrophic forgetting.
Overall, energy-based models (EBMs) turn out to be great at expressing weird, sequence-level constraints that would be super hard as to express as normalised priors for autoregressive language models.
EBMs provide a way of injecting our structured, symbolic knowledge into large language models without breaking them down or sacrificing their uncanny abilities.
The space of further applications in controllable generation is huge.
So not so easy.
Tanishq Mathew Abraham explains in "Coding with GitHub Copilot"
I wonder if the GitHub team might also develop a way of perhaps fine-tuning GitHub Copilot to specific use-cases.
For example, there may be a specific GitHub Copilot models for fastai, JAX, etc. They would be fine-tuned on the source code of of these libraries and codebases that use these libraries.
But making sure that the tool does not provide outdated suggestions would still be a challenge.
I don’t think it would be possible to provide suggestions for a brand-new library that does not have enough codebases using it to train on.
Additionally, for situations like fastai where there are older APIs and newer APIs, when fine-tuning a model, the codebases using the older APIs would have to be filtered out.
No, not at all. There is no storing of GitHub Pilot's model in the client's system and also no access is provided to the model since now they have started charging for their services hence making it more obvious that their project isn't and won't be open-sourced.

Looking for advise to create my first neural network to classify text

I am very new in this field and I would like to create a Neural Network to classify a dataset that I have in MongoDB. I would like some advise about where should I start, what technology should I use or any tutorial that you think it can help.
If you know about any open source code that already does this, I would love to take a look at it.
Thank you !!
Pick a platform
In essence, you should pick a platform or framework that does much of the dirty work for you and read up on some tutorials for that.
The big choice is between natural language processing frameworks such as NLTK or spaCy or Stanford NLP tools; or a generic machine learning framework such as Tensorflow or PyTorch.
Text classification is a popular task that's reasonably entry-level, is well supported by pretty much everything (so it's not much to say there in a shopping question, pick whatever you like) and would have a bunch of tutorials available online for any major platform.

How to use tensorboard debugger with pytorch?

I know pytorch starts to support tensorboard since the version 1.11. But I am wondering is it possible for us to use the debugger plugin for tensorboard with pytorch? I didn't find any information about this. If pytorch can also support tensorboard debugger, it would be extremely convenient and could save us a lot of time.
No, it is not and to doubt it ever will be possible. The plugin heavily relies on how TensorFlow internally represents graph nodes which is quite different in PyTorch.

BPMB visualization

We need to visualize BP (business process) into BPMN, but NOT by hands using modeler. We need to do it automatically in crm-web-based system written on PHP. I have input data (etc. array, xml, not care...(but not BPEL)), then I need to process it into nice BPMN graph (using SVG).
We have first nice-looking realization of it. We use matrix to draw: several times goes through matrix and optimize graph each time, no no, it working fast, but it not agile, hard to rebuilt, upgrade, add new features... We made this algorithm by ourselves (I mean we didn't find it in google or books). Problem is that we couldn't find any algorithms in the internet. I suppose we don't know correct keywords to do it. Every try returned us to BPEL vis. from BPMN, "Data flow vis." returned modelers...
Please help us to find some algorithms, or give correct keywords to find out information.
Think you're probably looking for "graph layout algorithms". The only library I'm aware of that can (I think) generate BPMN directly is the yFiles library from yWorks. It's not free. They do however offer a free application using the library that does auto-layout. Perhaps you could do some prototyping with that.
If that's not applicable, there are several other options. I'm not aware any of these can generate BPMN symbols directly; you'd have to construct the symbols. However all will auto-layout graphs according to various algorithms. Also all open source/free.
graphviz. Written in C. Quite old now but well used, stable and scalable.
tulip. Newer than graphviz. Haven't used it but heard good things about flexibility and scalability.
see also this post for javascript based options.
There are many more, just google for graph layout algorithms / libraries.
hth.

Any good library or software for queue networks simulation?

I have been trying to make work EZSIM with no luck, which is a software to build discrete event simulators in a graphical DOS environment. In this software, my simulator and many others (of the other people in the course I'm taking) don't work, but teacher's simulator (and examples of the downloaded files) does work.
So, I began to distrust of the software.
Do you know any software that resolves the same kind of problems but really works? It will be good if it is free, or I can download an evaluation copy or something like that.
If you don't know any software, do you know any library which might work? Preferably in C#, Ansi C, Java or Delphi.
This may be more than what you're looking for, but check out NS2. It's the standard for open source network simulations, and will allow you to simulate all kinds of network layer behavior.
I've also used JUNG in the past. It's very flexible, although it also doesn't offer much out of the box.
I used Möbius in my computer systems analysis class. It is free for educational use (which sounds like what you're doing). It's a Java GUI which generates C++ code.
The R package queuecomputer. queuecomputer is a computationally efficient method for simulating queues with arbitrary arrival and service times. There is a submitted paper on arXiv describing the algorithm used in the package. Examples can be found within the arXiv paper and the vignette. A web app based on the package is available at https://ace-ebert.shinyapps.io/queue_simulator_mmk/ .