Skip to main content

Blog

Learn About Our Meetup

5000+ Members

MEETUPS

LEARN, CONNECT, SHARE

Join our meetup, learn, connect, share, and get to know your Toronto AI community. 

JOB POSTINGS

INDEED POSTINGS

Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.

CONTACT

CONNECT WITH US

Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

Author: torontoai

[D] Do GPUs only speed up ANN training when nodes per layer is high?

TL;DR: Tensorflow fashion mnist example only quicker running on GPU if I increase the number of nodes in the hidden layer.

Just spent a good day replacing my AMD gpu with an nvidia one and installing cuda and whatnot. Finally got it working and loaded up Tensorflow’s fashion mnist example, fully expecting training with my new setup to be miles quicker. To my horror, it was slower. Much slower: cpu=12s, gpu=20s.

The example only has 128 nodes in the hidden layer. If I increase that to 2048, the gpu is much faster (cpu=162s, gpu=31s). Increasing the number of layers (without changing nodes per layer) results in cpu being faster, even with 10 hidden layers.

Is this surprising? What with all the hype around ML with GPUs, I expected it to be way quicker even with relatively few nodes per layer. Is there something wrong with my setup or do you only feel the benefit of the GPU’s parallel computing if you’re using layers with large numbers of nodes?

submitted by /u/smiles17
[link] [comments]

[P] Machine learning toolkit for packaging and deploying models

Hi guys.

We recently open sourced a project, BentoML that packaging and deploying ML models to production. We would love to hear your thoughts.

Quick pitch: From model in Jupyter notebook to production in 5 minutes.

BentoML is a python library for packaging and deploying ML models. It does two things without any changes to your training workflow: 1. It standardize how to package your models, including preprocessing / feature fetching code, dependencies/env, and configuration. 2. It easily distributes your model as Pypi package, API server(local /docker image), CLI tool or spark UDF.

We think there should be a simple way for data scientists to ship models to production. Our vision is empower them to own models ‘end-to-end’ for production service, just like software engineers do.

Here is a quick look of how it works:

In your notebook, you have trained your scikit-learn model: from sklearn import svm from sklearn import datasets

 clf = svm.SVC(gamma='scale') iris = datasets.load_iris() X, y = iris.data, iris.target clf.fit(X, y) 

To package this model with BentoML, you will need to create a new BentoService by subclassing it, and provides artifacts and env definition for it:

 %%writefile iris_classifier.py from bentoml import BentoService, api, env, artifacts from bentoml.artifact import PickleArtifact from bentoml.handlers import DataframeHandler @artifacts([PickleArtifact('model')]) @env(conda_dependencies=["scikit-learn"]) class IrisClassifier(BentoService): @api(DataframeHandler) def predict(self, df): return self.artifacts.model.predict(df) 

Now, to save your trained model for prodcution use, simply import your BentoService class and pack it with required artifacts: from iris_classifier import IrisClassifier

 svc = IrisClassifier.pack(model=clf) svc.save('./saved_bento', version='v0.0.1') # Saving archive to ./saved_bento/IrisClassifier/v0.0.1/ 

That’s it. Now you have created your first BentoArchive. It’s a directory containing all the source code, data and configurations files required to run this model in production.

Couple ways to use this packaged model archive.

Serve the model as local REST API endpoint:

 bentoml serve --archive-path="./saved_bento/IrisClassifier/v0.0.1/" 

Build API server Docker Image from BentoArchive

 $cd ./saved_bento/IrisClassifier/v0.0.1/ $docker build -t myorg/iris-classifier . # After docker build finish $docker run -p 5000:5000 myorg/iris-classifier 

Load your packaged archive in Python:

 import bentoml bento_svc = bentoml.load('./saved_bento/IrisClassifier/v0.0.1/') bento_svc.predict(X[0]) 

Install BentoArchive as PyPI package

 pip install ./saved_bento/IrisClassifier/v0.0.1/ 

Now you can use it as module in your python code

 from IrisClassifier import IrisClassifier installed_svc = IrisClassifier() installed_svc.predict(X[0]) 

Use archived package as CLI tool:

$pip install ./saved_bento/IrisClassifier/v0.0.1/ $IrisClassifier info $IrisClassifier predict --input='./test.csv' 

Alternatively, you can also use the bentoml cli to load and run the package directly:

bentoml predict ./saved_bento/IrisClassifier/v0.0.1/ --input='./test.csv' 

Feel free to ping me and ask any questions. I love to get you guys feedback and improve this project.

Cheers!

edit: formatting

submitted by /u/yubozhao
[link] [comments]

[D] Any ideas on how to map a variably sized sequence of vectors into a fixed size vector?

Hi redditors,

I am currently working on a project which includes a topic extraction pipeline and now I want to create document embeddings using the Google BERT model instead of good old Tf-Idf. Sadly BERT has a limit on the input size and therefore I cannot push whole texts into it. Now I need to encode each sentence and generate a document feature vector out of it. I had a look at the literature, but that does not seem to be an active research problem. Are you aware of any techniques which encode e.g. the semantic structure of the sequence into such a vector?

submitted by /u/timuber
[link] [comments]

