Categories
Misc

From Imagination to Animation, How an Omniverse Creator Makes Films Virtually

Growing up in the Philippines, award-winning filmmaker Jae Solina says he turned to movies for a reminder that the world was much larger than himself and his homeland.

The post From Imagination to Animation, How an Omniverse Creator Makes Films Virtually appeared first on The Official NVIDIA Blog.

Categories
Misc

Single or multiple output for model

I want to predict the genre(s) of the given text. The dataset I am planning on using is this kaggle dataset. While I know how to predict a single genre, I am not sure how to work with a possibility of more than 1 genre if needed.

submitted by /u/Electric_Dragon1703
[visit reddit] [comments]

Categories
Misc

Global AI Weather Forecaster Makes Predictions in Seconds

Graphic of a hurricane approaching the southwest US from a global view.Using convolutional neural networks researchers create an algorithm that can quickly calculate global forecasts 4 to 6 weeks into the future.Graphic of a hurricane approaching the southwest US from a global view.

New weather-forecasting research using AI is fast-tracking global weather predictions. The study, recently published in the Journal of Advances in Modeling Earth Systems, could help identify potential extreme weather 2–6 weeks into the future. Accurate predictions of extreme weather with a longer lead time give communities and critical sectors such as public health, water management, energy, and agriculture more time to prepare for and mitigate potential disasters.

Climate change is amplifying the intensity and frequency of extreme weather events, with 2021 shattering storm, heatwave, flood, and drought records across the globe. According to a recent NOAA report, last year the US experienced 20 separate climate-induced weather disasters, each totaling over $1 billion in damage. 

Short-term and seasonal weather forecasting can play a large role in decreasing the socioeconomic and human costs of extreme weather. In 2019, meteorologists warned local and national leaders in the Philippines of a torrential rainstorm looming about 3 weeks out. The forecast gave communities time to weatherize structures and evacuate before the Category 4 Typhoon hit, saving lives, and reducing overall damage to the region. 

Current weather forecasting relies on supercomputers processing large amounts of global data such as temperature, pressure, humidity, and wind speed. These systems require massive computational resources and take time to process. 

Also, according to the authors, the ability to accurately predict forecasts further out, from several weeks to months, decreases significantly. 

Looking to improve current weather forecasting the researchers aimed to create a computationally efficient model, capable of accurately predicting upcoming weather called the Deep Learning Weather Prediction (DLWP). Originally introduced in a paper published in 2020, the DLWP relies on an AI algorithm that learns and recognizes patterns in historical weather data based on global grids.

The current work refines the DLWP by training a deep convolutional neural network on two additional data points—temperature at the atmospheric boundary layer and total column water vapor. They also improved the grid resolution at the equator to approximately 1.4°. 

Running on a single cuDNN-accelerated TensorFlow deep learning framework on an NVIDIA V100 GPU, the model runs 320 ensemble 6-week forecasts in just 3 minutes. The algorithm can process a 1-week forecast in 1/10th of a second. 

The DLWP is able to produce realistic forecasting of weather events such as Hurricane Irma, a Category 4 storm that hit Florida and the Caribbean in 2017. While the speedy DLWP model matches the performance of current state-of-the-art weather forecasters 4 to 6 weeks into the future, it has limitations predicting precipitation and is less accurate in shorter lead times of 2–3 weeks. 

According to the study, the DLWP may also prove a valuable tool for supplementing spring and summer forecasts in the tropics, a region that challenges current weather models.

The open-source code is available on GitHub.


Read the study in Journal of Advances in Modeling Earth Systems. >>

Read more. >>

Categories
Offsites

Scaling Vision with Sparse Mixture of Experts

Advances in deep learning over the last few decades have been driven by a few key elements. With a small number of simple but flexible mechanisms (i.e., inductive biases such as convolutions or sequence attention), increasingly large datasets, and more specialized hardware, neural networks can now achieve impressive results on a wide range of tasks, such as image classification, machine translation, and protein folding prediction.

However, the use of large models and datasets comes at the expense of significant computational requirements. Yet, recent works suggest that large model sizes might be necessary for strong generalization and robustness, so training large models while limiting resource requirements is becoming increasingly important. One promising approach involves the use of conditional computation: rather than activating the whole network for every single input, different parts of the model are activated for different inputs. This paradigm has been featured in the Pathways vision and recent works on large language models, while it has not been well explored in the context of computer vision.

