Exemplo n.º 1
0
    def test_case_evaluate_FID_IS_ddp(self):
        """
    Usage:
        export PYTHONWARNINGS=ignore
        export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
        export TIME_STR=1
        export PYTHONPATH=./exp:./stylegan2-pytorch:./
        python -c "from template_lib.v2.tests.test_GAN import TestingTFFIDISScore;\
          TestingTFFIDISScore().test_case_evaluate_FID_IS_ddp()"

    :return:
    """
        if 'CUDA_VISIBLE_DEVICES' not in os.environ:
            os.environ['CUDA_VISIBLE_DEVICES'] = '0,1'
        if 'TIME_STR' not in os.environ:
            os.environ['TIME_STR'] = '0' if utils.is_debugging() else '0'

        command, outdir = get_command_and_outdir(
            self, func_name=sys._getframe().f_code.co_name, file=__file__)
        argv_str = f"""
                --tl_config_file none
                --tl_command none
                --tl_outdir {outdir}
                """
        args = setup_outdir_and_yaml(argv_str)

        nproc_per_node = len(os.environ['CUDA_VISIBLE_DEVICES'].split(','))
        cmd_str = f"""
        python -m torch.distributed.launch --nproc_per_node={nproc_per_node} --master_port=8888 
          template_lib/v2/GAN/evaluation/tf_FID_IS_score.py 
            --run_func TFFIDISScore.test_case_evaluate_FID_IS
        """
        cmd_str += get_append_cmd_str(args)
        start_cmd_run(cmd_str)
        pass
Exemplo n.º 2
0
    def test_test_vae(self):
        """
    Usage:

        export CUDA_VISIBLE_DEVICES=1
        export TIME_STR=1
        export PYTHONPATH=./PyTorch_VAE_lib:./
        python -c "from exp.tests.test_pytorch_vae import Testing_PyTorch_VAE;\
          Testing_PyTorch_VAE().test_test_vae()"

    :return:
    """
        if 'CUDA_VISIBLE_DEVICES' not in os.environ:
            os.environ['CUDA_VISIBLE_DEVICES'] = '1'
        if 'TIME_STR' not in os.environ:
            os.environ['TIME_STR'] = '0' if utils.is_debugging() else '1'

        command, outdir = get_command_and_outdir(
            self, func_name=sys._getframe().f_code.co_name, file=__file__)
        argv_str = f"""
                --tl_config_file exp/configs/pytorch_vae.yaml
                --tl_command {command}
                --tl_outdir {outdir}
                """
        args = setup_outdir_and_yaml(argv_str)

        nproc_per_node = len(os.environ['CUDA_VISIBLE_DEVICES'].split(','))
        cmd_str = f"""
        python exp/scripts/test.py -c PyTorch_VAE_lib/configs/vae.yaml
        """
        cmd_str += get_append_cmd_str(args)
        start_cmd_run(cmd_str)
        pass