Modular

M

Modular

This server is the home of the MAX and Mojo community. Join us to chat about all things Modular!

Join

questions

community-showcase

Mojo equivalent of Python class parameters

In Python, you can create a class, say "model" and ask for its parameters using model.parameters. Is there an equivalent for a struct in Mojo? I would like to pass it to something like: torch.optim.Adam(model.parameters(), ...) ....

Are there benchmarks available for llama 3.1 8b running on max?

@ModularBot I am trying to benchmark performance of max on cpu. Are there any available benchmarks? Or is there code which I can use to run the benchmarks myself. I want to run inference on llama 3.1 8b model.

`tensor.tensor.Tensor`, `max.tensor.Tensor` or `max.driver.Tensor`?

Are we meant to use tensor.tensor.Tensor, max.tensor.Tensor or max.driver.Tensor? The first one might be a re-export of the second, but max.driver.Tensor is the only one which seems to handle multi-device, however most of the max APIs don't seem to work on it despite it seeming to be a better match for ManagedTensorSlice. However, I don't see a way to move data off of the GPU with the max.tensor.Tensor/tensor.tensor.Tensor variants, and I get segfaults in what looks like a memcpy f...

Single Executable Binary just like Go Lang?

I love how Go makes single executable binary for an app I make in it by default. Makes deployment on the servers very easy. Does Mojo has any plans to add a similar feature?

I don't quite understand the overall concept of MLIR

Are all the standard Mojo types, as in those found in Python, going to be MLIR? As I understand it, they're optimized behind the scenes but universal on the screens. Or is this for more complex or specialized types?

One liner to open "magic shell" + "magic build"

I am having issues with the magic. I want to programmatically and directly pipe build command into it. But I just loose my TTY. I tried a bunch of things but does not get it to work. Doing these commands manually might be alright when there is not much to be built but I would really like to know if you guys have a solution for this.

Compile time float pow is crashing, is there a proper way to do this?

Crashing on a lower level open-source/mojo/stdlib/stdlib/sys/intrinsics.mojo:90:14: note: LLVM intrinsic operand has unknown value: #pop<simd "1.8618819175149959"> : !pop.scalar<f64> ```rs alias num = 1.23 ** 4.56...

Will MAX GPU or NPU support come to Qualcomm xelite chips?

just curious or if i shouldn't get my hopes up. I am curious what direction Modular wishes to take.

Is it possible to get the origin of `strs` in `fn name(*strs: String)`?

Minimal repro, LSP shows invalid call to 'append': method argument #0 cannot be converted from 'List[StringSlice[strs]]' to 'List[StringSlice[strs]]' Seems like a bug, but maybe there's a proper way to do this? ```rs...

How should I be loading the `get_scalar_from_managed_tensor_slice` kernel?

I am apparently missing it, despite using this as my session load: ```mojo var model = session.load( graph,...

Has anyone ever seen this error

While I was writing out some code on mojo, this error message appeared on the first line of my code. A crash happened in the Mojo Language Server when processing this document. The Language Server will try to reprocess this document once it is edited again. Please report this issue in https://github.com/modularml/mojo/issues along with all the relevant source codes with their current contents. Afterwards, regardless of the changes I make (ie making a new file or altering current file) I keep getting the following error and stack dump:
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it): After spitting out a couple hundred messages identical to 255 mojo 0x000057bc2c289433 The output finally crashes ```mojo crashed! Please file a bug report....

Question about the FFI, unsafe_cstr_ptr, and PathLike

When calling into a dylib from mojo using the FFI, the char* I pass is seemingly freed before the c function receives it - the following code's output won't show the path. However, if I artificially "retain" the path_string until after the external call, it succeeds. It also succeeds if I use a string literal instead of a Path. Is this a bug or is this a misunderstanding on my part of the ASAP deconstruction? ``` example.mojo #...

Tried the new Max custom_ops examples with my RTX 3050 and using CPU

When I run the custom_ops examples in nightly branch I realized that they were slower than in the demo, and then I checked that accelerator_count() was returning 0 even if I have an Nvidia GPU:
No description

Is there a way in Mojo to know the type of a variable/object ?

Something like type() in Python. If not, is this useful and/or on the roadmap?

Unable to use PyTorch from Mojo

I just wanted to try Pytorch and created a project using nightly build. I then installed PyTorch using: magic add "pytorch". This is the code I tried: `from python import Python...

cannot return reference iwth incompatible origin

What's the easiest way to deal with this error?
No description

Mojo in CMD.

How may I run Mojo directly in Command Prompt instead of running it through a virtual machine?

What are the best practices for handling slices and their performance in Mojo?

I'm trying to better understand how slices work in Mojo, particularly regarding performance. From what I've seen, slices in languages like Python can introduce overhead in high-performance scenarios. In Mojo, are there any specific optimizations for slices, or situations where their use should be avoided? Is there any comparison between slices and other approaches (like pointers or arrays) in terms of efficiency?

Is there a ticket to follow for regex in mojo?

Is there a ticket to follow for regex in mojo?

Publish mojo package

Hi, I am new to mojo. I am wondering is it possible to build a package and then publish it to something similar to PyPi so other users could just install it package as a dependency to their project? I only found information on how to build a package but couldn't really find anything on publishing it.
Next