[GSoC] FaustNet: Enabling ML in Faust#1
Merged
hatchjaw merged 71 commits intohatchjaw:mainfrom Jan 5, 2025
Merged
Conversation
primitives added to diff.lib
A few more primitive additions.
|
hi sir, i have one doubt , i am going to select this org for gsoc 2026 , is this org good to choose |
Owner
Hi. It would be a good idea to try to find out more on the Faust discord server. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Google Summer of Code -- FaustNet: Enabling ML in Faust
The goal of the project is to introduce a foundational library for automatic differentiation within Faust, enabling the application of differentiable programming to digital signal processing tasks. In layman's terms, this library will make it easier for audio developers to use Faust to solve complex audio problems that involve machine learning. The major motivator behind this project was Google's Magenta project and its success in applying advanced techniques like differentiable programming to audio tasks, such as timbre transfer. My work in this project has been built on existing work on automatic differentiation in Faust, which is extended to machine learning in this PR.
This library, originally focused on the introduction of DDSP to Faust, is now extended to include more primitives and refine the previous work on parameter estimation. Additionally, it introduces Faust Neural Network Blocks, which allow for the seamless integration of neural network components directly within Faust programs.
This library is expected to serve as a comprehensive package that will not only broaden Faust's applicability in audio tasks but also provide a robust framework for future research and development in machine learning-based DSP.
PR Overview
The core of the library consists of a collection of Faust primitives, incorporating the concepts of automatic differentiation. These cover basic mathematical operations as well as commonly used audio processing functions, such as delays
@and trigonometric functionsatan2. The project also aims to explore and refine the implementation of loss functions specifically for frequency-domain applications.The PR also introduces the concept of Faust Neural Network Blocks (FNNBs), which are pre-written and encapsulated Faust code modules that represent specific neural network layer functionalities. To date, this is limited to the implementation of fully connected layers. FNNBs offer several benefits, including reduced development time, improved code maintainability, and enabling audio developers to focus on designing neural network architecture without needing to handle low-level programming for each layer.
By integrating the automatic differentiation (AD) library, FNNBs, and with further work, users may design and train complex neural network models for audio processing tasks directly within Faust. This approach eliminates the need to switch between Faust and separate machine learning frameworks, while still offering the benefits of automatic differentiation and optimization for efficient model training.
Deliverables
The following list of contributions have been made:
diff.liband an extension of the previous work on this library. Other operators have not been covered due to the non-differentiable nature of the operator itself.gain_scheduler.dsp).test-freqloss.dsp,freq_estimator.dspandfreq_estimator_rms.dsp, expanding beyond the previous examples focused on the time domain.Usage
The primitives defined in this library are highly effective in scenarios requiring automatic differentiation and are demonstrated through various examples of parameter estimation. A simple yet effective example of the same can be seen here:
This example allows us to estimate the parameter
gainvia the definition of a truth and learnable variable here. Via backpropagation, MAE loss functions, SGD as an optimizer, we can effectively setup a parameter estimation example. I also included examples to explore parameter estimation in the frequency-domain, but noticed that the loss landscape is so varied that our algorithm fails to learn about frequencies as a parameter sufficiently, apart from a few ranges. Frequency-domain loss functions are crucial in audio processing applications because they allow for direct control over the spectral characteristics of the output signal.Apart from that, I also defined a fully connected layer as an FNNB in an end-to-end differentiable manner, allowing audio developers to seamlessly integrate neural network layers into Faust programs, facilitating the design and training of more complex audio processing models. An example of the setup can be seen below (consisting of 2 fully connected layers, with backpropagation algorithms set up -- involving a single input$x$ to the structure).
Future Work and Exploration
For the future, I intend to keep contributing to this DDSP library. In relation to this project, there are a few tasks I plan to continue working on:
README.mdfor more information about the same.)Although previously covered in my GSoC proposal, a major area of work in the future could be to explore how architecture files would function in the context of offline training. This should include investigating the process of defining, managing, and optimizing these files to ensure efficient model training outside of real-time environments, while maintaining compatibility with the rest of the Faust ecosystem. With further development, the goal is for automatic differentiation and gradient descent to become core features of the Faust language. This PR represents a foundational step towards a future independent Faust library, offering a valuable contribution to the Faust community.
Challenges and Next Steps
Each challenge posed by autodiff during the creation of FNNBs -- which led to several weeks of unsuccessful experimentation and routing errors -- required careful troubleshooting, extensive testing, and often creative routing to overcome, all of which contributed to the project's overall complexity and the time required to develop a robust and extremely generalizable solution.