tlt-prune: error: argument -k/--key: expected one argument

I got the following error when i tried to prune the model.

root@ceb7ee9a3713:/workspace# tlt-prune -pm "/home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/prune_result/frcnn_kitti.epoch47.tlt" -o "/home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/prune_result/logs" -eq intersection -pth 0.1 -k $KEY
Using TensorFlow backend.
usage: tlt-prune [-h] -pm PRETRAINED_MODEL -o OUTPUT_DIR -k KEY
                 [-n NORMALIZER] [-eq EQUALIZATION_CRITERION]
                 [-pg PRUNING_GRANULARITY] [-pth PRUNING_THRESHOLD]
                 [-nf MIN_NUM_FILTERS]
                 [-el [EXCLUDED_LAYERS [EXCLUDED_LAYERS ...]]] [-v]
tlt-prune: error: argument -k/--key: expected one argument

Make sure your $KEY is correct and not empty
Please check with

$ echo $KEY

The key used in the train spec is the same one which i used for prune.

random_seed: 42
enc_key: '$KEY'
verbose: True
network_config {
input_image_config {
image_type: RGB
image_channel_order: 'bgr'

I got other error when i tried with “echo $KEY”

root@ceb7ee9a3713:/workspace# tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k echo $KEY
Using TensorFlow backend.
Traceback (most recent call last):
  File "/usr/local/bin/tlt-prune", line 10, in <module>
    sys.exit(main())
  File "./common/magnet_prune.py", line 169, in main
  File "./common/magnet_prune.py", line 105, in run_pruning
  File "./common/utils.py", line 154, in decode_to_keras
IOError: Invalid decryption. Unable to open file (File signature not found)

Hi samjith888,
I mean you can check if your $KEY is correct and not empty.
Please

root@ceb7ee9a3713:/workspace# echo $KEY

I have also tried with -k ‘mykey’ (this mykey is the API key generated from the NVIDIA NGC)

Still I’m getting the same error which i mentioned above.

Its not showing anything

root@ceb7ee9a3713:/workspace# echo $KEY

root@ceb7ee9a3713:/workspace#

So, your $KEY is empty.It is not expected.
Please export the $KEY or set $kEY explicitly to try.
For example, if your key is abcdef, then you can set it in your command line as below.

$ tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k abcdef

how to export the $KEY?

If your key is abcdef
Then

$ export KEY=abcdef

Then you can see your $KEY is not empty.

$ echo $KEY

Getting the same error even after export the key

Can you paste your latest command line along with the log here?

root@ceb7ee9a3713:/workspace# echo KEY
KEY
root@ceb7ee9a3713:/workspace# tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k KEY
Using TensorFlow backend.
Traceback (most recent call last):
  File "/usr/local/bin/tlt-prune", line 10, in <module>
    sys.exit(main())
  File "./common/magnet_prune.py", line 169, in main
  File "./common/magnet_prune.py", line 105, in run_pruning
  File "./common/utils.py", line 154, in decode_to_keras
IOError: Invalid decryption. Unable to open file (File signature not found)
root@ceb7ee9a3713:/workspace#

Should be
$ echo $KEY

instead of
$ echo KEY

Also,
Should be

root@ceb7ee9a3713:/workspace# tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k $KEY

instead of

root@ceb7ee9a3713:/workspace# tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k KEY

I have changed according to your suggestions ,but the same error ,

root@ceb7ee9a3713:/workspace# export KEY=KEY
root@ceb7ee9a3713:/workspace# echo $KEY     
KEY
root@ceb7ee9a3713:/workspace# tlt-prune -pm /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/frcnn_kitti.epoch47.tlt -o /home/samjth/NVIDIA_Transfer_Learning_Toolkit/Labelling_Software/output/export_model/prune/logs -eq intersection -pth 0.1 -k $KEY 
Using TensorFlow backend.
Traceback (most recent call last):
  File "/usr/local/bin/tlt-prune", line 10, in <module>
    sys.exit(main())
  File "./common/magnet_prune.py", line 169, in main
  File "./common/magnet_prune.py", line 105, in run_pruning
  File "./common/utils.py", line 154, in decode_to_keras
IOError: Invalid decryption. Unable to open file (File signature not found)
root@ceb7ee9a3713:/workspace#

Please also make sure your key is the same as the key which is used in tlt-train.

Also, please refer to below topics.
https://devtalk.nvidia.com/default/topic/1063996/transfer-learning-toolkit/tlt-prune-error-ioerror-invalid-decryption-unable-to-open-file-file-signature-not-found-/post/5390072/#5390072
https://devtalk.nvidia.com/default/topic/1067915/transfer-learning-toolkit/tlt-infer-with-ssd-fails-with-ioerror-unable-to-open-file-file-signature-not-found-/post/5409323/#5409323
https://devtalk.nvidia.com/default/topic/1064436/transfer-learning-toolkit/ioerror-invalid-decryption-unable-to-open-file-file-signature-not-found-tlt-prune-command/post/5410651/#5410651

tlt-train [-h] faster_rcnn -e <experiment_spec> This is my train command, where i didn’t used any key. faster_rcnn train spec file contains a key value

random_seed: 42
enc_key: '$KEY'
verbose: True
network_config {
input_image_config {
image_type: RGB
image_channel_order: 'bgr'

Make sure the key in the spec matches the key in tlt-prune.

Both key is same ($KEY). Do i need to get the API key from ‘NVIDIA NGC’ here and update the train_spec “enc_key: ‘$KEY’” with the API key , and run the train from scratch ?

Please go through topics to get more pointers. If not, you can try your mentioned idea.
https://devtalk.nvidia.com/default/topic/1063996/transfer-learning-toolkit/tlt-prune-error-ioerror-invalid-decryption-unable-to-open-file-file-signature-not-found-/post/5390072/#5390072
https://devtalk.nvidia.com/default/topic/1067915/transfer-learning-toolkit/tlt-infer-with-ssd-fails-with-ioerror-unable-to-open-file-file-signature-not-found-/post/5409323/#5409323
https://devtalk.nvidia.com/default/topic/1064436/transfer-learning-toolkit/ioerror-invalid-decryption-unable-to-open-file-file-signature-not-found-tlt-prune-command/post/5410651/#5410651

I have already read those answers, but i didn’t found anything to solve this issue.
I’m using faster_rcnn for training, where the training spec contain the $KEY parameter, but the training command is ‘tlt-train faster_rcnn -e /spec_file_path’ , which didn’t contain the key parameter.