I have trained a Sagemaker [NTM][1] model which is a neural topic model,
directly on the AWS sagemaker platform. Once training is complete you are able
to download the `mxnet` model files. Once unpacked the files contain:
- params
- symbol.json
- meta.json
I have followed the docs on mxnet to load the model and have the following code:
```python
sym, arg_params, aux_params = mx.model.load_checkpoint('model_algo-1', 0)
module_model = mx.mod.Module(symbol=sym, label_names=None, context=mx.cpu())
module_model.bind(
for_training=False,
data_shapes=[('data', (1, VOCAB_SIZE))]
)
module_model.set_params(arg_params=arg_params, aux_params=aux_params,
allow_missing=True) # must set allow missing true here or receive an error for
a missing n_epoch var
```
I now try and use the model for inference using:
```python
module_model.predict(x) # where x is a numpy array of size (1, VOCAB_SIZE)
```
The code runs, but the result is just a single value, where I expect a
distribution over topics:
```
[11.060672]
<NDArray 1 @cpu(0)>
```
Any help would be great!
[1]:
https://aws.amazon.com/blogs/machine-learning/introduction-to-the-amazon-sagemaker-neural-topic-model/
---
[Visit
Topic](https://discuss.mxnet.apache.org/t/load-amazon-sagemaker-ntm-model-locally-for-inference/6628/1)
or reply to this email to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
here](https://discuss.mxnet.apache.org/email/unsubscribe/af5ba0a04ffc8c4c6642a3e9a3c37e0d6c857c803e2f9fe8748249affb974a5b).