M
Modular2mo ago
Tony

anyone know why I might be this error about TorchInputSpec:

use of unknown declaration 'TorchInputSpec'mojo from: var session = engine.InferenceSession() var model = session.load( model_path, input_specs = [ engine.TorchInputSpec( shape=[none, 28, 28], dtype=DType.int32 ), ], ) I've got all the necessary imports, the ai bot is flummoxed
4 Replies
Tony
TonyOP2mo ago
TorchInputSpec isn't in any module I can find, I think that is the problem. The docs says it is in max.engine but the compiler disagrees
ModularBot
ModularBot2mo ago
Congrats @Tony, you just advanced to level 3!
Tony
TonyOP2mo ago
@kapa.ai Where is TorchInputSpec? @kapa.ai where is TorchInputSpec
Ehsan M. Kermani (Modular)
For Mojo API, to load a torchscript model please use https://docs.modular.com/max/api/mojo/engine/session/InputSpec
InputSpec | Modular Docs
Specifies a model's input shape and data type (required for TorchScript).
Want results from more Discord servers?
Add your server