M
Modular13mo ago
Sai Tej

please add support for spacy and fastapi

please add support for spacy and fastapi
11 Replies
Luke Skywalker
Luke Skywalker13mo ago
One Up! So atm FastAPI and spacy do not work out of the box?
Luke Skywalker
Luke Skywalker13mo ago
hmm interesting. should that yield in better performance in general as well as when using cuda functions like in OCR with unstructured?
Jack Clayton
Jack Clayton13mo ago
No importing Python modules this way runs through the CPython interpreter and doesn't improve performance at this stage
Innominus
Innominus12mo ago
So Python doesn't get compiled down yet, just runs alongside in an interpreter? What's the cost of interop between Mojo and Python right now? Similar to Python calling C?
Jack Clayton
Jack Clayton12mo ago
That’s right yeah. The objects live in memory and behave in the same way they do with CPython. Same cost as Python yeah.
Innominus
Innominus12mo ago
but is there actually interop cost, or it just gives memory addresses?
Jack Clayton
Jack Clayton12mo ago
No more cost than using Python normally, e.g. you can get the memory address of a CPython numpy ndarray back and then load and store values using SIMD
Mahmoud Abduljawad
at this stage
I'm sure I read somewhere that Mojo is targeting improving performance on Python modules ran in Mojo. Is that why you ended your comment with that, or am I hallucinating?
Innominus
Innominus12mo ago
Yeah I believe the end goal includes compiling Python code itself and doing static metaprogramming to achieve reflection in Python, but compiled.
Jack Clayton
Jack Clayton12mo ago
Not in the short term, there are many other projects doing that. Mojo is focused on allowing you to run your hardware as close to the limits of physics as possible. But there is potential to do that later
Want results from more Discord servers?
Add your server