Hi, I'm trying to use a k-Nearest Neighbour model for deployment to an Edge device (AWS Panorama). I understand I need to create an optimized model to suit the target device. As I understand it the built-in algorithms all include a SageMaker Neo 'compile_model' function which I am running over my trained model -
Build model..
knn = sagemaker.estimator.Estimator(container,
role,
instance_count=1,
instance_type='ml.m5.2xlarge',
output_path=output_location,
sagemaker_session=sess,
input_mode='Pipe'
)
# Setup the hyperparameters
knn.set_hyperparameters(**hyperparams)
knn.fit(fit_input, job_name=job_name)
Build optimised model...
optimized_ic = knn.compile_model(
target_instance_family="ml_c5",
target_platform_os="LINUX",
target_platform_arch="ARM64",
input_shape={"data": [1,3,512,512]},
output_path=s3_optimized_output_location,
framework="mxnet",
framework_version="1.8",
)
While the initial model builds fine I get an error running the optimised model / compile_model function:
Failed. Reason: ClientError: InputConfiguration: No valid Mxnet model file -symbol.json found. Please make sure the framework you select is correct.
I can find a few google references for attempts at something similar with KMeans algorithm, but is k-NN algorithm dramatically different? Do I just have the wrong settings? I understand all of the built-in algorithms use were originally mxnet trained? When I extract my model I only have three files:
- model_algo-1
- model_algo-1.json
- model_algo-1-labels.npy
I am struggling to work out where I am going wrong in porting this model!
I have similarly tried the SageMaker Neo conversion using the 'Panorama Test Utility' and the steps suggested to optimise the model there. The problem again seems to be an issue with the knn trained model not being based on mxnet or missing a '-symbol.json' file?