Repository: Project-MONAI/MONAI

Issue:
algo_templates error dints
**Describe the bug**
```
2023-04-15 08:10:35,481 - INFO - Launching: OMP_NUM_THREADS=1 python /tmp/tmp5ibdlrdn/workdir/dints_0/scripts/train.py run --config_file='/tmp/tmp5ibdlrdn/workdir/dints_0/configs/network_search.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/transforms_validate.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/network.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/transforms_train.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/hyper_parameters.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/hyper_parameters_search.yaml','/tmp/tmp5ibdlrdn/workdir/dints_0/configs/transforms_infer.yaml' --training#num_images_per_batch=2 --training#num_epochs=2 --training#num_epochs_per_validation=1
algo_templates.tar.gz: 72.0kB [00:00, 153kB/s]                             Traceback (most recent call last):
  File "/tmp/tmp5ibdlrdn/workdir/dints_0/scripts/train.py", line 36, in <module>
    from apex.contrib.clip_grad import clip_grad_norm_
  File "/opt/conda/lib/python3.8/site-packages/apex/__init__.py", line 10, in <module>
    from . import amp
  File "/opt/conda/lib/python3.8/site-packages/apex/amp/__init__.py", line 1, in <module>
    from .amp import init, half_function, float_function, promote_function,\
  File "/opt/conda/lib/python3.8/site-packages/apex/amp/amp.py", line 5, in <module>
    from .frontend import *
  File "/opt/conda/lib/python3.8/site-packages/apex/amp/frontend.py", line 2, in <module>
    from ._initialize import _initialize
  File "/opt/conda/lib/python3.8/site-packages/apex/amp/_initialize.py", line 2, in <module>
    from torch._six import string_classes
ModuleNotFoundError: No module named 'torch._six'

2023-04-15 08:10:42,705 - INFO - Directory /tmp/tmpqnyyq142/workdir is created to save ensemble predictions
```
this currently blocks the integration tests https://github.com/Project-MONAI/MONAI/actions/runs/4706795068/jobs/8348263719




Discussion:

Resolving patch:
diff --git a/monai/apps/auto3dseg/bundle_gen.py b/monai/apps/auto3dseg/bundle_gen.py
--- a/monai/apps/auto3dseg/bundle_gen.py
+++ b/monai/apps/auto3dseg/bundle_gen.py
@@ -36,7 +36,7 @@
 from monai.utils.enums import AlgoKeys
 
 logger = get_logger(module_name=__name__)
-ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "80c832e")
+ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "629ec7e")
 
 __all__ = ["BundleAlgo", "BundleGen"]
 
@@ -174,7 +174,7 @@ def _create_cmd(self, train_params: None | dict = None) -> tuple[str, str]:
 
         if os.path.isdir(config_dir):
             base_cmd = ""
-            for file in os.listdir(config_dir):
+            for file in sorted(os.listdir(config_dir)):
                 if not (file.endswith("yaml") or file.endswith("json")):
                     continue
                 base_cmd += f"{train_py} run --config_file=" if len(base_cmd) == 0 else ","
diff --git a/monai/apps/datasets.py b/monai/apps/datasets.py
--- a/monai/apps/datasets.py
+++ b/monai/apps/datasets.py
@@ -586,7 +586,7 @@ def _download_series_reference_data(self, series_uid: str, download_dir: str) ->
         download_tcia_series_instance(
             series_uid=series_uid, download_dir=download_dir, output_dir=seg_first_dir, check_md5=False
         )
-        dicom_files = [f for f in os.listdir(seg_first_dir) if f.endswith(".dcm")]
+        dicom_files = [f for f in sorted(os.listdir(seg_first_dir)) if f.endswith(".dcm")]
         # achieve series number and patient id from the first dicom file
         dcm_path = os.path.join(seg_first_dir, dicom_files[0])
         ds = PydicomReader(stop_before_pixels=True, specific_tags=self.load_tags).read(dcm_path)


Test patch:
diff --git a/tests/test_integration_autorunner.py b/tests/test_integration_autorunner.py
--- a/tests/test_integration_autorunner.py
+++ b/tests/test_integration_autorunner.py
@@ -58,6 +58,7 @@
         "num_warmup_epochs": 1,
         "use_pretrain": False,
         "pretrained_path": "",
+        "num_steps_per_image": 1,
     }
     if torch.cuda.is_available()
     else {}