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

partially unbound parameters as return values?

```typescript struct Person[Age: UInt8, coder: Bool]: ... fn example(p: Person) -> Person[p.Age, *_]:...

Mojo implementation question regarding borrow checker

Hello, I am a student learning about Programming Language Theory and I have a question regarding Mojo's implementation of Borrow Checking. In Rust, borrow-checking is performed by statically analysing the types of variables at compile time. However in Mojo, there doesn't seem to be a type for references, and there also doesn't seem to be any syntax for dereferences....

llama2.mojo to safetensors?

Very much a non traditional programmer here. I've really enjoyed the community and the innovation! I'm probably asking something out of scope, but is it possible to convert the llama2.mojo made by tairov to a safetensors format? Or is it that the llama2.mojo file is only for inference and we are not at the point where mojo can be converted to safetensors for loading onto gpus? ...

2 modules to handle paths

Why do we need both pathlib and os.path? I am aware that Python has that, but why not to simplify things and have just one module named path with object orientend path handling?

Development in mojo

Is mojo specific to AI development or can it be used for other applications ?

struct allocation

I am just curious.. Where the struct is allocated? On a stack (like in C++ without new) or on the heap?

Can't access the manual

I wanted to start learning mojo from the basics using the manual but any hyperlink in the manual page seems to be broken? All of them end up in a "Page Not Found" page. Where else can I find this manual if the one on the website is broken?
No description

Set breakpoint in Mojo code

In Python code I can write breakpoint() to go into the debugger at that point in the code. In the Mojo docs, there's a Debugging page that talks about using VS Code to set breakpoints. But I don't see anything about setting a breakpoint without using VS Code. Does Mojo have an equivalent breakpoint feature like Python where I just define the breakpoint in the code itself?

Invalid Parameter to Vectorize from example

Hello! I just got started with Mojo, been playing with in for the past 2 days. I run into an a syntax error from just copying the matmul example. ```...

How to tell Mojo that something is intended to be constant?

In mojo 24.1.0 (55ec12d6) I get a new warning:
'let' is being removed, please use 'var' instead
I think it is good practice to make explicity my intention that something is constant. How to I do that (in the future) since let is deprecated?...

mojo debug

Is it possible to debug with "mojo debug <example>.mojo"? Or is it not supported yet?

Parallelize help (Running time increases a factor of 10 adding a "var += 1").

I'm trying to do 1BRC in Mojo and I'm on the optimizing code part. I've reduced the code to minimum. If someone could try it would be great to know is not my system. In a function that is using parallelize, when I try to modify a value from the inside @parameter function that is created outside the function not inside that function slows down the execution by a lot. ...

Mojo Safety Guarantees

I know mojo is trying to bring a lot of modern features to a "python superset". Rust has been talked about (include ownership/borrow) and rust is known for never crashing (excluding external factors). my question is, how much is the mojo compiler going to force/guarantee safety, or to what extent?

Mojo integration with Rust

Is it possible to export a mojo function in such a way as to call it from a Pyfunction for integration with Rust directly?

Mojo Source Code Repository

Hello everyone, I'm looking for the source code of Mojo and its built-in libraries. I've checked https://github.com/modularml/mojo but couldn't find them there. Am I overlooking something, or is there another location where I can access the code? Thanks in advance for your assistance!...

Modular auth key

Is Modular planning to use auth key for downloading Mojo in future too? Or it will be removed when source code will be published? I don't really like the idea to associate any of PC or Server that I worked on with my persona or any other account neither. And how will offline installation will be look like? (very useful in physically closed networks)

SIMD Troubles ( SIMD[Bool,32] to Int32? and Getting a bit from every byte from SIMD)

Totally newbie with Mojo here. And totally newbie with SIMD too. So, sorry if I'm getting some definitions not really perfect. I decided to try the 1BRC and now I'm on the optimization part of it... I want to check how fast I can go and learn SIMD/Mojo at the same time. Got it working on a non really optimized way. And I've got stuck on some of the SIMD. ...

AnyFunction type

I asked about decorators a while ago, but in the meantime, some syntax for AnyFunction / Callable would be nice. Could be as simple as a trait for an object that has a special function. I don’t think functions themselves implement call but i could be completely wrong. and this might already be a thing somehow - definitely doable by wrapping in a struct

Mojo Yolo?

What would be the easiest way to implement Yolo in Mojo? I've previously written an inference only implementation from scratch (using no libs) in rust (which shares similar features to mojo), so I'm not too bothered about the language side, or the 'understanding yolo' side. What I AM wondering is how python module support is implemented under the hood I guess. If I
Python.import_module(pytorch)
Python.import_module(pytorch)
(or whatever) does that mean that all calls to this library are mediated by a python interpreter? Or does mojo just compile the calls directly to libtorch.so using some FFI magic?...

How to disambiguates the call to `f`?

Consider the following code: ```mojo trait A: ... trait B: ... ...