Can I use Python library like huggingface transformer?

I wonder It is possible to use transformers library for ai engineering i. Mojo environment
6 Replies
Mahmoud Abduljawad
Mahmoud Abduljawad•15mo ago
You can always try importing any Python library from Mojo and see the aftermath of it:
from python.python import Python
fn main():
let transformers = Python.import_module("transformers")
from python.python import Python
fn main():
let transformers = Python.import_module("transformers")
__qqlalksdfnq__
__qqlalksdfnq__OP•15mo ago
Thank you so much!
cs🌈
cs🌈•15mo ago
did it work? 🙂 I may attempt this soon
Elaid Tebabkha
Elaid Tebabkha•15mo ago
You must do the importation in block try,except or put raises after fn name and parameters
Carlos
Carlos•11mo ago
Could you please give an example? Thanks
Joel
Joel•10mo ago
from python.python import Python
fn main() raises:
let transformers = Python.import_module("transformers")
from python.python import Python
fn main() raises:
let transformers = Python.import_module("transformers")
or
from python.python import Python
fn main():
try:
let transformers = Python.import_module("transformers")
except:
print("Import failed.")
from python.python import Python
fn main():
try:
let transformers = Python.import_module("transformers")
except:
print("Import failed.")
Want results from more Discord servers?
Add your server