GithubHelp home page GithubHelp logo

Comments (5)

mrnikwaws avatar mrnikwaws commented on August 29, 2024

Hi ebochkov,

Thanks for the feedback. Unfortunately this is a known issue the team is working on: https://github.com/aws/aws-neuron-sdk/blob/master/docs/technotes/performance-tuning.md#compiling-for-batching-optimization (note 2). At the moment only the float32 options is available for PyTorch, leading to this restriction.

I'll comment back on this issue with any updates.

from aws-neuron-sdk.

aws-taylor avatar aws-taylor commented on August 29, 2024

Hello ebochkov,

I just wanted to let you know that we have not forgotten about you. While we do not have any fixes yet, we are hard at work with some performance and correctness fixes that we expect to improve our batching performance. We'll continue to track this issue and update as we have results.

-Taylor

from aws-neuron-sdk.

aws-zejdaj avatar aws-zejdaj commented on August 29, 2024

Still working on Pytorch batching support

from aws-neuron-sdk.

mrnikwaws avatar mrnikwaws commented on August 29, 2024

Hi ebochkov,

ResNet-50 is now running with batch sizes of greater than 1! In my testing I see the best results when I run compilation and inference using batch 5 for 224 x 224 images, but you should feel free to experiment. The team is working on updating some of the tutorial material for torch-neuron, but I wanted to let you know so that you can rerun your previous tests if you want to.

You can change the existing "compile-infer" tutorial for compilation by using:

batch_size = 5
image = torch.zeros([batch_size, 3, 224, 224], dtype=torch.float32)

in place of

image = torch.zeros([1, 3, 224, 224], dtype=torch.float32)

for compilation, and for inference change:

image = torch.tensor(image.numpy()[np.newaxis, ...])

## Load model
model_neuron = torch.jit.load( 'resnet50_neuron.pt' )

## Predict
results = model_neuron( image )

to

image = torch.tensor(image.numpy()[np.newaxis, ...])
batch_size = 5

## Create a "batch" image with enough images to go on each of the four cores
batch_image = image

for i in range(batch_size - 1):
    batch_image = torch.cat( [batch_image, image], 0 )

## Since the first inference also loads the model to the chip let's exclude it 
## from timing
results = model_neuron( batch_image )

This will simply make 5 copies of the image in the batch to test. Note that the tensor sizes for compilation and inference must match.

I am going to keep this issue open for now until I hear back from you or post a link to the updated tutorial information.

from aws-neuron-sdk.

mrnikwaws avatar mrnikwaws commented on August 29, 2024

The tutorial for ResNet-50 is now updated with the guidance requested here - closing this issue. Please re-open if you are still having problems.

from aws-neuron-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.