Bitswired

Bitsletter #7: Accelerating ML Training & Diving into Geometry-aware 3D GANs

Loading...

šŸ§  ML Tip: Pay attention to data loading

Data loading is an important part of any machine learning project. ModelsĀ need data, and data must beĀ carefully preparedĀ andĀ fedĀ to them. Training time is another important factor in machine learning: the quicker is your training loop, the most examples you can show to your model for the same time budget. Nowadays, access to accelerated hardware such as GPUs isĀ ubiquitous, itā€™s also mandatory to train big models on big datasets in a decent amount ofĀ time.

However, itā€™s not as easy as attaching a GPU to your virtual machine. Whatā€™s the point of using a GPU if yourĀ utilization rate is low? Indeed, GPUs are so fast at matrix multiplications that your data loading process must transfer data to them as efficiently as possible. Otherwise the GPU will spend most of its timeĀ waiting for data. If the data fits into your memory, you should not have much trouble. The CPU should be able to transfer the data quickly to the GPU (except if you do a lot of CPU bound preprocessing before sending the data).

However, in most cases, theĀ data doesnā€™t fit entirely in your memory, and your data loading becomesĀ IO-bound: you spend time reading data from the disk every time you build a batch for the GPU. Most of the time, if you perform data loading naively, you wonā€™t optimize these IO calls, resulting in a poor utilization of your GPU. Techniques such as moving preprocessing inside the GPU, pre-loading batches of data in advance or using memory mapped files can greatly improve your performance. Fortunately there exists libraries to help you implementing these tricks in you project, such asĀ mmap.ninjaĀ orĀ FFCV.

šŸŒ Web Tip: Web Tip: You should use TypeScript

Javascript took overĀ web frontendĀ development with libraries suchĀ jQuery,Ā React,Ā Vue orĀ Svelte. Projects likeĀ React NativeĀ even empowered web developers toĀ build mobile applications. Javascript also became widely used inĀ backendĀ applications with theĀ NodeĀ runtime.

Thatā€™s great right? One language to build full-stack applications from frontend to backend. However it has some caveats. Javascript is aĀ dynamically typed languageĀ with no static type checking at dev/build time. Itā€™s awesome at the beginning since you write code super fast.

However you quickly miss some features of statically types languages: greatĀ autocompletion, tons ofĀ bug detected at dev/buildĀ time,Ā code quality**, improved developer experience ā€¦

Here comesĀ TypeScript, as JavaScript superset and strongly typed language. It compiles to JavaScript so your code canĀ run on any JS runtime. It brings you tons of benefits: static type checking catch many bugs to prevent crashes at run time. Ever forgot to check for null values? Not anymore with TypeScript. It also integrates better with your code editor, since the type information allow better tooling, autocompletion and more.

Itā€™s not that hard to pick up, and you will gain much more confidence in your code. Stop sweating when your continuous delivery triggers the deployment of your new release šŸ˜….

šŸ‘©ā€šŸ”¬ Research Paper: Efficient Geometry-aware 3d Generative Adversarial Network (EG3D)

NVlabs released publicly theĀ officialĀ PyTorch implementationĀ of EG3D (CVPR 2022 Paper). Efficient Geometry-aware 3d Generative Adversarial Network (EG3D)Ā is a recent paper about using GANs to generate multiple consistent view of images and 3D shapes. TheyĀ only use 2D pictures has an input, which makes the problem particularly challenging.

Loading...
EG3D

Existing 3d GANs models areĀ computationally intensiveĀ orĀ sacrifice consistencyĀ by making approximations to reduce the computation time: it alters the multi-view consistency, meaning that a same object generated at different angles will clearly exhibits geometry or texture flaws. A key process to achieve their impressive results was toĀ decouple feature generation and neural renderingĀ to leverage state-of-the-art 2D CNN such as StyleGAN2. Definitely worth reading. šŸ’” It's insightful to have access to the code produced by top AI labs. Reading others' code, is the best way to learn new techniques, tricks, useful libraries, ...

šŸ› Ā Tool: Plasmo, build browser extensions easily

It's like NextJS but for browser extensions.

Who doesn't have any browser extensions? You likely have at least an ad-blocker. Browser extensionsĀ add features to the browsers. They allow you to integrate your products directly inside the Chrome, Firefox, Safari, ... of your users. PlasmoĀ is a framework to ease the development process of browser extensions.

šŸ‘‰šŸ½ First-class React +Ā TypeScriptĀ Support
šŸ‘‰šŸ½ Declarative development withĀ manifest.jsonĀ auto-generation
šŸ‘‰šŸ½ Live-reloading
šŸ‘‰šŸ½ .env*Ā files
šŸ‘‰šŸ½ Remote code bundling
šŸ‘‰šŸ½ Automated deployment

Do not hesitate anymore. If you application can benefit from a browser extension, use Plasmo and build it in a glimpse.

šŸ“° News

Grid.ai

Lightning AI is theĀ startupĀ behind theĀ PyTorch Lightning frameworkĀ which dramatically reduces theĀ boilerplateĀ of PyTorch projects.

The startup also provide aĀ SaaS to easily scale your machine learningĀ workloads in theĀ cloudĀ and leverage distributed training using many GPUs.

Push API: Web Push Notifications coming to iOS and Safari

Apple is working on the Web Push NotificationsĀ for iOS and Safari. As part of the iOS 16 release, Safari will support theĀ Push API. This is a great new for web developers, since the Push API is becoming aĀ standard for sending notificationsĀ to your users.