In “Scaling Vision with Sparse Mixture of Experts”, we present V-MoE, a new vision architecture based on a sparse mixture of experts, which we then use to train the largest vision model to date. We transfer V-MoE to ImageNet and demonstrate matching state-of-the-art accuracy while using about 50% fewer resources than models of comparable performance. We have also open-sourced the code to train sparse models and provided several pre-trained models.

Vision Mixture of Experts (V-MoEs)
Vision Transformers (ViT) have emerged as one of the best architectures for vision tasks. ViT first partitions an image into equally-sized square patches. These are called tokens, a term inherited from language models. Still, compared to the largest language models, ViT models are several orders of magnitude smaller in terms of number of parameters and compute.

To massively scale vision models, we replace some dense feedforward layers (FFN) in the ViT architecture with a sparse mixture of independent FFNs (which we call experts). A learnable router layer selects which experts are chosen (and how they are weighted) for every individual token. That is, different tokens from the same image may be routed to different experts. Each token is only routed to at most K (typically 1 or 2) experts, among a total of E experts (in our experiments, E is typically 32). This allows scaling the model’s size while keeping its computation per token roughly constant. The figure below shows the structure of the encoder blocks in more detail.

V-MoE Transformer Encoder block.

Experimental Results
We first pre-train the model once on JFT-300M, a large dataset of images. The left plot below shows our pre-training results for models of all sizes: from the small S/32 to the huge H/14.

We then transfer the model to new downstream tasks (such as ImageNet), by using a new head (the last layer in a model). We explore two transfer setups: either fine-tuning the entire model on all available examples of the new task, or freezing the pre-trained network and tuning only the new head using a few examples (known as few-shot transfer). The right plot in the figure below summarizes our transfer results to ImageNet, training on only 5 images per class (called 5-shot transfer).

JFT-300M Precision@1 and ImageNet 5-shot accuracy. Colors represent different ViT variants and markers represent either standard ViT (●), or V-MoEs (▸) with expert layers on the last n even blocks. We set n=2 for all models, except V-MoE-H where n=5. Higher indicates better performance, with more efficient models being to the left.

In both cases, the sparse model strongly outperforms its dense counterpart at a given amount of training compute (shown by the V-MoE line being above the ViT line), or achieves similar performance much faster (shown by the V-MoE line being to the left of the ViT line).

To explore the limits of vision models, we trained a 15-billion parameter model with 24 MoE layers (out of 48 blocks) on an extended version of JFT-300M. This massive model — the largest to date in vision as far as we know — achieved 90.35% test accuracy on ImageNet after fine-tuning, near the current state-of-the-art.

Priority Routing
In practice, due to hardware constraints, it is not efficient to use buffers with a dynamic size, so models typically use a pre-defined buffer capacity for each expert. Assigned tokens beyond this capacity are dropped and not processed once the expert becomes “full”. As a consequence, higher capacities yield higher accuracy, but they are also more computationally expensive.

We leverage this implementation constraint to make V-MoEs faster at inference time. By decreasing the total combined buffer capacity below the number of tokens to be processed, the network is forced to skip processing some tokens in the expert layers. Instead of choosing the tokens to skip in some arbitrary fashion (as previous works did), the model learns to sort tokens according to an importance score. This maintains high quality predictions while saving a lot of compute. We refer to this approach as Batch Priority Routing (BPR), illustrated below.

Under high capacity, both vanilla and priority routing work well as all patches are processed. However, when the buffer size is reduced to save compute, vanilla routing selects arbitrary patches to process, often leading to poor predictions. BPR smartly prioritizes important patches resulting in better predictions at lower computational costs.

Dropping the right tokens turns out to be essential to deliver high-quality and more efficient inference predictions. When the expert capacity decreases, performance quickly decreases with the vanilla routing mechanism. Conversely, BPR is much more robust to low capacities.

Performance versus inference capacity buffer size (or ratio) C for a V-MoE-H/14 model with K=2. Even for large C’s, BPR improves performance; at low C the difference is quite significant. BPR is competitive with dense models (ViT-H/14) by processing only 15-30% of the tokens.

