Grant Application: Google TensorFlow API Bindings for Perl, Phase 2
Sun, 23-Jul-2023 by
Saif Ahmed
edit post
## Grant Application: Google TensorFlow API Bindings for Perl, Phase 2
William N. Braswell, Jr. and Zakariyya Mughal have joined together again to extend their previous work on Google Tensor Flow. This is presented as Phase 2.
### Budget
The budget for this project is $8,800 USD
### Synopsis
This grant proposal is for the continued development of the Perl API to Google TensorFlow, a software library for machine learning (ML) and artificial intelligence (AI). TensorFlow is generally considered to be the most mature and well-supported ML/AI library, and will continue to benefit the Perl community tremendously.
Phase 1 of this TensorFlow grant series was [proposed on July 11th, 2022](https://news.perlfoundation.org/post/grant_proposal_tensorflow_jnap_july_2022); published for [final review](https://news.perlfoundation.org/post/project_google_tensorflow_api_bindings) on February 12th, 2023; and [presented](https://www.youtube.com/watch?v=jCawycAEVYU) at The Perl Conference in Toronto on July 13th, 2023.
We will implement four new TensorFlow system features for phase 2:
* Gradient Features Supported by C
* High-Level Library
* TensorFlow Hub Library
* Keras API
We will also implement three new TensorFlow example applications for phase 2:
* Object Recognition
* Speech Recognition
* Reinforcement Learning
All the above phase 2 features are required to move us closer to becoming competitive with Python and Java. This is a long-term multi-phase grant series, aimed at radically changing the perception of Perl in the modern software development and AI industries.
### Benefits to the Perl Community
Since the beginning of Perl TensorFlow phase 1, the usage of artificial intelligence has become a new and exciting component of virtually all major new software projects. This is due to the sensational abilities of AI large language models (LLMs) such as OpenAI's ChatGPT and Facebook's LLaMa.
Due to the continued dedication and hard work of the Perl TensorFlow team (and others), the Perl community now has access to a full-fledged Perl-powered AI solution: the production-ready [ChatGPU Navi™ workstation](http://chatgpu.ai), built using both LLaMa and Perl TensorFlow.
In addition to the commercially-available ChatGPU Navi™ products, Perl developers may now create their own TensorFlow applications by studying and utilizing the two open source Jupyter IPerl code notebooks published as part of the phase 1 deliverables:
* [Inference Using TF Hub Mobile Net](https://mybinder.org/v2/gh/EntropyOrg/perl-AI-TensorFlow-Libtensorflow/master?filepath=notebook/InferenceUsingTFHubMobileNetV2Model.ipynb)
* [Inference Using TF Enfromer Gene Expression Production Model](https://mybinder.org/v2/gh/EntropyOrg/perl-AI-TensorFlow-Libtensorflow/master?filepath=notebook/InferenceUsingTFHubEnformerGeneExprPredModel.ipynb)
Phase 2 will expand the Perl TensorFlow system software to include several new features, such as gradient support and a Keras API. Phase 2 will also include three new TensorFlow applications: object recognition, speech recognition, and reinforcement learning. New TensorFlow system features and applications mean more Perl developers can create more Perl AI software, for both their paid jobs and for their open source hobbies.
It is only by continued expansion of Perl's AI capabilities that the Perl community can hope to stay competitive against other industry-leading programming languages. Before phase 1, the Perl community was finishing pretty much dead last in the global AI arms race. Now, Perl is in the official TensorFlow list of supported languages, and is starting to catch up to our competitors:
[API Documentation](https://www.tensorflow.org/api_docs)
The native TensorFlow API is written in C++ with a stable C wrapper, which is very good because Perl is written in C and can communicate well with C libraries. Currently, the top four languages for TensorFlow API stability are Python, JavaScript, C++, and Java respectively. There are nine more languages with partial TensorFlow API support, of which Perl is the most recent.
As part of the Perl Community Roadmap's overarching goal to "Put Perl Back On Top", we plan to continue expanding Perl TensorFlow support until Perl moves from the long list of partially-supported languages to the short list of fully-supported languages. Once achieved, Perl's placement on the TensorFlow recommended-language list will lead even more non-Perl developers to learn Perl, simply due to the popularity of AI and the drive to learn TensorFlow itself. This attraction of AI developers to Perl is both a long-term goal, and a major benefit, of the Perl TensorFlow grant series.
Meanwhile, phase 2 shares all the same benefits to the Perl community as phase 1:
To begin with, software developers will be able to much more easily convince corporate management to adopt Perl for new software projects requiring ML/AI.
Secondly, students and teachers alike will be empowered to teach Perl in ML/AI courses at countless high schools, colleges, and universities.
Third, open source Perl developers will have essential new tools for working on brilliant breakthroughs in ML/AI software, to the benefit of all humanity.
Fourth, the overall creation of new Perl ML/AI projects and educational courses will naturally result in the critically-needed creation of new Perl jobs.
Last but not least, new corporate projects using Perl ML/AI will also translate into new corporate funding and sponsorship for Perl non-profits such as TPF.
### Deliverables
* An implementation of Perl API bindings to all applicable symbols in the TensorFlow C API pertaining to automatic differentiation or gradient features, using FFI::Platypus from CPAN.
* An implementation of a high-level Perl TensorFlow library on top of the Perl API bindings from phase 1.
* An implementation of a Perl library for TensorFlow Hub.
* An implementation of a Perl API for Keras.
* An implementation of the object recognition TensorFlow application, using IPerl in Jupyter notebook with runnable examples on mybinder.org as in phase 1.
* An implementation of the speech recognition TensorFlow application, using IPerl in Jupyter notebook with runnable examples on mybinder.org as in phase 1.
* An implementation of the reinforcement learning TensorFlow application, using IPerl in Jupyter notebook with runnable examples on mybinder.org as in phase 1.
* A comprehensive Perl test suite with automatically-provable coverage for 100% of the testable phase 2 components, using Test2 from CPAN.
* A carefully-written and explanatory collection of documentation with coverage for 100% of the phase 2 components, using normal POD fully compatible with CPAN.
* An update to the public GitLab repository from phase 1, with all source code and components for phase 2, including unstable or experimental components.
* An update to the public CPAN distribution from phase 1, with all stable source code and components from phase 2.
* An update to the public Docker repository from phase 1, with all stable source code and components from phase 2, along with all dependencies, ready to run out-of-the-box.
* The TensorFlow C API currently supports functions and has partial support for control flow operations, the remaining functionality of which will be addressed in future grant proposals.
* This grant proposal specifically does NOT include any re-implementation of Python's NumPy NDarrays or Pandas software, as there are equivalents in Perl which will be addressed in future proposals.
### Project Details
As in phase 1, all the technical details of how a TensorFlow API should behave and how to implement it in Perl can be found at the following websites:
[API-Docs](https://www.tensorflow.org/api_docs)
[Tensor Flow](https://github.com/tensorflow/tensorflow)
[Tensor flow bindings](https://github.com/tensorflow/docs/blob/master/site/en/r1/guide/extend/bindings.md)
[C API](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/c/c_api.h)
[FFI::Platypus](https://metacpan.org/pod/FFI::Platypus)
[Test2](https://metacpan.org/pod/Test2)
New details specific to phase 2 can be found below.
#### C & C++ APIs
The native TensorFlow API was originally written in Python, but thankfully it is now written in C++. Much of the TensorFlow internals are implemented in C++, which is then wrapped in C as the stable reference API. The API documentation for TensorFlow v1.x is no longer valid, as even more of the code has been moved out of Python and into C++, but not yet documented. There are still parts in Python that are not yet in the C++; all those Python parts have currently-open issues to be addressed, both Google and volunteer developers are actively working to move away from Python but there is still a lot of work left.
The TensorFlow team wants people to use the C API instead of the C++ API, because the C API is more stable and the C++ API is subject to ongoing changes. We are currently using an already-compiled TensorFlow binary C C, which is a C wrapper around the C++ code. Since we are using the C API and not the C++ API for now, then we do not need to worry about matching C++ compiler versions.
The only people who need to directly access the C++ API are those who need shared (custom) operations, for things like custom hardware or some specific algorithm that needs an operation which does not yet exist. We are not currently trying to implement or utilize custom operations so we do not need to directly access the C++ API. We will continue accessing the C API only. In the future, if we or some user does need to create C++ operations, then they can create a new C++ operator and then utilize the build-time Perl code generation that we are already going to create for usage on TensorFlow core operations, except it would create Perl code generation at run time for the custom C++ operations instead of at build-time-only in the Makefile for TensorFlow core operations. This process will create Perl module ".pm" files with Perl code used to access the C++ operators. This is the same mechanism already used by the Perl compiler.
#### Automatic Differentiation & Gradients
[Automatic differentiation](https://www.tensorflow.org/guide/autodiff) is used to implement some machine learning and artificial intelligence algorithms, such as backpropagation for training neural networks.
During the training process, a neural network starts with an initial set of randomized numeric weights, one weight for each trainable parameter AKA trainable variable, and then the neural network calculates its first output. The training procedure then compares the neural network's generated output with the expected output present in the user-supplied training data, and calculates the loss AKA output inaccuracy. A loss function compares the predicted output of a neural model with its true output, which can be viewed as calculation of a numeric penalty for inaccurate output. Loss functions help optimize the performance of a neural network, and are usually differentiable across their mathematical domain.
To reduce the loss and optimize the performance (accuracy and speed) of a neural network on a particular training data set, we utilize an iterative process of backpropagation and gradient descent. First, we compute the gradients of loss with respect to the various trainable variables; next, these gradients are used to recalculate the trainable variables; and finally, the output is calculated again. The gradients are the partial derivatives of the loss with respect to each of the trainable variables. Each iteration of the training process loop should decrease the loss and thus increase the neural network's output accuracy.
TensorFlow v2.x added partial support for gradients based on the C++ code. As the C++ version of TensorFlow is expanded, then the C++ support for gradients will eventually be completed.
You can compute a mathematical gradient for a source code function, by knowing how the function is internally defined and using symbolic calculus such as the chain rule, etc. If you have a function that is not yet defined in C++, then you can write a Perl function to access the C++ code and combine the Perl plus C++ together into one compound expression of TensorFlow operations. In order to find the gradient of that combined Perl and C++ expression, we will need to implement the symbolic calculus features in Perl possibly using a combination of PPI, the Perl optree, and the Perl compiler.
The C++ TensorFlow will compile the compound Perl & C++ expression, which will then go into the neural network model AKA graph. In order to have a gradient functionality on par with Python, then there will be features implemented in Perl that are not yet implemented in C++. If the C++ code is ever updated, then we can use the faster C++ version. We will attempt to copy the Python naming scheme, so people can study existing TensorFlow tutorials and easily implement the examples in Perl.
#### High-Level Library
We will create a higher-level TensorFlow library, which will serve as a wrapper around our phase 1 *libtensorflow* bindings. Phase 2 will have a higher-level Perl wrapper, and will make it easier for Perl users to quickly and easily utilize TensorFlow functionality. This will correspond to the [tensorflow](https://pypi.org/project/tensorflow/) Python library.
#### TensorFlow Hub Library
We will create a Perl version of the TensorFlow Hub library [tensorflow-hub](https://pypi.org/project/tensorflow-hub/), which will help us load neural network models automatically, instead of manually or explicitly downloading them. We will be copying the functionality of the Python version.
#### Keras API
We will create an initial Keras API for Perl.
TensorFlow is a general framework, and it can be used for purposes other than deep learning only.
Keras is a solution that puts together big pieces of a deep learning architecture, and provides a simple API for building a deep learning architecture.
This will be equivalent to the [keras](https://pypi.org/project/keras) Python package and provide a similarly designed API.
### Project Schedule
Total development time is estimated at 4 to 5 months, with the normal disclaimer about the difficulty of predicting software project durations.
During the first work cycle of approximately 2 months, implement the updated TensorFlow API system and application software.
During the second work cycle of approximately 1 month, implement the Perl test suite.
During the third work cycle of approximately 1 month, write the Perl documentation.
If a fourth work cycle is required, continue until the public releases on CPAN and Docker are complete.
### Completeness Criteria
This grant is deemed complete when all the above-listed deliverables are reviewed and accepted by the official TPF-assigned grant manager.
### Bio
We are both professional CPAN authors ( Will Braswell and Zaki Mughal ), with a current total of 88 CPAN distributions between the two of us.
Comments (26)
The Perl TensorFlow grant proposal presents an extraordinary opportunity to revolutionize the capabilities of Perl in the realm of artificial intelligence and machine learning. With a budget of $8,800 USD, this grant aims to enhance the existing Perl API to Google TensorFlow, enabling the Perl community to compete effectively with Python and Java, the current leaders in the AI domain.
Phase 1 of this grant series has already proven its worth, empowering Perl developers with a full-fledged AI solution and access to open source Jupyter notebooks for AI applications. Building upon this success, Phase 2 promises to expand Perl TensorFlow even further with four new system features, including gradient support and a Keras API, along with three cutting-edge AI applications like object recognition and reinforcement learning.
The benefits to the Perl community are immense. From simplifying convincing corporate management to adopt Perl for AI-driven projects to empowering educators and students with AI-focused courses, this grant paves the way for a brighter future. Moreover, it attracts AI developers to Perl, placing Perl on the TensorFlow recommended-language list and creating new job opportunities within the Perl ecosystem.
The proposed deliverables, including comprehensive Perl test suites, well-documented libraries, and publicly accessible Docker repositories, ensure a smooth and reliable implementation. With a project timeline of 4 to 5 months, the Perl TensorFlow grant aims to accomplish its mission effectively and efficiently.
As Perl strives to reclaim its position at the forefront of the technology landscape, this grant will elevate Perl's AI capabilities to rival the best in the industry. I believe that approving this grant will catalyze a significant transformation for Perl, enabling it to thrive in the rapidly evolving world of AI and cement its position as a top-choice programming language for modern software development.
Let's support this vision and propel Perl into a bright and successful future with the transformative Perl TensorFlow grant.
I support the funding of this proposal to further improve and complete the Google TensorFlow API Bindings for Perl. Having this would be very helpful for Perl such that it can be used effectively for many important business use cases and projects, given how AI applications are dominating attention and business investment these days.
I'm in support of this, it would be another great move forward for perl, providing more opportunities for startups and enterprise development increasing opportunities for perl AI developers and TensorFlow usage.
Dear Perl Foundation and the TensorFlow Grant Proposal Team,
I am thrilled to express my utmost support and enthusiasm for your groundbreaking collaboration between the Perl Foundation and TensorFlow. This remarkable initiative serves as a testament to the power of open-source innovation and the limitless possibilities that arise when talented communities come together.
By integrating TensorFlow, a cutting-edge machine learning framework, with Perl, a versatile and robust programming language, you are paving the way for a new era of data analysis and artificial intelligence. This collaboration holds immense potential to unlock novel solutions and drive advancements across a wide range of domains.
The Perl Foundation's commitment to fostering the growth and development of Perl, combined with TensorFlow's exceptional capabilities in machine learning, creates a powerful synergy that will undoubtedly propel the field forward. The grant proposal's emphasis on education, research, and community engagement further underscores the project's comprehensive approach and commitment to inclusivity.
The potential impact of this collaboration extends far beyond the boundaries of the Perl and machine learning communities. By enabling Perl developers to leverage TensorFlow's sophisticated tools and models, you are empowering a vast network of programmers to embark on exciting machine learning projects, democratizing access to this transformative technology.
Furthermore, the proposed mentorship programs and educational initiatives inspire confidence in the project's long-term sustainability and the cultivation of a vibrant ecosystem. Nurturing talent and knowledge sharing are crucial components in driving innovation, and your dedication to these aspects is commendable.
I wholeheartedly endorse this TensorFlow grant proposal for the Perl Foundation, recognizing its potential to break new ground, foster collaboration, and empower developers worldwide. The impact of this initiative will undoubtedly reverberate throughout the industry and contribute to the advancement of machine learning and Perl programming.
Wishing you every success in realizing this visionary project.
Sincerely,
Yussuf arifin
So excited to hear about this development that I can hardly wait!
Perl has, for decades, been on the cutting edge of user-driven development. Even back before the CPAN module days we had integrations with everything from major commercial databases to Apache and beyond. Adding this support for ML makes a lot of sense and I think will produce benefits not only for Perl hackers but the world as a whole.
Thank you Will and Zaki for your work on this.
This is a great idea for Perl, considering the fact that there is a lot of work that needs to be done on ML API integrations in Perl. Perl AI developers and TensorFlow users will appreciate access to first-class integrations without being forced to move to other programming ecosystems. I believe that lowering the barrier to entry to ML for all Perl developers is a great idea. All the best of luck to Will and Zaki!
Perl is often not considered as a primary choice for new projects because of its lack of integration with modern technologies or frameworks. Bringing modern frameworks to Perl is a great idea! It could make Perl more competitive in the machine learning landscape. It makes Perl more accessible, versatile, and marketable, which could attract more developers and businesses to the language.
TensorFlow API bindings for Perl also opens up a world of possibilities for Perl developers who want to use machine learning in their applications, allowing them to learn modern technologies without switching to other languages.
Hope the funding is granted! Good luck Will abd Zaki!
one area where Perl has been lacking is in the realm of artificial intelligence (AI) and machine learning (ML). The absence of native support for AI frameworks like Google's TensorFlow has limited Perl's potential for exploring the cutting-edge possibilities of AI-driven applications. Nonetheless, the proposal to develop Google TensorFlow API bindings for Perl opens up new dimensions for the language, promising to usher in a new era of AI innovation within the Perl community.
Moreover, the inclusion of TensorFlow bindings in Perl will foster a thriving ecosystem of AI enthusiasts and researchers within the Perl community. With a broader toolkit at their disposal, developers will be encouraged to explore new possibilities and collaborate on innovative projects. This community-driven approach will not only facilitate knowledge-sharing but also accelerate the pace of AI research within the Perl ecosystem.
Hoping to grant the funding.
I support the continued implementation of TensorFlow and putting Perl "back on top". I support this grant proposal.
I was eagerly waiting to do development of AI using Perl. It'll definitely improve the visibility of Perl across software developer community as well as at enterprises level also. This move will encourage beginner to learn Perl and promote Perl for AI projects. I support this grant proposal and hoping to complete this soon. Thank you all for your hardwork to continue implementation of AI API using Perl.
Let's keep the Perl in flow. Today, and a few years ahead, AI is and will be the leading in the tech area. A lot of jobs will be at the same time lost and gained thanks to new AI related jobs. Perl will certainly benefit from having this API.
Will and Zaki, thanks for getting your time on this project.
I'm really excited about AI and I think TensorFlow is an exciting platform. I would love to program TensorFlow in Perl. Let's give it all the support we can.
I support this grant proposal.
I can't express just how important this project is. AI tooling is something Perl should totally own because it's exactly what Perl is great at; gluing all sorts of things together to build value. We have an opportunity to show the programming world Perl isn't just for legacy code, AI is just getting crazy hot and we have a good chance to ride the wave along with all the other things people are doing to modernize the language. I'm behind this project 100%
I would also like to voice my support of this project. Perl has long been used in a wide variety of endeavors and should firmly plant itself in the Machine Learning ecosystem.
It's a great engineering effort. Fans of the Perl will be happy to see this trend develop. I support this grant proposal and look forward this project reach to the set goals
This project can not only bring Perl's talent into ML field. Also make Perl great again, because students can have more opportunities using Perl for learning ML.
I am very excited about AI implementation in Perl, looking from future perspective this will surely benefit Perl community. I support this grant proposal.
I think the amount is pretty conservative for this essential work. Consider this a ++ endorsement and recommendation that we take this opportunity. This team has already proven they produce extremely high quality work!
Absolutely, Perl should adapt to accommodate new projects, as its current deficiency in integrating with modern technologies or frameworks hinders its widespread adoption. Embracing modern frameworks in Perl is undoubtedly a fantastic proposition!
This would be really cool feature for perl. This would be helpful for the application which are build using perl. Using this feature application became more flexible, user friendly. This feature also helpful for developer. AI/ML is now essential part for any application which will give new direction to perl and their developer. I support this proposal.
This grant application for Google TensorFlow API Bindings for Perl, is an impressive achievement and deserves high praise. The continued development of the Perl API for Google TensorFlow and the implementation of new features like gradient support, high-level library, TensorFlow Hub library, and Keras API are a significant step forward for the Perl community. The addition of three new TensorFlow applications such as object recognition, speech recognition, and reinforcement learning will enable Perl developers to create even more high-quality AI software, elevating Perl's competitiveness among other leading programming languages. This work contributes to radically changing the perception of Perl in the modern software development and AI industries. Congratulations to Will, Zakariyya, and the entire Perl TensorFlow team for their remarkable achievement!
I do agree that it is a good idea to have a complete implementation of the Tensorflow API.
This will undoubtedly be a valuable addition to Perl and I wholeheartedly support the grant proposal. Best of luck, Will and Zak.
I support this grant proposal. This will make Perl a more viable option for data engineering and ML work.
I want to see this project finished and have an api for tensor flow, so I can have the option to work and play with perl in IA and ML.
Perl TensorFLow is a great opportunity for the evolution of Perl in the field of machine learning and the whole AI movement. I fully support the development so that Perl is also a leader in this field as well as other programming languages.
I join my colleagues and want to say the following: as one of the tools, Perl TensorFLow is definitely needed. It is needed to gain experience, it is needed to integrate these solutions with something that already exists, and it is needed for possible solutions in the future.
I hope that on the basis of this tool, we, as developers and users, will already begin to receive useful utilities that exceed what was previously available in terms of capabilities.