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•16mo 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•16mo ago
Thank you so much!
cs🌈
cs🌈•16mo ago
did it work? 🙂 I may attempt this soon
Elaid Tebabkha
Elaid Tebabkha•16mo ago
You must do the importation in block try,except or put raises after fn name and parameters
Carlos
Carlos•12mo ago
Could you please give an example? Thanks
Joel
Joel•11mo 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