Mojo ๐ฅ โ a new programming language for AI developers (first look)
Key Takeaways
Mojo, a new programming language announced by Chris Lattner, combines the usability of Python with the performance of C/C++ for AI applications, claiming to be up to 35,000 times faster than Python. The language is designed as a superset of Python, with additional features such as progressive types, zero-cost abstractions, and language-integrated auto-tuning.
Full Transcript
hi everyone I'm Patrick and welcome back on my channel so yesterday Chris lattner the co-founder of llvm and the Swift programming language announced a new programming language called mocho which Builds on top of python and is designed specifically for AI applications and in their keynote they claim that it's up to 35 000 times faster than python so let's take a quick first look at it so Mojo combines the usability of python with the performance of C or C plus unlocking unparalleled programmability of AI hardware and extensibility of AI models so this is one of the main motivations we all know one of the main drawbacks of python is its speed and poor low level performance so what ends up happening is often we use python as a glue and have the actual implementations in C plus plus or c for example this is what happens with numpy or tensorflow or pytorch or for AI applications we even go a level deeper and write code in Cuda which is optimized for your tensor operations on this on the GPU so Mojo tries to unify all of this so here it claims write everything in one language no C plus plus or Cuda required and at the same time it should be as simple and familiar as python so let's have a look at some of its features so first of all Mojo is designed as a superset of pythons so you can also write python code and in fact the hello world looks the very same as in Python so a lot of the language features and the functions and the syntax are the same but then it has additional features on top to extend this so I will go over this in a few moments but what I also want to mention is that right now they mentioned this in their docs how compatible is Mojo with python really and at the moment it is still very early and missing many features but they want to work towards a full compatibility in the future so we have to wait how this will go so let's look at some of the features so here we have the softmax function in Python and we can rewrite this in numpy which looks similar for example we also have this Define a function and then we return something but here we have this struct which I will show you in a moment again so let's go over some of the features here first of all they say it has Progressive types so we can leverage types for better performance and error checking then it has zero cost abstractions so we can take control of storage by inline allocating values into structures so this is what I just showed you here we can define a struct which looks similar to a class but it has some differences so first of all for example you can also write your init function but then you might notice these typins here and with this we can take more control of the storage then we can have ownership and borrow Checkers so we can take advantage of memory safety without the rough edges and in fact they claim to be as safe as rust then you can have portable parametric algorithms so you can leverage compile time meta programming to write Hardware agnostic algorithms and reduce boilerplate and then you get language integrated Auto tuning so you can automatically find the best values for for your parameters and take advantage of the target hardware and then some more features they list here and I also want to point out the documentations that you can check out so for example they have the section about basic systems programming extensions so for example one of the extensions are the let and wear declarations that you can use on top of your normal python code of course so here you can use this for immutable and mutable types then you get these struct type that I already showed you which looks similar to a class but has some differences then you get strong type checking then you can overload functions so this is similar to C plus plus or Java in Swift so here you can write a function that has the same syntax as two init functions for example but it has different arguments and then here also you have this function definition so this is similar to a def keyword in Python and you can also write def function but then again here with this you get some more functionality and for this I recommend to check out the documentation then you get a copy in it and a move in its special method and then you also get this section about parameterization and yeah so again if you want to go into more depth then check out the documentation I will put the link in the description so how can you try Mojo and at the moment it is not yet publicly available so you have to sign up here and wait until you get access and once you have access you can try try it out via the so-called Mojo playground which is just a two-parter notebook with also the Mojo compiler in the background so so then here you can write for example also python code and then also cells with Mojo code and then try this out but again it is not yet publicly available so you cannot simply install this on your own machine so you have to use it via their playground and also it is not yet open source so they have a repository and here they write we plan to open source Mojo progressively over time but it's changing very quickly now and we believe that a small tight-knit group of Engineers with a shared Vision can move faster than a community effort so we also have to wait until this will go open source so yeah this is just a very short overview of Mojo at first glance it looks and sounds very exciting but as you can see here it is still very early so we have to wait and see so yeah let me know in the comments what you think about Mojo if you also think it could change the way how we write AI applications in the future and if you want to try it out yourself and also if you want to see more tutorials in the future on my channel let me know and then I hope to see you in the next video bye
Original Description
Yesterday Chris Lattner announced a new programming language called Mojo, which builds on top of Python and is designed specifically for AI applications. They claim itโs up to 35000 times faster than Python. So letโs take a quick first look at it.
Website: https://www.modular.com/mojo
Docs: https://docs.modular.com/mojo/
Keynote: https://youtu.be/-3Kf2ZZU-dg
Get my Free NumPy Handbook:
https://www.python-engineer.com/numpybook
โ
Write cleaner code with Sourcery, instant refactoring suggestions in VS Code & PyCharm: https://sourcery.ai/?utm_source=youtube&utm_campaign=pythonengineer *
โญ Join Our Discord : https://discord.gg/FHMg9tKFSN
๐ ML Notebooks available on Patreon:
https://www.patreon.com/patrickloeber
If you enjoyed this video, please subscribe to the channel:
โถ๏ธ : https://www.youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA?sub_confirmation=1
~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
๐ฅ๏ธ Website: https://www.python-engineer.com
๐ฆ Twitter - https://twitter.com/patloeber
โ๏ธ Newsletter - https://www.python-engineer.com/newsletter
๐ธ Instagram - https://www.instagram.com/patloeber
๐ฆพ Discord: https://discord.gg/FHMg9tKFSN
โถ๏ธ Subscribe: https://www.youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA?sub_confirmation=1
~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
๐
ฟ Patreon - https://www.patreon.com/patrickloeber
#Python
Timeline:
00:00 - Intro & motivation
01:23 - Features
04:48 - How to try Mojo
----------------------------------------------------------------------------------------------------------
* This is an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! ๐
Watch on YouTube โ
(saves to browser)
Sign in to unlock AI tutor explanation ยท โก30
Playlist
Uploads from Patrick Loeber ยท Patrick Loeber ยท 0 of 60
โ Previous
Next โ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Lists in Python - Advanced Python 01 - Programming Tutorial
Patrick Loeber
Tuples in Python - Advanced Python 02 - Programming Tutorial
Patrick Loeber
Dictionaries in Python - Advanced Python 03 - Programming Tutorial
Patrick Loeber
Sets in Python - Advanced Python 04 - Programming Tutorial
Patrick Loeber
Strings in Python - Advanced Python 05 - Programming Tutorial
Patrick Loeber
Collections in Python - Advanced Python 06 - Programming Tutorial
Patrick Loeber
Itertools in Python - Advanced Python 07 - Programming Tutorial
Patrick Loeber
Lambda in Python - Advanced Python 08 - Programming Tutorial - Map Filter Reduce
Patrick Loeber
Exceptions in Python - Advanced Python 09 - Programming Tutorial
Patrick Loeber
Logging in Python - Advanced Python 10 - Programming Tutorial
Patrick Loeber
JSON in Python - Advanced Python 11 - Programming Tutorial
Patrick Loeber
Random Numbers in Python - Advanced Python 12 - Programming Tutorial
Patrick Loeber
Decorators in Python - Advanced Python 13 - Programming Tutorial
Patrick Loeber
Generators in Python - Advanced Python 14 - Programming Tutorial
Patrick Loeber
Threading vs Multiprocessing in Python - Advanced Python 15 - Programming Tutorial
Patrick Loeber
Threading in Python - Advanced Python 16 - Programming Tutorial
Patrick Loeber
Multiprocessing in Python - Advanced Python 17 - Programming Tutorial
Patrick Loeber
Function arguments in detail - Advanced Python 18 - Programming Tutorial
Patrick Loeber
The asterisk (*) operator in Python - Advanced Python 19 - Programming Tutorial
Patrick Loeber
Shallow vs Deep Copying in Python - Advanced Python 20 - Programming Tutorial
Patrick Loeber
Context Managers in Python - Advanced Python 21 - Programming Tutorial
Patrick Loeber
KNN (K Nearest Neighbors) in Python - Machine Learning From Scratch 01 - Python Tutorial
Patrick Loeber
Linear Regression in Python - Machine Learning From Scratch 02 - Python Tutorial
Patrick Loeber
Logistic Regression in Python - Machine Learning From Scratch 03 - Python Tutorial
Patrick Loeber
Linear and Logistic Regression in 60 lines of Python - Machine Learning From Scratch 04
Patrick Loeber
Naive Bayes in Python - Machine Learning From Scratch 05 - Python Tutorial
Patrick Loeber
Perceptron in Python - Machine Learning From Scratch 06 - Python Tutorial
Patrick Loeber
SVM (Support Vector Machine) in Python - Machine Learning From Scratch 07 - Python Tutorial
Patrick Loeber
Decision Tree in Python Part 1/2 - Machine Learning From Scratch 08 - Python Tutorial
Patrick Loeber
Decision Tree in Python Part 2/2 - Machine Learning From Scratch 09 - Python Tutorial
Patrick Loeber
Random Forest in Python - Machine Learning From Scratch 10 - Python Tutorial
Patrick Loeber
PCA (Principal Component Analysis) in Python - Machine Learning From Scratch 11 - Python Tutorial
Patrick Loeber
K-Means Clustering in Python - Machine Learning From Scratch 12 - Python Tutorial
Patrick Loeber
Anaconda Tutorial - Installation and Basic Commands
Patrick Loeber
PyTorch Tutorial 01 - Installation
Patrick Loeber
PyTorch Tutorial 02 - Tensor Basics
Patrick Loeber
PyTorch Tutorial 03 - Gradient Calculation With Autograd
Patrick Loeber
PyTorch Tutorial 04 - Backpropagation - Theory With Example
Patrick Loeber
PyTorch Tutorial 05 - Gradient Descent with Autograd and Backpropagation
Patrick Loeber
PyTorch Tutorial 06 - Training Pipeline: Model, Loss, and Optimizer
Patrick Loeber
PyTorch Tutorial 07 - Linear Regression
Patrick Loeber
PyTorch Tutorial 08 - Logistic Regression
Patrick Loeber
PyTorch Tutorial 09 - Dataset and DataLoader - Batch Training
Patrick Loeber
PyTorch Tutorial 10 - Dataset Transforms
Patrick Loeber
Download Images With Python Automatically - Python Web Scraping Tutorial
Patrick Loeber
PyTorch Tutorial 11 - Softmax and Cross Entropy
Patrick Loeber
Select Movies with Python - Web Scraping Tutorial
Patrick Loeber
PyTorch Tutorial 12 - Activation Functions
Patrick Loeber
List Comprehension in Python - A Python Feature You MUST KNOW - Python Tutorial
Patrick Loeber
PyTorch Tutorial 13 - Feed-Forward Neural Network
Patrick Loeber
How To Add A Progress Bar In Python With Just One Line - Python Tutorial
Patrick Loeber
PyTorch Tutorial 14 - Convolutional Neural Network (CNN)
Patrick Loeber
The Walrus Operator - New in Python 3.8 - Python Tutorial
Patrick Loeber
PyTorch Tutorial 15 - Transfer Learning
Patrick Loeber
YouTube Data API Tutorial with Python - Analyze Channel Statistics - Part 1
Patrick Loeber
YouTube Data API Tutorial with Python - Find Channel Videos - Part 2
Patrick Loeber
YouTube Data API Tutorial with Python - Get Video Statistics - Part 3
Patrick Loeber
YouTube Data API Tutorial with Python - Analyze the Data - Part 4
Patrick Loeber
AdaBoost in Python - Machine Learning From Scratch 13 - Python Tutorial
Patrick Loeber
Ultimate FREE Study Guide for Machine Learning and Deep Learning
Patrick Loeber
More on: LLM Foundations
View skill โRelated Reads
๐ฐ
๐ฐ
๐ฐ
๐ฐ
Building a Vibe-Based Music Recommender with MongoDB and Voyage AI
Dev.to ยท Jordan Smith
AI Wrote Your Code. Did It Ship a Vulnerability Too?
Dev.to ยท Stanley A.
Beyond Vibe Coding: Embracing Agentic Engineering for Sustainable AI Development
Medium ยท AI
I Had 16 AI Reviewers Guarding My Code. Not One of Them Existed.
Dev.to ยท Akash Khanna
Chapters (3)
Intro & motivation
1:23
Features
4:48
How to try Mojo
๐
Tutor Explanation
DeepCamp AI