[P] Self organizing map of english characters and numbers, based on looks

I trained a convolutional neural net to recognize latin alphabet characters, and numbers (0-9, A-Z, a-z), then let it predict the category of all characters of a single font, then extracted that into 62 vectors, each describing how the computer sees those pictures of characters. I fed those 62 vectors into a self organizing map.

This is the map I got: map

The CNN had the accuracy of 98-99% (maybe overfitted but idc), and outputs were 128 dimensional vectors, the first layer after flattening. Flattened -> layer -> output layer w 62 categories

Overall I’m pretty happy with how it turned out, here I marked some groups I noticed. Also I think its cool how it separated the curvy from sharp-angled symbols into 2 “main” groups.

This is one of my first machine learning projects, and the first one w SOM’s and CNN’s. Any feedback is appreciated 🙂

Also, I noticed how every time the map is generated, the outlying datapoints are closer to nodes. Specially corners. Does anyone know why would that be? Maybe the data is “spherical”, in it’s 128 dimensions… That recurs every time the map is generated (using random weights initialization)

I did this only to see what I’ll get. I explained that to my mom, saying how it’s interesting but useless. She said “You’ve made a tool, you just have to figure out its use” hahaha. So yea, I have a tool, but I have no idea on what/how to use it. Could you, people of reddit, think of something that would benefit from CNN-SOM hybrids?

submitted by /u/matejkozic
[link] [comments]

[D] PyTorch implementation best practices

Hi r/MachineLearning! Let’s discuss PyTorch best practices.

I recently finished a PyTorch re-implementation (with help from various sources) for the paper Zero-shot User Intent Detection via Capsule Neural Networks, which originally had Python 2 code for TensorFlow.

I’d like to request perhaps a critique on the code I’ve written so far (it’s not perfect, yet!) and any suggestions if there are best practices specifically in PyTorch, for implementing directly from research papers as well as converting them from other frameworks.

Some thoughts I had while programming (feel free to raise more!):

  1. I’ve been implementing a Dataset class and custom batch functions for every dataset I’ve been working with. Is this the PyTorch best practice?

  2. Where is the optimal place to shift Tensors to .cuda()? I’ve been doing this in the training loop, just before feeding it into the model.

  3. How to manage the use of both numpy and torch, seeing as PyTorch aims to reinvent many of the basic operations in numpy?

If you’re a fellow PyTorch user/contributor please share a little!

submitted by /u/floodvalve
[link] [comments]

[P] Deep learning tutorial from first principles

Hey All,

I’ve recently started a series of Instagram posts showing how we can derive many of the inner workings of deep learning from first principles. I find too many deep learning courses that gloss over fundamentals, and it’s probably due to the industry’s prioritization to churn out workers to train models and produce results quickly. But if we want to master our craft and move behind equations and code with ease, I believe we need to understand the fundamental principles.

Another reason why I’m doing this is because I’m a firm believer of Feynman’s “What I cannot create, I do not understand.” This project is also a way for me to solidify my understanding of deep learning.

Check it out:

https://www.instagram.com/learnsohdeep/

submitted by /u/sohyongsheng
[link] [comments]

[P] 5-min paper challenge + cash prize; UPDATE

I recently posted this competition we are running; do a 5-min video of any ML paper for a chance to win a prize. Here is an update (link for more details):

1- deadline for submission is April 29th now

2- the first place prize is $400 (+ more prizes)

3- you get points for challenging others to participate (they have to write your name when they submit)

4- you can submit as a team

5- we will hold more office hours to help you figure out any challenges you face

Any thoughts, questions, feedback? don’t hesitate to let me know

more detail: https://aisc.a-i.science/5-min-challenge/

submitted by /u/tdls_to
[link] [comments]

[D] Kaiming He’s original residual network results in 2015 have not been reproduced, not even by Kaiming He himself.

What’s going on here? I have not found a single paper that reproduces or compares against the results shown in Table 4 of the original residual network paper. All papers report significantly worse numbers.

https://arxiv.org/pdf/1512.03385.pdf

top1 err numbers from the paper:

ResNet-50 @ 20.74

ResNet-101 @ 19.87

ResNet-152 @ 19.38

