-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it necessary to support new types of tensor? #65
Comments
@loloxwg hey thanks for looking into this package. We are coming close to a big release with updates. In terms of the return types, we need the package to gel with the SQL language and other languages such as Python. It's possible that we can build an option to return tensors. What is your use case for surrealml? I can see if I can accommodate it. |
I plan to start by using it on the MNIST dataset for digit recognition. @maxwellflitton |
@maxwellflitton - do you have any timeline on the update? |
I have a somewhat similar request - allowing for input to be of different types than pure scalars. For my use case where I'm doing state recognition of timeseries data stored in SurrealDB, I perform GAF conversion of a time series section to create images (shape (1, 3, 64, 64)) and want to pass them through a pytorch/onnx/surml model. Unfortunately, surml does not allow inputs of required type & shape This works import onnxruntime as ort
model = torch.load('./cnn_model.pth', map_location=torch.device('cpu'))
model.eval()
test_input = torch.rand(64, 64, 3, dtype=torch.float32) * 2 - 1
test_input = test_input.permute(2, 0, 1).unsqueeze(0)
onnx_file_path = './cnn_model.onnx'
torch.onnx.export(
model,
test_input,
onnx_file_path,
export_params=True,
opset_version=18,
do_constant_folding=True,
input_names=["input"],
output_names=["output"],
dynamic_axes={
"input": {0: "batch_size"},
"output": {0: "batch_size"}
}
)
res = await con.query('SELECT VALUE value FROM timeserie_data:["ts_1", time::now()-3h]..=["ts_1", time::now()-2h]')
downscaled = downScale(np.array(res))
img = getAndMakeData(downscaled)
shaped_img = np.expand_dims(np.transpose(img, (2, 0, 1)), axis=0)
ort_session = ort.InferenceSession(onnx_file_path)
input_data = shaped_img.astype(np.float32)
outputs = ort_session.run(None, {"input": input_data})
print("Model output:", outputs) while this fails file = SurMlFile(model=onnx_model, name="tsPeriodState", engine=Engine.ONNX)
file.raw_compute(shaped_img.astype(np.float32)) with the error
|
The input and output of reasoning frameworks are typically tensor types, but I didn't find this type in SurrealDB.
The text was updated successfully, but these errors were encountered: