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

Return with move semantics

Is that possible to use the move semantic when returning a value from a function? The code below would give error: ``` from tensor import Tensor ...

How to efficiently sum a SIMD

Is there a way to sum a SIMD vector faster then a for loop?

convert error: 'Int' to 'IntLiteral' trying to implement the FloatLiteral.__round__(ndigits) method

I'm trying to contribute implementing the FloatLiteral.round() method with the current implementation: ``` @always_inline("nodebug") fn round(self, ndigits: IntLiteral = 0) -> Self: """Return the rounded value of the FloatLiteral. ...

Can it boost model training on CPU (currently using pytorch lightning)

For example, NeuralProphet uses Pytorch Lightning for model fitting. I'm doing grid search to find the best possible hyper-parameters, in parrallel using Dask on 16 CPU threads. I have a single 2080 GPU but it can't be utilized in parallel so there isn't much speedup. So I was wondering, would it be possible to speed up the grid search process if, somehow we could bring in Max / mojo to the workload? #model-fitting #NeuralProphet #pytorch-lightning #cpu...

RayTracing example - __add__ method (dunder methods)

In the RayTracing example, in the first class implementation Vec3f, in the dunder methods (add sub ...etc) the implementation is like this: fn add(self, other: Vec3f) -> Vec3f: return self.data + other.data this return data, and it's type is SIMD,...

Are Python codes written in mojo file compiled to native image?

or not compiled and requiring CPython to be installed on the computer running mojo program?

sort with custom `cmp_fn`

In Go, I can easily sort a slice with something like: ```go sort.Slice(my_slice, func(i, j int) bool { return my_slice[i][2] < my_slice[j][2] })...

import_path

This post is not a Q, but rather an A for peeps to search out. I'm abusing this Questions forum as a knowledge base, so to say. In this vid, Shashank refs that the file ~/.modular/modular.cfg's setting mojo.import_path can take comma-sep values to identify multiple import paths. The default value is something like: ``` [mojo]...

When will installation packages be supported instead of requiring login and being online?

We are in mainland China and are often unable to log in due to network restrictions.

Can not find auth_key for docker usage

On the internet I found, that the auth_key should be available on the Website (https://developer.modular.com/download). I created an account, but I can not find any key there. I would like to use this key in my docker file and I only want to use mojo, not mojo max. Does anyone has an idea, where to find this key?

How to deal with the lack of struct inheritance in Mojo

As we don't have struct inheritence in Mojo yet, is the use of Dependency Injection the way to go? Or what other approaches should i consider. I know this is a very general question but i am actual looking for some general advice here. I try to port a python project to Mojo, but as this code makes use of (class) inheritance i need figure out how to approach this - or if i better wait for Mojo to introduce inheritence ... Thx

Efficient Mojo Tensor To Numpy Array Conversion

Hello, I am attempting to convert a Mojo Tensor to a Numpy array without looping or at least with sub-polynomial time. My approach is to get the pointer to the Tensor and use Python's ctypes.from_address()...

Passing functions to functions.

Is there a way to pass a function (pointer) as in input argument to a function in mojo?

Is Mojo support Scikit Learn, TensorFlow, Pytorch library yet?

Why it's important in Mojo: * Wider Functionality: Scikit-learn provides a rich set of classical machine learning algorithms, TensorFlow and PyTorch excel in deep learning. Supporting these libraries expands the range of problems Mojo can tackle. * Code Reuse: Many developers are already familiar with these libraries. Mojo integration allows them to leverage existing code and expertise. * Vibrant Ecosystem: These libraries have large communities and extensive documentation. Integration opens doors to this wealth of resources for Mojo users....

Removing Python dependencies

Any thoughts on ways to remove the python necessary parts (list comprehension, sorted, unicodedata) in the following so it can be converted seamlessly to Mojo? ```python from unicodedata import category ...

Type State Pattern

Does anybody have a code-snippet that demonstrates a standard Type State Pattern in Mojo? For example, a somewhat textbook-example of a traffic light -- please excuse any typos I make in my sloppy hand-jam example. ```rs...

def in Mojo

When writing a program from scratch, what does def bring to the table over fn? Although def has its benefits and would work well alongside fn, in practice, I don't see what stops it from being viewed as "legacy Python"...

effects system?

Does the team have a position on this: https://github.com/modularml/mojo/discussions/783 These things are quite helpful also for safe automatic parallelism (see dex and jax)...

About PyTensor

I was wondering if there is a project for including libraries such as PyTensor (https://pytensor.readthedocs.io/en/latest/) in the roadmap. Beside its tensor computing capabilities it would also be interesting as a first step in order to further include some libraries such as PyMC (https://www.pymc.io/) for Bayesian models.

voice channels

Could we please have a few voice channels in this Discord server? I'd love to just park in a channel, muted, and then unmute to chat with peeps about Mojo as some kind of general voice forum. Because I have issues. 😂