IPC with Named Pipes

Image for post
Image for post

Recently, I came across a use-case which involved running a PyTorch model for inference in real-time, along with a Node.js server which handles I/O. After an initial failed attempt of using torch.js, we decided to go with Tensorflow.js (tfjs). However, the layers model is a synchronous and a blocking process which forces the use of worker threads (this route is detailed in a separate story). This approach has its own difficulties: (1) a tfjs specific worker thread needs to be running separately. (2) the use of GPU via WebGL backend is not straightforward.

PyTorch is convenient…


This is an excerpt from my master thesis titled: “Semi-supervised morphological reinflection using rectified random variables”

Introduction

Languages use suffixes and prefixes to convey context, stress, intonation, and grammatical meaning (like subject-verb agreement). Such suffixes and prefixes form a more general class of entities which are the meaningful sub-parts of a word; these are called as morphemes. A language’s morphology refers to the rules and processes through which morphemes are combined; this allows a word to express its syntactic categories and semantic meaning. For example, in English, a verb can have three tenses: past, present, and future. …


We implement a neural graph-based dependency parser inspired by those of Kiperwasser and Goldberg, 2016 [2] and Dozat and Manning, 2017 [3]. We train and test our parser on the English and Hindi Treebanks from the Universal Dependencies Project, achieving an unlabeled attachment score (UAS) of 84.80% and a labeled attachment score (LAS) of 78.61% on the English corpus, and a UAS of 91.92% and an LAS of 83.94% on the Hindi corpus. Note: Our UAS scores might be slightly inflated, since the arc from the root to itself always appears in both the prediction and training set. In the…


We explore Multiplicative Normalizing Flows in Bayesian neural networks with different prior distributions over the network weights. The prior over the parameters can not only influence how the network behaves, but can also affect the uncertainty calibration and computational efficiency. The Bayesian framework also offers an added advantage of compression when sparsity inducing priors are used. We experiment with uniform, Cauchy, log uniform, Gaussian, and standard Gumbel priors on predictive accuracy and predictive uncertainty.

Introduction

In recent years Deep Neural Networks (DNN) have revolutionized the field of artificial intelligence. However, vanilla DNNs have two major shortcomings: (a) over-fitting when limited data…


In the latest release (v1.1), PyTorch officially introduced the much-loved visualization tool, Tensorboard. Although it is an experimental version and might change in the near future, I think this is awesome.

Upgrade PyTorch version 1.0.x

pip install --upgrade torch

Install Tensorboard

pip install tb-nightly

That’s it. You are good to go. Import the SummaryWriter and begin visualization :)

from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter(log_dir='./logs')# Track variables (e.g. loss, kld, etc.) that change
writer.add_scalar('KL Divergence', kl_div)
writer.add_scalar('Total Loss', loss)
writer.add_text('Decoder output', 'Some output')

To view the output, in terminal execute the following,

tensorboard --logdir=logs

Fire up your browser and point to http://127.0.0.1:6006

Image for post
Image for post
PyTorch 1.1 with Tensorboard ❤

For details, check out the documentation.


Problem: http://www.spoj.com/problems/AMR11A/

This problem really got me thinking, at first glance problem seems pretty do-able, but after two wrong submissions, I realized, my dynamic programming (DP) state is completely wrong! Finally when I solved it, it made my day.

If you haven’t tried, do so. You’ll have fun.

Solution:

OK, straight forward, the question doesn’t ask us to maximize Harry’s path value. We must make sure he is alive! (😛). The question is to assign minimum amount of strength at the beginning of the grid so that Harry can choose a path and collect the Sorcerer’s stone (while being alive, this…

Akash Raj

Artificial Intelligence Researcher | Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store