Sampling for Classification Task

As per the FAQ, sample weighting can be done to balance the dataset.
However, on applying the same, the following error is observed
MMAR_ROOT set to /mmar/commands/…
2021-08-26 07:01:17,340 - torch.distributed.nn.jit.instantiator - INFO - Created a temporary directory at /tmp/tmppcyelmuh
2021-08-26 07:01:17,341 - torch.distributed.nn.jit.instantiator - INFO - Writing /tmp/tmppcyelmuh/
Error processing config /mmar/commands/…/config/config_train_pe.json: object of type ‘int’ has no len()
Traceback (most recent call last):
File “/opt/conda/lib/python3.8/”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/opt/conda/lib/python3.8/”, line 87, in _run_code
exec(code, run_globals)
File “apps/”, line 35, in
File “apps/”, line 27, in main
File “apps/”, line 21, in train_mmar
File “<nvflare-0.1.4>/dlmed/utils/”, line 172, in configure
File “<nvflare-0.1.4>/dlmed/utils/”, line 167, in configure
File “<nvflare-0.1.4>/dlmed/utils/”, line 163, in _do_configure
File “apps/”, line 471, in finalize_config
File “apps/”, line 120, in sample_weights_by_classes
File “apps/”, line 120, in
File “apps/”, line 117, in _convert_label
TypeError: object of type ‘int’ has no len()

the json for dataset part looks as which is exactly the same as given in the example:
“dataset”: {
“name”: “Dataset”,
“data_list_file_path”: “{DATASET_JSON}”,
“data_file_base_dir”: “{DATA_ROOT}”,
“data_list_key”: “training”,
“mode”: “auto”
Any idea on what could be wrong?


Hi Srikishnan. What does your labels look like? In order to perform the sampling, we try to get all the classes and find the list of unique classes from labels. This error is being thrown in that conversion.

Attached is the dataset json I am using. training configuration JSON is exactly as that of

Please let me know if you need some more information or where I am going wrong.


strat_classification_0.json (9.5 KB)

Did you get time to investigate?
Just getting the feeling that this platform needs more response from NVIDIA. Otherwise, it is hard to go beyond the toy examples; same was the problem in 3.1 as well.