TilliFe
MModular
ā¢Created by Martin Dudek on 9/16/2024 in #questions
to_numpy with Mojo 24.5
I think I have been there too. Does the following example from the MAX repo help as a reference?
https://github.com/modularml/max/blob/434daac5b52226d8c7ea024d08df127af5fce9dd/examples/serve/openclip-mojo-onnx/python_utils.mojo#L61
9 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
A small update
https://x.com/fe_tilli/status/1835592247779193091
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Hi Martin, I am indeed planning to integrate those features, at least on a high level. Things like high level modules and some standard nn models.
The image shall simply display some possible applications (stuff I am personally really interested in), but it definitely does not cover all possible applications of a comprehensive Array library. (Just look at where NumPy is used nowadays, even in satelites floating through space...)
Thank you for mentioning this, I should write down something like a roadmap to make things more transparent.
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
I fixed JIT compilation with MAX. :mojo:
What was the problem?
If you previously ran the simple MLP benchmarks inside Endia's
benchmarks
directory, you might have noticed that the version using MAX for JIT compiling Endia Subgraphs, took for ages compared to not using MAX. Why? When transferring data from the Endia Graph to the MAX Graph/Model and back, we did not properly make use of TensorMaps, but converted arguments (a List of Endia Arrays) to a list of NumPy arrays first (a List of PythonObjects, expensive!), which are then again being converted to a set of MAX Tensors for further use by the MAX engine). This sounds indeed terrible š¤¦āāļø and I only saw the obvious alternative now: We can create MAX Tensors as inputs to an executable MAX Model which do not own their data pointer! From now on, the inputs to a MAX Model merely borrow
UnsafePointers from Endia Arrays for the duration of the MAX Model execution. Additionally, outputs from a MAX Model were previously copied (also super expensive). Now, since those outputs will usually be destroyed, we can just steal the outputs' UnsafePointers and let Endia Array own them after execution.
All in all, there are no unnecessary data copies anymore, and Endia and MAX can now work on the same data. This dramatically speeds up JIT compilation in Endia. Due to MAX' highly optimized ops, this speedup will be especially significant, when training larger Neural Networks. Ultimately, this also gives me confidence, that Endia can greatly benefit from using MAX once it'll support GPU. Cheers! š§47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
partying in nd-space...
https://x.com/fe_tilli/status/1829431929688465500
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Absolutely! :mojo: I had a similar idea and wanted to reach out to you on that as well.
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Endia's FFT implementation, despite its compactness, delivers performance not far behind established frameworks. Further optimizations and algorithmic refinements could push Endia's performance to fully match or even exceed existing solutions.
47 replies
MModular
ā¢Created by HALFPOTATO on 8/8/2024 in #questions
Autodiff For Mojo
Hi, yeah usability-wise (and also performance-wise) definitely still a ton of difference, since Endia is in very active development.
Endia shall soon become very similar to PyTorch, however the goal is to make - what Pytorch currently has in its functional Module - a true first class citzen in Endia. If this will work as I envision, Endia can also be used like a more functional ML framwork, similar to JAX. This would mean people with different philosophies of coding could come together and use just one engine seamlessly, which would be pretty nice.
As Benny mentioned, implementation-wise, Endia is completely different to any other ML framework, since it is written in Mojo. A single layer stack basically. Chears š§
10 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Endia nightly now uses MAX/Mojo nightly. This was long due. š·āāļø š·āāļø š§
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Good question, lets first test if the import of modules work at all on your machine, then we try to generalize this for any kind of external module that shall be used in a (nested) project.
Basic Import Test:
Create a new directory
test
and copy the endia.package inside of it. Then next to it create a file where you try to import endia. If that works you can checkout the next step.
Example:
General Usage:
- If you build a nested module/a project with a lot of subdirectories, make sure that all subfolders that use an external module (e.g. Endia) have a __init__.mojo
file. This will modularize the subfolders. Check out the docs for more information: https://docs.modular.com/mojo/manual/packages.
- Once you have modularized your project, you can place the endia.package at the top level of your directory. Then you should be able to import endia
at any level.
Example:
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Endia v24.4.2 comes with a more familiar API than ever before.
Check out a small video about it on X: https://x.com/fe_tilli/status/1819100569425899659
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Endia v24.4.1 Release
New:
- Reduce Ops: max, argmax, min, argmin
- Spacial Ops: 1D, 2D, 3D Convolution, MaxPooling, AvgPooling (usable, yet fairly unoptimized and not properly plugged into the autograd system - coming in the next release.)
- Improved documentation and licensing.
š Details: https://github.com/endia-org/Endia
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Interesting, really looking forward to it. š¤ This would make it much more flexible. Nice!!!
On this tangent: Here is how shapes are handled in Endia during runtime: At the core of it all, we have the
Dual-Graph
. Endia always constructs two separate graphs, one for the shape computations (ShapeGraph
) and one for the actual data computations (DataGraph
). Each ShapeNode has a dedicated method to compute its data (dims, strides, offset) during runtime based on its parents.
On the other hand, the DataNodes in the DataGraph also perform dedicated data transformations based on their parents, however every DataNode additionally holds a reference to exactly one ShapeNode. This way we can clearly separate concerns and can compute shapes without properly initializing any DataNode. This development was crucial to take the step from pure eager execution to efficient function tracing.
š I updated the Custom Ops
Docs Page with the function clone_shape
in the array registration to illustrate this concept.47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Apart from studying their Docs Website, not a lot.
I really like the philosophy of both PyTorch and JAX, but i do not see any reason why one approach would be better than the other, it simply depends on who you are asking I guess. Realizing that functions in Mojo are treated just like regular values gave me the idea that this JAX-like interface must be possible.
What I can say about the development of Endia in general, is that this project started in a really naive way (as you might have seen last fall with the Infermo project.) Since then I kept working on it very consistently, rethinking and overthinking all aspects of the AutoDiff Engine, again and again.
So all in all, I wouldn't call myself an expert in neither JAX nor PyTorch, I simply build things how they seem most reasonable and intuitive and hope to be able to continue working like that in the future. š I am still learning a ton.
47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Custom Ops
is what i meant in my previous answer š47 replies
MModular
ā¢Created by TilliFe on 7/18/2024 in #community-showcase
Endia
Introducing: Custom Ops š ļø
If you want to learn more about how to define your own Custom differentiable Operations in Endia, you can checkout the updated Docs Page here: https://endia.vercel.app/docs/custom_operations.
Defining custom ops is actually much easier to do in Endia than in Jax or PyTorch without giving up on all the low-level control that you need to make your operations go brrr.
47 replies