fishbone
fishbone
MModular
Created by fishbone on 2/21/2024 in #questions
Probably a very silly question...
Hi everyone. I am not quite sure where to post this, but I'm trying to dip my toes into the Modular SDK, interfacing with it via Python. ✓ Installed Mojo/Modular SDK on my Ubuntu 20.04 system. ✓ The mojo and modular commands both work. I can also run .mojo files no problem. ✓ I proceeded with the Getting Started in Python guide.
import numpy as np
from modular import engine
from pathlib import Path

session = engine.InferenceSession()
model_path = Path('/mnt/canopy_raid/Models/bert-base-uncased')
model = session.load(model_path)

for tensor in model.input_metadata:
print(f'name: {tensor.name}, shape: {tensor.shape}, dtype: {tensor.dtype}')
import numpy as np
from modular import engine
from pathlib import Path

session = engine.InferenceSession()
model_path = Path('/mnt/canopy_raid/Models/bert-base-uncased')
model = session.load(model_path)

for tensor in model.input_metadata:
print(f'name: {tensor.name}, shape: {tensor.shape}, dtype: {tensor.dtype}')
I get the error:
from modular import engine
ModuleNotFoundError: No module named 'modular'
from modular import engine
ModuleNotFoundError: No module named 'modular'
I'm still a beginner coder, but I know a little about python packages so I figure I'd make a symbolic link between modular and my python dist-packages. sudo ln -s /usr/bin/modular /usr/lib/python3/dist-packages Unsurprisingly, still nothing. What am I missing here?
4 replies