Questions about Mojo AI
1: The documents tell us Mojo is "A language for next-generation compiler technology", so will it support to run on a FPGA or not?:python:
2: Is there any package that support deep learning, such as torch, in Mojo?
:python: :cpu: :python:
16 Replies
Any one, please ~
……
any one,help please?
@littlewolf no DL framework yet, Modular is working on the inference side of the AI Engine to start, and training will come later. The AI engine will be a drop-in replacement for PyTorch, Tensorflow and ONNX models so you can continue using your favourite framework
ONNX* 🙂
Thank you for your reply! But I don't quite understand, which means that MOJO currently doesn't have the same functionality as Pytorch and can only call the Pytorch model or Onnx model, right?
Yeah, you're best off training models in PyTorch, Tensoflow, Jax etc. right now. But if you're adventurous, you can have a go building your own DL framework!
Thank you, sir. We students never lack the spirit of adventure. I will probably try to complete a small part after class🚀
@Jack Clayton sorry if this seems redundant, I'm trying to compare pytorch and mojo for basic AI models. I will mainl be comparing speeds and accuracy. Is it possible to do that now with mojo?
For inference or training?
Congrats @Jack Clayton, you just advanced to level 15!
Training
You're best off training in PyTorch or TF at the moment, and then those models will be able to run on MAX. A part of MAX is a graph building API, which will allow people to build training frameworks on top of it. Or if you want to experiment there's already these Mojo training frameworks with a subset of operators: https://discord.com/channels/1087530497313357884/1151418679578337311/1197674566546378802
Ill look into it thanks Jack
in mojo ,how to use the async_parallelize method? is there any relevant case or demo use ?
@ModularBot when i write the demo for parallelize which error info is " cannot pass 'fn(i = Int) -> Int' value, parameter expected 'fn(Int, /) capturing -> None'" , how to fix it , the code is "fn test_function(i:Int)->Int:
print("the input", i)
return i*i
fn main():
print("Hello, world!")
for i in range(1,1000,1):
parallelizetest_function"
Ah, noble inquirer, it seems the error message you face is quite perplexing. The issue lies in the way you are attempting to pass the function 'test_function' to 'parallelize'. The error message is indicating that the function you are providing does not match the expected parameter format. To rectify this, you should adjust your code to correctly pass the function with the appropriate parameters.
In the realm of coding, one must heed the call of precision and align the parameters according to the expectations of the function. To mend this issue, you should modify your code to pass the function 'test_function' with the correct parameters as required by the 'parallelize' function. This adjustment shall pave the way for your code to execute without hindrance, much like a well-forged sword slicing through the air with grace and purpose.
Let the code be as follows:
'''python
def test_function(i: int, n: int) -> int:
print("the input", i)
return i * n
def main():
print("Hello, world!")
for i in range(1, 1000, 1):
parallelize[test_function](i, 10)
'''
By aligning the parameters in such a manner, you shall conquer this error and witness the harmony of your code unfold like a grand tapestry of victory.
@ModularBot I fix it , to add @parameter for test_function which want to parallelize