This paper have 20,000+ citations. DenseNet (https://arxiv.org/abs/1608.06993, 3000+ citations) and Wide ResNets (https://arxiv.org/abs/1605.07146, ~1000 citations) don’t use this result. Not even one of Kaiming He’s recent papers (https://arxiv.org/abs/1904.01569) use this result. Since I’m new to the community, maybe I’m missing something here. But isn’t this paper one of the most cited pieces of work in the field??

submitted by /u/CatchADragonFish
[link] [comments]

Protagonist adopts Amazon Translate to expand analytics to multilingual content

This is a guest blog post by Bryan Pelley, COO of Protagonist. Protagonist, in their own words “helps organizations communicate more effectively through a data-driven understanding of public discourse.”

Protagonist is a pioneer of the art and science of understanding narratives. We define narratives as the beliefs that an audience holds that are  composed of an interrelated set of concepts, themes, images, and ideas that coalesce into a story. Narratives matter because they reflect the deeply held needs, wants, and desires that weigh heavily, both consciously and unconsciously, on human decision-making. Using Amazon Translate, Protagonist can analyze narratives in languages other than English, which enables us to win global customers.

The Protagonist Narrative Analytics platform uses natural language processing (NLP) and machine learning (ML), guided by human expertise, to surface, measure, and track the narratives that matter to our customers across traditional, social, and other types of online media. The following diagram illustrates our Narrative Analytics solution.

Protagonist has been limited, with a few exceptions, to analyzing English-only content, which we’ve seen as a limitation on the long-term growth of our business. Numerous customers and prospective customers have expressed serious interest in projects involving international narratives.  To create these narratives we would need to work with native language content.

In the past, we were able to do a small number of projects in foreign languages, primarily French and Spanish, thanks to fluent speakers on staff. In these cases, our team would either run the analysis on the content without translation, which limited the range of NLP tools we were able to use. Or, we manually translated a sample set of the overall corpus of content and ran our full suite of tools on the translated set. Sometimes we used a combination of both processes. However, this staff-based manual solution didn’t scale, and it was not efficient. Manually translating a sample of 1,000 media articles took about two weeks. This was a significant delay in providing timely narrative analysis to our customers.

Amazon Translate has changed that for us, enabling us to quickly and effectively translate multilingual content into English for analysis on our narrative platform. We tried a few other machine translation services in the past, but were unhappy with the performance, cost, and, in some cases, the requirement to commit to a long-term contract. Amazon Translate gives us the right combination of speed, accuracy of translation, cost effectiveness, and on-demand flexibility to meet our needs. What used to take two weeks or more to translate now can be done in minutes using Amazon Translate.

We piloted the Amazon Translate service in 2018 on a project for one of our customers, Omidyar Network (ON). One of ON’s major focus areas is property rights. They want to address the fact that a large percentage of the world’s population has limited or nonexistent protections for their property and resources. Naturally, to address a global issue like this, ON wants to understand the narratives that local populations around the world have about their rights, or lack of rights, to land and other property. Using international English language media sources, we were able to help ON gain an understanding of the narratives at play. As the following illustration indicates, analysis of English-only content showed that property rights narratives differed significantly by region, which prompted a desire for a deeper analysis of content in local native languages. For this reason, we saw ON’s property rights work as an ideal place to test Amazon Translate.

Peter Rabley, Venture Partner at Omidyar Network, describes their property rights efforts and the role of Protagonist:

“More than one billion people around the world lack legal rights to their land and property. However, it’s an issue that not enough people pay attention to because it seems too complicated, too complex to wrap your head around. We believe that by simplifying language and telling human interest stories, those in the field can raise greater awareness of the need—sparking innovative solutions, more financing and greater overall engagement. We needed a way to see what the initial conversations around property rights looked like globally in more than one language, and understand how better storytelling may have impacted those conversations over time. This is what Protagonist’s Narrative Analytics allows us to do, helping underscore the value of our investments and unlocking valuable insights for all of us working to advance property rights around the world. Importantly, Protagonist has been able to provide its Narrative Analytics in multiple languages including Spanish.”

As Peter notes, we initially chose to work with Amazon Translate on Spanish language content. We had experience working with Spanish content in the past and access to fluent Spanish speakers, so we could double-check the Amazon Translate outputs and easily identify and troubleshoot issues as they arose. Ultimately, that was not needed because the accuracy of the translations performed by the Amazon Translate service performed was high.

The performance of the Amazon Translate service met or exceeded our expectations. Initially, the API’s rate limit caused some concurrency issues for us because we kept unknowingly exceeding the limit. Since our pilot of the Amazon Translate service, AWS has added a metrics dashboard to the AWS Management Console that makes it easy for us to know if we’re exceeding the rate limit and make adjustments as necessary.

We noticed that AWS has been very thoughtful in keeping Amazon Translate API parameters very flexible, so that when languages are added we can easily integrate the newly supported languages in our data workflows. Specifically, AWS keeps the Python package Boto3 very stable, which allows us to update to the latest version of Boto3 without the worry of breaking existing functionality.

Overall, using Amazon Translate provided several advantages over our previous human-based translation solution. We were able to eliminate the need for time-consuming manual translation. Amazon Translate was able to complete in a matter of minutes translation tasks that would have taken us 60 hours or more in the past. This meant we could expand the amount of content we analyzed with our full suite of tools from a sample of a few hundred articles to tens or hundreds of thousands of articles. We were able to effectively leverage our NLP tools that were trained with only English language corpuses, such as Narrative Richness, cluster analysis, sentiment scoring, and topic modeling. The ability to accurately analyze large amounts of foreign language content using our English-language-trained NLP tools on the translated materials represents a significant cost and time savings for us.

But perhaps most importantly, Amazon Translate provides cost-effective access to a range of languages that we haven’t been able to work with before, including Arabic, Chinese, and Russian. This opens up a wide range of customers and opportunities that we couldn’t have supported before. We’re in active discussions with several large customers on global narrative projects that would make extensive use of the Amazon Translate capabilities. We’re excited to continue working with Amazon Translate and exploring the new opportunities that the service brings.