If I use nvidia's stylegan, which is CC BY-NC, to generate images that then will be part of a dataset used as input of my own ML algorithm, do I infringe the stylegan license if I make a remuneration of the final output?
Is the output of an ML algorithm a derived work, and if so from what? I'd argue that it is a derived work not of the ML software but only of the training data set as whole, so that this training set's database rights are relevant. Here, you seem to be dealing with an CC-BY-NC-SA 4.0 dataset, which is not suitable for your purposes.
The first question is whether the generated images would be a derived work in the sense of copyright of the CC-BY-NC licensed stylegan, or of the training data set. If they are not a derived work, then the original license is irrelevant.
In my opinion the generated images are not derived from the stylegan software: The generated images are not a copy of modified version of the software. They are just data that is processed by the software. Therefore, stylegan's CC-BY-NC license cannot affect the generated images.
It is more difficult to tell whether the generated images would be a derivative work of the training data set. The training data set may have two levels of licensing: first for database rights for the curation of the training set, second for the individual images in the data set. It could be argued that the generated images are derived from both the database and its individual training images as the stylegan software just extracts, weighs, and recombines elements of the training data set.
However, it is unclear to me whether this is done at a level that is relevant for copyright.
Very possibly, the elements of individual training images are unrecognizable in the generated images, so that the licensing of the training images would be irrelevant (as long as the training data set was created legally).
The appearance of generated images would however depend substantially on the training data set as a whole: the stylegan software just performs an automated and randomized translation of the dataset into a generated image. I would argue this is not fundamentally different from a panorama stitching software, except that in stylegan the original images are unrecognizable from the output. I therefore believe the generated images are derived from the training dataset as a whole.
So the stylegan license and the original image license is likely irrelevant, but your images are bound by the license of the training data set as a whole.
Stylegan defaults to the Flickr-Faces-HQ dataset which uses CC-BY-NC-SA 4.0. As a share-alike license this extends to derived works, and I have argued above that generated images might be derived works and therefore subject to this license with its NonCommercial clause.
The generated images are Adapted Material in the sense of the CC-BY-NC-* licenses. Per 2(a)(1)(B) you can only produce Adapted Material for NonCommercial purposes, which are defined as “primarily intended for or directed towards commercial advantage or monetary compensation”. Therefore: you cannot generate images from the NonCommercial dataset if the primary purpose of the generated images is to bring you some commercial advantage, such as training your own ML model that would then have more immediate economic benefit.
You would instead have to find or create a different training dataset that is not encumbered by the NonCommercial restriction. But again, I don't think that stylegan's license itself is restrictive here, so you can still use that software (but likely not share or adapt it).