Overall, we observed that V-MoEs are highly flexible at inference time: for instance, one can decrease the number of selected experts per token to save time and compute, without any further training on the model weights.

Exploring V-MoEs
Because much is yet to be discovered about the internal workings of sparse networks, we also explored the routing patterns of the V-MoE.

One hypothesis is that routers would learn to discriminate and assign tokens to experts based on some semantic grounds (the “car” expert, the “animal” experts, and so on). To test this, below we show plots for two different MoE layers (a very early-on one, and another closer to the head). The x-axis corresponds to each of the 32 experts, and the y-axis shows the ID of the image classes (from 1 to 1000). Each entry in the plot shows how often an expert was selected for tokens corresponding to the specific image class, with darker colors indicating higher frequency. While in the early layers there is little correlation, later in the network, each expert receives and processes tokens from only a handful of classes. Therefore, we can conclude that some semantic clustering of the patches emerges in the deeper layers of the network.

Higher routing decisions correlate with image classes. We show two MoE layers of a V-MoE-H/14. The x-axis corresponds to the 32 experts in a layer. The y-axis are the 1000 ImageNet classes; orderings for both axes are different across plots (to highlight correlations). For each pair (expert e, class c) we show the average routing weight for the tokens corresponding to all images with class c for that particular expert e.

Final Thoughts
We train very large vision models using conditional computation, delivering significant improvements in representation and transfer learning for relatively little training cost. Alongside V-MoE, we introduced BPR, which requires the model to process only the most useful tokens in the expert layers.

We believe this is just the beginning of conditional computation at scale for computer vision; extensions include multi-modal and multi-task models, scaling up the expert count, and improving transfer of the representations produced by sparse models. Heterogeneous expert architectures and conditional variable-length routes are also promising directions. Sparse models can especially help in data rich domains such as large-scale video modeling. We hope our open-source code and models help attract and engage researchers new to this field.

Acknowledgments
We thank our co-authors: Basil Mustafa, Maxim Neumann, Rodolphe Jenatton, André Susano Pinto, Daniel Keysers, and Neil Houlsby. We thank Alex Kolesnikov, Lucas Beyer, and Xiaohua Zhai for providing continuous help and details about scaling ViT models. We are also grateful to Josip Djolonga, Ilya Tolstikhin, Liam Fedus, and Barret Zoph for feedback on the paper; James Bradbury, Roy Frostig, Blake Hechtman, Dmitry Lepikhin, Anselm Levskaya, and Parker Schuh for invaluable support helping us run our JAX models efficiently on TPUs; and many others from the Brain team for their support. Finally, we would also like to thank and acknowledge Tom Small for the awesome animated figure used in this post.

Categories
Misc

How Retailers Meet Tough Challenges Using NVIDIA AI

At the National Retail Federation’s annual trade show, conversations tend to touch on recurring themes: “Will we be able to stock must-have products for next Christmas?,” “What incentives can I offer to loyal workers?” and “What happens to my margins if Susie Consumer purchases three of the same dresses online and returns two?” The $26 Read article >

The post How Retailers Meet Tough Challenges Using NVIDIA AI  appeared first on The Official NVIDIA Blog.

Categories
Misc

AI Startup to Take a Bite Out of Fast-Food Labor Crunch

Addressing a growing labor crisis among quick-service restaurants, startup Vistry is harnessing AI to automate the process of taking orders. The company will share its story at the NRF Big Show, the annual industry gathering of the National Retail Federation in New York, starting Jan. 16. “They’re closing restaurants because there is not enough labor,” Read article >

The post AI Startup to Take a Bite Out of Fast-Food Labor Crunch appeared first on The Official NVIDIA Blog.

Categories
Misc

GFN Thursday: ‘Fortnite’ Comes to iOS Safari and Android Through NVIDIA GeForce NOW via Closed Beta

Starting next week, Fortnite on GeForce NOW will launch in a limited-time closed beta for mobile, all streamed through the Safari web browser on iOS and the GeForce NOW Android app. The beta is open for registration for all GeForce NOW members, and will help test our server capacity, graphics delivery and new touch controls Read article >

The post GFN Thursday: ‘Fortnite’ Comes to iOS Safari and Android Through NVIDIA GeForce NOW via Closed Beta appeared first on The Official NVIDIA Blog.

Categories
Misc

World Record-Setting DNA Sequencing Technique Helps Clinicians Rapidly Diagnose Critical Care Patients

Cutting down the time needed to sequence and analyze a patient’s whole genome from days to hours isn’t just about clinical efficiency — it can save lives. By accelerating every step of this process — from collecting a blood sample to sequencing the whole genome to identifying variants linked to diseases — a research team Read article >

The post World Record-Setting DNA Sequencing Technique Helps Clinicians Rapidly Diagnose Critical Care Patients appeared first on The Official NVIDIA Blog.

Categories
Misc

Custom model.predict() function

Hi!

I have a prediction routine that involves doing some postprocessing of the output of model.predict(x) function. The postprocessing involves a comparison of the output to a the mean output of all training data. The process has worked well until now, but I would like to combine it all, mean training vector included, into a TF SavedModel. I.e. I’m trying to get the final output (postprocessing included) when calling model.predict(x)

Is there any way to customize the functionality of the model.predict(x) function?

What my current pipeline looks like:

mean_training_output = # an array consisting of the mean output vector from the training data predicted = model.predict(x) # Compare distance of new and mean training output normalized_distance = np.zeros(len(predicted)) for i in range(len(predicted)): normalized_distance[i] = np.linalg.norm(feature_vectors_flattned[i]-mean_training_output) # What I actually want model.predict() to output normalized_distance 

So in the above snippet I would actually want model.predict() to output normalized_distance.

submitted by /u/Maltmax
[visit reddit] [comments]

Categories
Misc

Slice of 20 elements from rank 1 tensor then reshaping throws "Input to reshape is tensor with 10272 values, but requested shape requires multiple of 20"

I posted this question to stack exchange here:

https://stackoverflow.com/questions/70686521/slice-of-20-elements-of-rank1-tensor-then-reshaping-throws-input-to-reshape-is

My input tensor “`Data = Input(shape=(856,))“` is a vector of float32 values concatenated from many different devices. I am trying to apply different TensorFlow functions to different subslices of each input chunk. Some of these functions include a 1D Convolution which requires a reshape.

slice = Data[:20]

reshape = tf.reshape(slice, (-1, 20, 1))

Doing this crashes after trying to fit my model. It throws the following errors:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 10272 values, but the requested shape requires a multiple of 20

[[node model/tf.reshape_1/Reshape

(defined at /home/.local/lib/python3.8/site-packages/keras/layers/core/tf_op_layer.py:261)

]] [Op:__inference_train_function_1858]

Errors may have originated from an input operation.

Input Source operations connected to node model/tf.reshape_1/Reshape:

In[0] model/tf.__operators__.getitem_1/strided_slice:

In[1] model/tf.reshape_1/Reshape/shape:

I am not sure how slicing 20 elements from a tensor of 856 could result in a tensor of 10272 values.

I have also tried using the “`tf.slice“` function a couple of different ways; both fail. Referencing the docs: https://www.tensorflow.org/guide/tensor_slicing

slice = tf.slice(Data, begin=[0], size=[20])

And fails, stating:

Shape must be rank 1 but is rank 2 for ‘{{node tf.slice/Slice}} = Slice[Index=DT_INT32, T=DT_FLOAT](Placeholder, tf.slice/Slice/begin, tf.slice/Slice/size)’ with input shapes: [?,856], [1], [1].

For reference, here is what some of the values look like in the input data

array([-9.55784683e+01, -1.70557899e+01, 2.95967350e+01, 7.81378937e+00,

9.02729130e+00, 5.49621725e+00, 4.19811630e+00, 5.84186697e+00,

4.90438080e+00, 3.73845983e+00, 5.12300587e+00, 2.61530232e+00,

2.67061424e+00, 3.91038632e+00, 2.31110978e+00, 4.20644665e+00,

4.50000000e+00, 9.87345278e-01, 1.59740388e+00, 6.30727148e+00,

submitted by /u/EightEqualsEqualsDe
[visit reddit] [comments]