From e3c576bd5c08621184542a80b64d1af97545dfb8 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 18:36:58 -0500 Subject: [PATCH 01/14] move tests Signed-off-by: Jinzhe Zeng --- source/tests/{ => tf}/common.py | 1 + .../{ => tf}/compat_inputs/water_se_a_v0.json | 0 .../{ => tf}/compat_inputs/water_se_a_v1.json | 0 .../tests/{ => tf}/compat_inputs/water_v0.json | 0 .../tests/{ => tf}/compat_inputs/water_v1.json | 0 .../tests/{ => tf}/compat_inputs/water_v2.json | 0 source/tests/{ => tf}/data_dp_mask/nopbc | 0 .../{ => tf}/data_dp_mask/set.000/aparam.npy | Bin .../data_dp_mask/set.000/atom_pref.npy | Bin .../{ => tf}/data_dp_mask/set.000/box.npy | Bin .../{ => tf}/data_dp_mask/set.000/coord.npy | Bin .../{ => tf}/data_dp_mask/set.000/energy.npy | Bin .../{ => tf}/data_dp_mask/set.000/force.npy | Bin source/tests/{ => tf}/data_dp_mask/type.raw | 0 .../tests/{ => tf}/data_dp_mask/type_map.raw | 0 .../tests/{ => tf}/data_modifier/dipole.json | 0 .../sys_10/set.000/atomic_dipole.npy | Bin .../data_modifier/sys_10/set.000/box.npy | Bin .../data_modifier/sys_10/set.000/coord.npy | Bin .../data_modifier/sys_10/set.000/energy.npy | Bin .../data_modifier/sys_10/set.000/force.npy | Bin .../{ => tf}/data_modifier/sys_10/type.raw | 0 .../{ => tf}/data_modifier/sys_10/type_map.raw | 0 .../{ => tf}/finetune/data/set.000/box.npy | Bin .../{ => tf}/finetune/data/set.000/coord.npy | Bin .../{ => tf}/finetune/data/set.000/energy.npy | Bin .../{ => tf}/finetune/data/set.000/force.npy | Bin source/tests/{ => tf}/finetune/data/type.raw | 0 .../tests/{ => tf}/finetune/data/type_map.raw | 0 .../finetune/data_mixed_type/set.000/box.npy | Bin .../finetune/data_mixed_type/set.000/coord.npy | Bin .../data_mixed_type/set.000/energy.npy | Bin .../finetune/data_mixed_type/set.000/force.npy | Bin .../set.000/real_atom_types.npy | Bin .../{ => tf}/finetune/data_mixed_type/type.raw | 0 .../finetune/data_mixed_type/type_map.raw | 0 .../{ => tf}/finetune/input_finetune.json | 0 .../{ => tf}/finetune/input_pretrain.json | 0 .../init_frz_model/data/set.000/box.npy | Bin .../init_frz_model/data/set.000/coord.npy | Bin .../init_frz_model/data/set.000/energy.npy | Bin .../init_frz_model/data/set.000/force.npy | Bin .../{ => tf}/init_frz_model/data/type.raw | 0 .../{ => tf}/init_frz_model/data/type_map.raw | 0 .../tests/{ => tf}/init_frz_model/input.json | 0 .../model_compression/data/set.000/box.npy | Bin .../model_compression/data/set.000/coord.npy | Bin .../model_compression/data/set.000/energy.npy | Bin .../model_compression/data/set.000/force.npy | Bin .../{ => tf}/model_compression/data/type.raw | 0 .../model_compression/data/type_map.raw | 0 .../{ => tf}/model_compression/input.json | 0 .../tests/{ => tf}/model_spin/set.000/box.npy | Bin .../{ => tf}/model_spin/set.000/coord.npy | Bin .../{ => tf}/model_spin/set.000/energy.npy | Bin .../{ => tf}/model_spin/set.000/force.npy | Bin source/tests/{ => tf}/model_spin/type.raw | 0 source/tests/{ => tf}/nvnmd/ref/box.npy | Bin .../tests/{ => tf}/nvnmd/ref/config_v0_cnn.npy | Bin .../tests/{ => tf}/nvnmd/ref/config_v1_cnn.npy | Bin source/tests/{ => tf}/nvnmd/ref/coord.npy | Bin source/tests/{ => tf}/nvnmd/ref/type.raw | 0 .../tests/{ => tf}/nvnmd/ref/weight_v0_cnn.npy | Bin .../tests/{ => tf}/nvnmd/ref/weight_v1_cnn.npy | Bin source/tests/{ => tf}/pairwise_dprc.json | 0 source/tests/{ => tf}/polar_se_a.json | 0 source/tests/{ => tf}/polar_se_a_tebd.json | 0 source/tests/{ => tf}/test.hdf5 | Bin .../tests/{ => tf}/test_activation_fn_gelu.py | 0 source/tests/{ => tf}/test_adjust_sel.py | 0 source/tests/{ => tf}/test_argument_parser.py | 0 source/tests/{ => tf}/test_auto_batch_size.py | 0 source/tests/{ => tf}/test_cluster.py | 0 source/tests/{ => tf}/test_common.py | 0 source/tests/{ => tf}/test_compat_input.py | 0 .../tests/{ => tf}/test_compressed_training.py | 0 source/tests/{ => tf}/test_data_large_batch.py | 0 source/tests/{ => tf}/test_data_modifier.py | 0 .../{ => tf}/test_data_modifier_shuffle.py | 0 source/tests/{ => tf}/test_data_requirement.py | 0 source/tests/{ => tf}/test_deepdipole.py | 12 ++++++------ source/tests/{ => tf}/test_deepdos.py | 4 ++-- source/tests/{ => tf}/test_deepmd_data.py | 0 source/tests/{ => tf}/test_deepmd_data_sys.py | 0 source/tests/{ => tf}/test_deeppolar.py | 10 +++++----- source/tests/{ => tf}/test_deeppot_a.py | 17 +++++++++-------- source/tests/{ => tf}/test_deeppot_r.py | 8 ++++---- source/tests/{ => tf}/test_deeppot_spin.py | 4 ++-- source/tests/{ => tf}/test_descrpt_hybrid.py | 0 source/tests/{ => tf}/test_descrpt_nonsmth.py | 0 .../tests/{ => tf}/test_descrpt_se_a_mask.py | 7 ++++--- .../tests/{ => tf}/test_descrpt_se_a_type.py | 0 source/tests/{ => tf}/test_descrpt_se_atten.py | 0 source/tests/{ => tf}/test_descrpt_se_r.py | 0 source/tests/{ => tf}/test_descrpt_sea_ef.py | 0 .../tests/{ => tf}/test_descrpt_sea_ef_para.py | 0 .../tests/{ => tf}/test_descrpt_sea_ef_rot.py | 0 .../tests/{ => tf}/test_descrpt_sea_ef_vert.py | 0 source/tests/{ => tf}/test_descrpt_smooth.py | 0 source/tests/{ => tf}/test_dipole_se_a.py | 0 source/tests/{ => tf}/test_dipole_se_a_tebd.py | 0 source/tests/{ => tf}/test_dipolecharge.py | 4 ++-- source/tests/{ => tf}/test_dp_test.py | 8 ++++---- source/tests/{ => tf}/test_embedding_net.py | 0 source/tests/{ => tf}/test_env.py | 0 source/tests/{ => tf}/test_ewald.py | 0 source/tests/{ => tf}/test_examples.py | 0 .../tests/{ => tf}/test_finetune_se_atten.py | 0 source/tests/{ => tf}/test_fitting_dos.py | 0 .../tests/{ => tf}/test_fitting_ener_type.py | 0 source/tests/{ => tf}/test_fitting_stat.py | 0 source/tests/{ => tf}/test_gen_stat_data.py | 0 source/tests/{ => tf}/test_get_potential.py | 0 source/tests/{ => tf}/test_gui.py | 0 .../{ => tf}/test_init_frz_model_multi.py | 0 .../tests/{ => tf}/test_init_frz_model_se_a.py | 0 .../{ => tf}/test_init_frz_model_se_a_tebd.py | 0 .../{ => tf}/test_init_frz_model_se_a_type.py | 0 .../{ => tf}/test_init_frz_model_se_atten.py | 0 .../tests/{ => tf}/test_init_frz_model_se_r.py | 0 .../tests/{ => tf}/test_init_frz_model_spin.py | 0 source/tests/{ => tf}/test_lammps.py | 0 source/tests/{ => tf}/test_layer_name.py | 0 source/tests/{ => tf}/test_linear_model.py | 0 source/tests/{ => tf}/test_loss_gf.py | 0 .../tests/{ => tf}/test_mixed_prec_training.py | 0 .../{ => tf}/test_model_compression_se_a.py | 0 .../test_model_compression_se_a_ebd.py | 0 ...model_compression_se_a_ebd_type_one_side.py | 0 ...ression_se_a_type_one_side_exclude_types.py | 0 .../test_model_compression_se_atten.py | 0 .../{ => tf}/test_model_compression_se_r.py | 0 .../{ => tf}/test_model_compression_se_t.py | 0 source/tests/{ => tf}/test_model_devi.py | 0 source/tests/{ => tf}/test_model_devi_mix.py | 0 source/tests/{ => tf}/test_model_dos.py | 0 .../tests/{ => tf}/test_model_format_utils.py | 0 source/tests/{ => tf}/test_model_loc_frame.py | 0 source/tests/{ => tf}/test_model_multi.py | 0 source/tests/{ => tf}/test_model_pairtab.py | 0 source/tests/{ => tf}/test_model_se_a.py | 0 .../tests/{ => tf}/test_model_se_a_aparam.py | 0 source/tests/{ => tf}/test_model_se_a_ebd.py | 0 .../tests/{ => tf}/test_model_se_a_ebd_v2.py | 0 .../tests/{ => tf}/test_model_se_a_fparam.py | 0 source/tests/{ => tf}/test_model_se_a_srtab.py | 0 source/tests/{ => tf}/test_model_se_a_type.py | 0 source/tests/{ => tf}/test_model_se_atten.py | 0 source/tests/{ => tf}/test_model_se_r.py | 0 source/tests/{ => tf}/test_model_se_t.py | 0 source/tests/{ => tf}/test_model_spin.json | 0 source/tests/{ => tf}/test_model_spin.py | 0 source/tests/{ => tf}/test_neighbor_stat.py | 0 .../tests/{ => tf}/test_nvnmd_entrypoints.py | 0 source/tests/{ => tf}/test_nvnmd_op.py | 0 source/tests/{ => tf}/test_output_def.py | 0 source/tests/{ => tf}/test_pairwise_dprc.py | 0 .../tests/{ => tf}/test_parallel_training.py | 0 source/tests/{ => tf}/test_polar_se_a.py | 0 source/tests/{ => tf}/test_polar_se_a_tebd.py | 0 source/tests/{ => tf}/test_prod_env_mat.py | 0 source/tests/{ => tf}/test_prod_force.py | 0 source/tests/{ => tf}/test_prod_force_grad.py | 0 source/tests/{ => tf}/test_prod_virial.py | 0 source/tests/{ => tf}/test_prod_virial_grad.py | 0 source/tests/{ => tf}/test_sel_idx.py | 0 source/tests/{ => tf}/test_tab_nonsmth.py | 0 source/tests/{ => tf}/test_tab_smooth.py | 0 source/tests/{ => tf}/test_tabulate.py | 0 source/tests/{ => tf}/test_train.py | 0 source/tests/{ => tf}/test_transfer.py | 5 +++-- source/tests/{ => tf}/test_type_embed.py | 0 source/tests/{ => tf}/test_type_one_side.py | 0 source/tests/{ => tf}/test_uni_infer.py | 4 ++-- source/tests/{ => tf}/test_virtual_type.py | 4 ++-- source/tests/{ => tf}/train_dos.json | 0 source/tests/{ => tf}/water.json | 0 source/tests/{ => tf}/water_hybrid.json | 0 source/tests/{ => tf}/water_layer_name.json | 0 source/tests/{ => tf}/water_multi.json | 0 source/tests/{ => tf}/water_se_a.json | 0 source/tests/{ => tf}/water_se_a_afparam.json | 0 source/tests/{ => tf}/water_se_a_aparam.json | 0 source/tests/{ => tf}/water_se_a_ebd.json | 0 source/tests/{ => tf}/water_se_a_fparam.json | 0 source/tests/{ => tf}/water_se_a_srtab.json | 0 source/tests/{ => tf}/water_se_a_type.json | 0 source/tests/{ => tf}/water_se_atten.json | 0 ...water_se_atten_compressible_mixed_type.json | 0 .../{ => tf}/water_se_atten_mixed_type.json | 0 source/tests/{ => tf}/water_se_r.json | 0 source/tests/{ => tf}/water_se_t.json | 0 source/tests/{ => tf}/wfc.json | 0 .../{ => tf}/yaml_inputs/water_se_a_v1.json | 0 .../{ => tf}/yaml_inputs/water_se_a_v1.yaml | 0 .../tests/{ => tf}/yaml_inputs/water_v1.json | 0 .../tests/{ => tf}/yaml_inputs/water_v1.yaml | 0 source/tests/{ => tf}/zinc_se_a_mask.json | 0 198 files changed, 46 insertions(+), 42 deletions(-) rename source/tests/{ => tf}/common.py (99%) rename source/tests/{ => tf}/compat_inputs/water_se_a_v0.json (100%) rename source/tests/{ => tf}/compat_inputs/water_se_a_v1.json (100%) rename source/tests/{ => tf}/compat_inputs/water_v0.json (100%) rename source/tests/{ => tf}/compat_inputs/water_v1.json (100%) rename source/tests/{ => tf}/compat_inputs/water_v2.json (100%) rename source/tests/{ => tf}/data_dp_mask/nopbc (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/aparam.npy (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/atom_pref.npy (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/box.npy (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/coord.npy (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/energy.npy (100%) rename source/tests/{ => tf}/data_dp_mask/set.000/force.npy (100%) rename source/tests/{ => tf}/data_dp_mask/type.raw (100%) rename source/tests/{ => tf}/data_dp_mask/type_map.raw (100%) rename source/tests/{ => tf}/data_modifier/dipole.json (100%) rename source/tests/{ => tf}/data_modifier/sys_10/set.000/atomic_dipole.npy (100%) rename source/tests/{ => tf}/data_modifier/sys_10/set.000/box.npy (100%) rename source/tests/{ => tf}/data_modifier/sys_10/set.000/coord.npy (100%) rename source/tests/{ => tf}/data_modifier/sys_10/set.000/energy.npy (100%) rename source/tests/{ => tf}/data_modifier/sys_10/set.000/force.npy (100%) rename source/tests/{ => tf}/data_modifier/sys_10/type.raw (100%) rename source/tests/{ => tf}/data_modifier/sys_10/type_map.raw (100%) rename source/tests/{ => tf}/finetune/data/set.000/box.npy (100%) rename source/tests/{ => tf}/finetune/data/set.000/coord.npy (100%) rename source/tests/{ => tf}/finetune/data/set.000/energy.npy (100%) rename source/tests/{ => tf}/finetune/data/set.000/force.npy (100%) rename source/tests/{ => tf}/finetune/data/type.raw (100%) rename source/tests/{ => tf}/finetune/data/type_map.raw (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/set.000/box.npy (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/set.000/coord.npy (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/set.000/energy.npy (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/set.000/force.npy (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/set.000/real_atom_types.npy (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/type.raw (100%) rename source/tests/{ => tf}/finetune/data_mixed_type/type_map.raw (100%) rename source/tests/{ => tf}/finetune/input_finetune.json (100%) rename source/tests/{ => tf}/finetune/input_pretrain.json (100%) rename source/tests/{ => tf}/init_frz_model/data/set.000/box.npy (100%) rename source/tests/{ => tf}/init_frz_model/data/set.000/coord.npy (100%) rename source/tests/{ => tf}/init_frz_model/data/set.000/energy.npy (100%) rename source/tests/{ => tf}/init_frz_model/data/set.000/force.npy (100%) rename source/tests/{ => tf}/init_frz_model/data/type.raw (100%) rename source/tests/{ => tf}/init_frz_model/data/type_map.raw (100%) rename source/tests/{ => tf}/init_frz_model/input.json (100%) rename source/tests/{ => tf}/model_compression/data/set.000/box.npy (100%) rename source/tests/{ => tf}/model_compression/data/set.000/coord.npy (100%) rename source/tests/{ => tf}/model_compression/data/set.000/energy.npy (100%) rename source/tests/{ => tf}/model_compression/data/set.000/force.npy (100%) rename source/tests/{ => tf}/model_compression/data/type.raw (100%) rename source/tests/{ => tf}/model_compression/data/type_map.raw (100%) rename source/tests/{ => tf}/model_compression/input.json (100%) rename source/tests/{ => tf}/model_spin/set.000/box.npy (100%) rename source/tests/{ => tf}/model_spin/set.000/coord.npy (100%) rename source/tests/{ => tf}/model_spin/set.000/energy.npy (100%) rename source/tests/{ => tf}/model_spin/set.000/force.npy (100%) rename source/tests/{ => tf}/model_spin/type.raw (100%) rename source/tests/{ => tf}/nvnmd/ref/box.npy (100%) rename source/tests/{ => tf}/nvnmd/ref/config_v0_cnn.npy (100%) rename source/tests/{ => tf}/nvnmd/ref/config_v1_cnn.npy (100%) rename source/tests/{ => tf}/nvnmd/ref/coord.npy (100%) rename source/tests/{ => tf}/nvnmd/ref/type.raw (100%) rename source/tests/{ => tf}/nvnmd/ref/weight_v0_cnn.npy (100%) rename source/tests/{ => tf}/nvnmd/ref/weight_v1_cnn.npy (100%) rename source/tests/{ => tf}/pairwise_dprc.json (100%) rename source/tests/{ => tf}/polar_se_a.json (100%) rename source/tests/{ => tf}/polar_se_a_tebd.json (100%) rename source/tests/{ => tf}/test.hdf5 (100%) rename source/tests/{ => tf}/test_activation_fn_gelu.py (100%) rename source/tests/{ => tf}/test_adjust_sel.py (100%) rename source/tests/{ => tf}/test_argument_parser.py (100%) rename source/tests/{ => tf}/test_auto_batch_size.py (100%) rename source/tests/{ => tf}/test_cluster.py (100%) rename source/tests/{ => tf}/test_common.py (100%) rename source/tests/{ => tf}/test_compat_input.py (100%) rename source/tests/{ => tf}/test_compressed_training.py (100%) rename source/tests/{ => tf}/test_data_large_batch.py (100%) rename source/tests/{ => tf}/test_data_modifier.py (100%) rename source/tests/{ => tf}/test_data_modifier_shuffle.py (100%) rename source/tests/{ => tf}/test_data_requirement.py (100%) rename source/tests/{ => tf}/test_deepdipole.py (98%) rename source/tests/{ => tf}/test_deepdos.py (99%) rename source/tests/{ => tf}/test_deepmd_data.py (100%) rename source/tests/{ => tf}/test_deepmd_data_sys.py (100%) rename source/tests/{ => tf}/test_deeppolar.py (99%) rename source/tests/{ => tf}/test_deeppot_a.py (98%) rename source/tests/{ => tf}/test_deeppot_r.py (98%) rename source/tests/{ => tf}/test_deeppot_spin.py (98%) rename source/tests/{ => tf}/test_descrpt_hybrid.py (100%) rename source/tests/{ => tf}/test_descrpt_nonsmth.py (100%) rename source/tests/{ => tf}/test_descrpt_se_a_mask.py (97%) rename source/tests/{ => tf}/test_descrpt_se_a_type.py (100%) rename source/tests/{ => tf}/test_descrpt_se_atten.py (100%) rename source/tests/{ => tf}/test_descrpt_se_r.py (100%) rename source/tests/{ => tf}/test_descrpt_sea_ef.py (100%) rename source/tests/{ => tf}/test_descrpt_sea_ef_para.py (100%) rename source/tests/{ => tf}/test_descrpt_sea_ef_rot.py (100%) rename source/tests/{ => tf}/test_descrpt_sea_ef_vert.py (100%) rename source/tests/{ => tf}/test_descrpt_smooth.py (100%) rename source/tests/{ => tf}/test_dipole_se_a.py (100%) rename source/tests/{ => tf}/test_dipole_se_a_tebd.py (100%) rename source/tests/{ => tf}/test_dipolecharge.py (98%) rename source/tests/{ => tf}/test_dp_test.py (97%) rename source/tests/{ => tf}/test_embedding_net.py (100%) rename source/tests/{ => tf}/test_env.py (100%) rename source/tests/{ => tf}/test_ewald.py (100%) rename source/tests/{ => tf}/test_examples.py (100%) rename source/tests/{ => tf}/test_finetune_se_atten.py (100%) rename source/tests/{ => tf}/test_fitting_dos.py (100%) rename source/tests/{ => tf}/test_fitting_ener_type.py (100%) rename source/tests/{ => tf}/test_fitting_stat.py (100%) rename source/tests/{ => tf}/test_gen_stat_data.py (100%) rename source/tests/{ => tf}/test_get_potential.py (100%) rename source/tests/{ => tf}/test_gui.py (100%) rename source/tests/{ => tf}/test_init_frz_model_multi.py (100%) rename source/tests/{ => tf}/test_init_frz_model_se_a.py (100%) rename source/tests/{ => tf}/test_init_frz_model_se_a_tebd.py (100%) rename source/tests/{ => tf}/test_init_frz_model_se_a_type.py (100%) rename source/tests/{ => tf}/test_init_frz_model_se_atten.py (100%) rename source/tests/{ => tf}/test_init_frz_model_se_r.py (100%) rename source/tests/{ => tf}/test_init_frz_model_spin.py (100%) rename source/tests/{ => tf}/test_lammps.py (100%) rename source/tests/{ => tf}/test_layer_name.py (100%) rename source/tests/{ => tf}/test_linear_model.py (100%) rename source/tests/{ => tf}/test_loss_gf.py (100%) rename source/tests/{ => tf}/test_mixed_prec_training.py (100%) rename source/tests/{ => tf}/test_model_compression_se_a.py (100%) rename source/tests/{ => tf}/test_model_compression_se_a_ebd.py (100%) rename source/tests/{ => tf}/test_model_compression_se_a_ebd_type_one_side.py (100%) rename source/tests/{ => tf}/test_model_compression_se_a_type_one_side_exclude_types.py (100%) rename source/tests/{ => tf}/test_model_compression_se_atten.py (100%) rename source/tests/{ => tf}/test_model_compression_se_r.py (100%) rename source/tests/{ => tf}/test_model_compression_se_t.py (100%) rename source/tests/{ => tf}/test_model_devi.py (100%) rename source/tests/{ => tf}/test_model_devi_mix.py (100%) rename source/tests/{ => tf}/test_model_dos.py (100%) rename source/tests/{ => tf}/test_model_format_utils.py (100%) rename source/tests/{ => tf}/test_model_loc_frame.py (100%) rename source/tests/{ => tf}/test_model_multi.py (100%) rename source/tests/{ => tf}/test_model_pairtab.py (100%) rename source/tests/{ => tf}/test_model_se_a.py (100%) rename source/tests/{ => tf}/test_model_se_a_aparam.py (100%) rename source/tests/{ => tf}/test_model_se_a_ebd.py (100%) rename source/tests/{ => tf}/test_model_se_a_ebd_v2.py (100%) rename source/tests/{ => tf}/test_model_se_a_fparam.py (100%) rename source/tests/{ => tf}/test_model_se_a_srtab.py (100%) rename source/tests/{ => tf}/test_model_se_a_type.py (100%) rename source/tests/{ => tf}/test_model_se_atten.py (100%) rename source/tests/{ => tf}/test_model_se_r.py (100%) rename source/tests/{ => tf}/test_model_se_t.py (100%) rename source/tests/{ => tf}/test_model_spin.json (100%) rename source/tests/{ => tf}/test_model_spin.py (100%) rename source/tests/{ => tf}/test_neighbor_stat.py (100%) rename source/tests/{ => tf}/test_nvnmd_entrypoints.py (100%) rename source/tests/{ => tf}/test_nvnmd_op.py (100%) rename source/tests/{ => tf}/test_output_def.py (100%) rename source/tests/{ => tf}/test_pairwise_dprc.py (100%) rename source/tests/{ => tf}/test_parallel_training.py (100%) rename source/tests/{ => tf}/test_polar_se_a.py (100%) rename source/tests/{ => tf}/test_polar_se_a_tebd.py (100%) rename source/tests/{ => tf}/test_prod_env_mat.py (100%) rename source/tests/{ => tf}/test_prod_force.py (100%) rename source/tests/{ => tf}/test_prod_force_grad.py (100%) rename source/tests/{ => tf}/test_prod_virial.py (100%) rename source/tests/{ => tf}/test_prod_virial_grad.py (100%) rename source/tests/{ => tf}/test_sel_idx.py (100%) rename source/tests/{ => tf}/test_tab_nonsmth.py (100%) rename source/tests/{ => tf}/test_tab_smooth.py (100%) rename source/tests/{ => tf}/test_tabulate.py (100%) rename source/tests/{ => tf}/test_train.py (100%) rename source/tests/{ => tf}/test_transfer.py (98%) rename source/tests/{ => tf}/test_type_embed.py (100%) rename source/tests/{ => tf}/test_type_one_side.py (100%) rename source/tests/{ => tf}/test_uni_infer.py (85%) rename source/tests/{ => tf}/test_virtual_type.py (97%) rename source/tests/{ => tf}/train_dos.json (100%) rename source/tests/{ => tf}/water.json (100%) rename source/tests/{ => tf}/water_hybrid.json (100%) rename source/tests/{ => tf}/water_layer_name.json (100%) rename source/tests/{ => tf}/water_multi.json (100%) rename source/tests/{ => tf}/water_se_a.json (100%) rename source/tests/{ => tf}/water_se_a_afparam.json (100%) rename source/tests/{ => tf}/water_se_a_aparam.json (100%) rename source/tests/{ => tf}/water_se_a_ebd.json (100%) rename source/tests/{ => tf}/water_se_a_fparam.json (100%) rename source/tests/{ => tf}/water_se_a_srtab.json (100%) rename source/tests/{ => tf}/water_se_a_type.json (100%) rename source/tests/{ => tf}/water_se_atten.json (100%) rename source/tests/{ => tf}/water_se_atten_compressible_mixed_type.json (100%) rename source/tests/{ => tf}/water_se_atten_mixed_type.json (100%) rename source/tests/{ => tf}/water_se_r.json (100%) rename source/tests/{ => tf}/water_se_t.json (100%) rename source/tests/{ => tf}/wfc.json (100%) rename source/tests/{ => tf}/yaml_inputs/water_se_a_v1.json (100%) rename source/tests/{ => tf}/yaml_inputs/water_se_a_v1.yaml (100%) rename source/tests/{ => tf}/yaml_inputs/water_v1.json (100%) rename source/tests/{ => tf}/yaml_inputs/water_v1.yaml (100%) rename source/tests/{ => tf}/zinc_se_a_mask.json (100%) diff --git a/source/tests/common.py b/source/tests/tf/common.py similarity index 99% rename from source/tests/common.py rename to source/tests/tf/common.py index cb68e4d46d..a83397c11c 100644 --- a/source/tests/common.py +++ b/source/tests/tf/common.py @@ -28,6 +28,7 @@ global_default_places = 5 tests_path = pathlib.Path(__file__).parent.absolute() +infer_path = (tests_path.parent / "infer").absolute() def j_loader(filename): diff --git a/source/tests/compat_inputs/water_se_a_v0.json b/source/tests/tf/compat_inputs/water_se_a_v0.json similarity index 100% rename from source/tests/compat_inputs/water_se_a_v0.json rename to source/tests/tf/compat_inputs/water_se_a_v0.json diff --git a/source/tests/compat_inputs/water_se_a_v1.json b/source/tests/tf/compat_inputs/water_se_a_v1.json similarity index 100% rename from source/tests/compat_inputs/water_se_a_v1.json rename to source/tests/tf/compat_inputs/water_se_a_v1.json diff --git a/source/tests/compat_inputs/water_v0.json b/source/tests/tf/compat_inputs/water_v0.json similarity index 100% rename from source/tests/compat_inputs/water_v0.json rename to source/tests/tf/compat_inputs/water_v0.json diff --git a/source/tests/compat_inputs/water_v1.json b/source/tests/tf/compat_inputs/water_v1.json similarity index 100% rename from source/tests/compat_inputs/water_v1.json rename to source/tests/tf/compat_inputs/water_v1.json diff --git a/source/tests/compat_inputs/water_v2.json b/source/tests/tf/compat_inputs/water_v2.json similarity index 100% rename from source/tests/compat_inputs/water_v2.json rename to source/tests/tf/compat_inputs/water_v2.json diff --git a/source/tests/data_dp_mask/nopbc b/source/tests/tf/data_dp_mask/nopbc similarity index 100% rename from source/tests/data_dp_mask/nopbc rename to source/tests/tf/data_dp_mask/nopbc diff --git a/source/tests/data_dp_mask/set.000/aparam.npy b/source/tests/tf/data_dp_mask/set.000/aparam.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/aparam.npy rename to source/tests/tf/data_dp_mask/set.000/aparam.npy diff --git a/source/tests/data_dp_mask/set.000/atom_pref.npy b/source/tests/tf/data_dp_mask/set.000/atom_pref.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/atom_pref.npy rename to source/tests/tf/data_dp_mask/set.000/atom_pref.npy diff --git a/source/tests/data_dp_mask/set.000/box.npy b/source/tests/tf/data_dp_mask/set.000/box.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/box.npy rename to source/tests/tf/data_dp_mask/set.000/box.npy diff --git a/source/tests/data_dp_mask/set.000/coord.npy b/source/tests/tf/data_dp_mask/set.000/coord.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/coord.npy rename to source/tests/tf/data_dp_mask/set.000/coord.npy diff --git a/source/tests/data_dp_mask/set.000/energy.npy b/source/tests/tf/data_dp_mask/set.000/energy.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/energy.npy rename to source/tests/tf/data_dp_mask/set.000/energy.npy diff --git a/source/tests/data_dp_mask/set.000/force.npy b/source/tests/tf/data_dp_mask/set.000/force.npy similarity index 100% rename from source/tests/data_dp_mask/set.000/force.npy rename to source/tests/tf/data_dp_mask/set.000/force.npy diff --git a/source/tests/data_dp_mask/type.raw b/source/tests/tf/data_dp_mask/type.raw similarity index 100% rename from source/tests/data_dp_mask/type.raw rename to source/tests/tf/data_dp_mask/type.raw diff --git a/source/tests/data_dp_mask/type_map.raw b/source/tests/tf/data_dp_mask/type_map.raw similarity index 100% rename from source/tests/data_dp_mask/type_map.raw rename to source/tests/tf/data_dp_mask/type_map.raw diff --git a/source/tests/data_modifier/dipole.json b/source/tests/tf/data_modifier/dipole.json similarity index 100% rename from source/tests/data_modifier/dipole.json rename to source/tests/tf/data_modifier/dipole.json diff --git a/source/tests/data_modifier/sys_10/set.000/atomic_dipole.npy b/source/tests/tf/data_modifier/sys_10/set.000/atomic_dipole.npy similarity index 100% rename from source/tests/data_modifier/sys_10/set.000/atomic_dipole.npy rename to source/tests/tf/data_modifier/sys_10/set.000/atomic_dipole.npy diff --git a/source/tests/data_modifier/sys_10/set.000/box.npy b/source/tests/tf/data_modifier/sys_10/set.000/box.npy similarity index 100% rename from source/tests/data_modifier/sys_10/set.000/box.npy rename to source/tests/tf/data_modifier/sys_10/set.000/box.npy diff --git a/source/tests/data_modifier/sys_10/set.000/coord.npy b/source/tests/tf/data_modifier/sys_10/set.000/coord.npy similarity index 100% rename from source/tests/data_modifier/sys_10/set.000/coord.npy rename to source/tests/tf/data_modifier/sys_10/set.000/coord.npy diff --git a/source/tests/data_modifier/sys_10/set.000/energy.npy b/source/tests/tf/data_modifier/sys_10/set.000/energy.npy similarity index 100% rename from source/tests/data_modifier/sys_10/set.000/energy.npy rename to source/tests/tf/data_modifier/sys_10/set.000/energy.npy diff --git a/source/tests/data_modifier/sys_10/set.000/force.npy b/source/tests/tf/data_modifier/sys_10/set.000/force.npy similarity index 100% rename from source/tests/data_modifier/sys_10/set.000/force.npy rename to source/tests/tf/data_modifier/sys_10/set.000/force.npy diff --git a/source/tests/data_modifier/sys_10/type.raw b/source/tests/tf/data_modifier/sys_10/type.raw similarity index 100% rename from source/tests/data_modifier/sys_10/type.raw rename to source/tests/tf/data_modifier/sys_10/type.raw diff --git a/source/tests/data_modifier/sys_10/type_map.raw b/source/tests/tf/data_modifier/sys_10/type_map.raw similarity index 100% rename from source/tests/data_modifier/sys_10/type_map.raw rename to source/tests/tf/data_modifier/sys_10/type_map.raw diff --git a/source/tests/finetune/data/set.000/box.npy b/source/tests/tf/finetune/data/set.000/box.npy similarity index 100% rename from source/tests/finetune/data/set.000/box.npy rename to source/tests/tf/finetune/data/set.000/box.npy diff --git a/source/tests/finetune/data/set.000/coord.npy b/source/tests/tf/finetune/data/set.000/coord.npy similarity index 100% rename from source/tests/finetune/data/set.000/coord.npy rename to source/tests/tf/finetune/data/set.000/coord.npy diff --git a/source/tests/finetune/data/set.000/energy.npy b/source/tests/tf/finetune/data/set.000/energy.npy similarity index 100% rename from source/tests/finetune/data/set.000/energy.npy rename to source/tests/tf/finetune/data/set.000/energy.npy diff --git a/source/tests/finetune/data/set.000/force.npy b/source/tests/tf/finetune/data/set.000/force.npy similarity index 100% rename from source/tests/finetune/data/set.000/force.npy rename to source/tests/tf/finetune/data/set.000/force.npy diff --git a/source/tests/finetune/data/type.raw b/source/tests/tf/finetune/data/type.raw similarity index 100% rename from source/tests/finetune/data/type.raw rename to source/tests/tf/finetune/data/type.raw diff --git a/source/tests/finetune/data/type_map.raw b/source/tests/tf/finetune/data/type_map.raw similarity index 100% rename from source/tests/finetune/data/type_map.raw rename to source/tests/tf/finetune/data/type_map.raw diff --git a/source/tests/finetune/data_mixed_type/set.000/box.npy b/source/tests/tf/finetune/data_mixed_type/set.000/box.npy similarity index 100% rename from source/tests/finetune/data_mixed_type/set.000/box.npy rename to source/tests/tf/finetune/data_mixed_type/set.000/box.npy diff --git a/source/tests/finetune/data_mixed_type/set.000/coord.npy b/source/tests/tf/finetune/data_mixed_type/set.000/coord.npy similarity index 100% rename from source/tests/finetune/data_mixed_type/set.000/coord.npy rename to source/tests/tf/finetune/data_mixed_type/set.000/coord.npy diff --git a/source/tests/finetune/data_mixed_type/set.000/energy.npy b/source/tests/tf/finetune/data_mixed_type/set.000/energy.npy similarity index 100% rename from source/tests/finetune/data_mixed_type/set.000/energy.npy rename to source/tests/tf/finetune/data_mixed_type/set.000/energy.npy diff --git a/source/tests/finetune/data_mixed_type/set.000/force.npy b/source/tests/tf/finetune/data_mixed_type/set.000/force.npy similarity index 100% rename from source/tests/finetune/data_mixed_type/set.000/force.npy rename to source/tests/tf/finetune/data_mixed_type/set.000/force.npy diff --git a/source/tests/finetune/data_mixed_type/set.000/real_atom_types.npy b/source/tests/tf/finetune/data_mixed_type/set.000/real_atom_types.npy similarity index 100% rename from source/tests/finetune/data_mixed_type/set.000/real_atom_types.npy rename to source/tests/tf/finetune/data_mixed_type/set.000/real_atom_types.npy diff --git a/source/tests/finetune/data_mixed_type/type.raw b/source/tests/tf/finetune/data_mixed_type/type.raw similarity index 100% rename from source/tests/finetune/data_mixed_type/type.raw rename to source/tests/tf/finetune/data_mixed_type/type.raw diff --git a/source/tests/finetune/data_mixed_type/type_map.raw b/source/tests/tf/finetune/data_mixed_type/type_map.raw similarity index 100% rename from source/tests/finetune/data_mixed_type/type_map.raw rename to source/tests/tf/finetune/data_mixed_type/type_map.raw diff --git a/source/tests/finetune/input_finetune.json b/source/tests/tf/finetune/input_finetune.json similarity index 100% rename from source/tests/finetune/input_finetune.json rename to source/tests/tf/finetune/input_finetune.json diff --git a/source/tests/finetune/input_pretrain.json b/source/tests/tf/finetune/input_pretrain.json similarity index 100% rename from source/tests/finetune/input_pretrain.json rename to source/tests/tf/finetune/input_pretrain.json diff --git a/source/tests/init_frz_model/data/set.000/box.npy b/source/tests/tf/init_frz_model/data/set.000/box.npy similarity index 100% rename from source/tests/init_frz_model/data/set.000/box.npy rename to source/tests/tf/init_frz_model/data/set.000/box.npy diff --git a/source/tests/init_frz_model/data/set.000/coord.npy b/source/tests/tf/init_frz_model/data/set.000/coord.npy similarity index 100% rename from source/tests/init_frz_model/data/set.000/coord.npy rename to source/tests/tf/init_frz_model/data/set.000/coord.npy diff --git a/source/tests/init_frz_model/data/set.000/energy.npy b/source/tests/tf/init_frz_model/data/set.000/energy.npy similarity index 100% rename from source/tests/init_frz_model/data/set.000/energy.npy rename to source/tests/tf/init_frz_model/data/set.000/energy.npy diff --git a/source/tests/init_frz_model/data/set.000/force.npy b/source/tests/tf/init_frz_model/data/set.000/force.npy similarity index 100% rename from source/tests/init_frz_model/data/set.000/force.npy rename to source/tests/tf/init_frz_model/data/set.000/force.npy diff --git a/source/tests/init_frz_model/data/type.raw b/source/tests/tf/init_frz_model/data/type.raw similarity index 100% rename from source/tests/init_frz_model/data/type.raw rename to source/tests/tf/init_frz_model/data/type.raw diff --git a/source/tests/init_frz_model/data/type_map.raw b/source/tests/tf/init_frz_model/data/type_map.raw similarity index 100% rename from source/tests/init_frz_model/data/type_map.raw rename to source/tests/tf/init_frz_model/data/type_map.raw diff --git a/source/tests/init_frz_model/input.json b/source/tests/tf/init_frz_model/input.json similarity index 100% rename from source/tests/init_frz_model/input.json rename to source/tests/tf/init_frz_model/input.json diff --git a/source/tests/model_compression/data/set.000/box.npy b/source/tests/tf/model_compression/data/set.000/box.npy similarity index 100% rename from source/tests/model_compression/data/set.000/box.npy rename to source/tests/tf/model_compression/data/set.000/box.npy diff --git a/source/tests/model_compression/data/set.000/coord.npy b/source/tests/tf/model_compression/data/set.000/coord.npy similarity index 100% rename from source/tests/model_compression/data/set.000/coord.npy rename to source/tests/tf/model_compression/data/set.000/coord.npy diff --git a/source/tests/model_compression/data/set.000/energy.npy b/source/tests/tf/model_compression/data/set.000/energy.npy similarity index 100% rename from source/tests/model_compression/data/set.000/energy.npy rename to source/tests/tf/model_compression/data/set.000/energy.npy diff --git a/source/tests/model_compression/data/set.000/force.npy b/source/tests/tf/model_compression/data/set.000/force.npy similarity index 100% rename from source/tests/model_compression/data/set.000/force.npy rename to source/tests/tf/model_compression/data/set.000/force.npy diff --git a/source/tests/model_compression/data/type.raw b/source/tests/tf/model_compression/data/type.raw similarity index 100% rename from source/tests/model_compression/data/type.raw rename to source/tests/tf/model_compression/data/type.raw diff --git a/source/tests/model_compression/data/type_map.raw b/source/tests/tf/model_compression/data/type_map.raw similarity index 100% rename from source/tests/model_compression/data/type_map.raw rename to source/tests/tf/model_compression/data/type_map.raw diff --git a/source/tests/model_compression/input.json b/source/tests/tf/model_compression/input.json similarity index 100% rename from source/tests/model_compression/input.json rename to source/tests/tf/model_compression/input.json diff --git a/source/tests/model_spin/set.000/box.npy b/source/tests/tf/model_spin/set.000/box.npy similarity index 100% rename from source/tests/model_spin/set.000/box.npy rename to source/tests/tf/model_spin/set.000/box.npy diff --git a/source/tests/model_spin/set.000/coord.npy b/source/tests/tf/model_spin/set.000/coord.npy similarity index 100% rename from source/tests/model_spin/set.000/coord.npy rename to source/tests/tf/model_spin/set.000/coord.npy diff --git a/source/tests/model_spin/set.000/energy.npy b/source/tests/tf/model_spin/set.000/energy.npy similarity index 100% rename from source/tests/model_spin/set.000/energy.npy rename to source/tests/tf/model_spin/set.000/energy.npy diff --git a/source/tests/model_spin/set.000/force.npy b/source/tests/tf/model_spin/set.000/force.npy similarity index 100% rename from source/tests/model_spin/set.000/force.npy rename to source/tests/tf/model_spin/set.000/force.npy diff --git a/source/tests/model_spin/type.raw b/source/tests/tf/model_spin/type.raw similarity index 100% rename from source/tests/model_spin/type.raw rename to source/tests/tf/model_spin/type.raw diff --git a/source/tests/nvnmd/ref/box.npy b/source/tests/tf/nvnmd/ref/box.npy similarity index 100% rename from source/tests/nvnmd/ref/box.npy rename to source/tests/tf/nvnmd/ref/box.npy diff --git a/source/tests/nvnmd/ref/config_v0_cnn.npy b/source/tests/tf/nvnmd/ref/config_v0_cnn.npy similarity index 100% rename from source/tests/nvnmd/ref/config_v0_cnn.npy rename to source/tests/tf/nvnmd/ref/config_v0_cnn.npy diff --git a/source/tests/nvnmd/ref/config_v1_cnn.npy b/source/tests/tf/nvnmd/ref/config_v1_cnn.npy similarity index 100% rename from source/tests/nvnmd/ref/config_v1_cnn.npy rename to source/tests/tf/nvnmd/ref/config_v1_cnn.npy diff --git a/source/tests/nvnmd/ref/coord.npy b/source/tests/tf/nvnmd/ref/coord.npy similarity index 100% rename from source/tests/nvnmd/ref/coord.npy rename to source/tests/tf/nvnmd/ref/coord.npy diff --git a/source/tests/nvnmd/ref/type.raw b/source/tests/tf/nvnmd/ref/type.raw similarity index 100% rename from source/tests/nvnmd/ref/type.raw rename to source/tests/tf/nvnmd/ref/type.raw diff --git a/source/tests/nvnmd/ref/weight_v0_cnn.npy b/source/tests/tf/nvnmd/ref/weight_v0_cnn.npy similarity index 100% rename from source/tests/nvnmd/ref/weight_v0_cnn.npy rename to source/tests/tf/nvnmd/ref/weight_v0_cnn.npy diff --git a/source/tests/nvnmd/ref/weight_v1_cnn.npy b/source/tests/tf/nvnmd/ref/weight_v1_cnn.npy similarity index 100% rename from source/tests/nvnmd/ref/weight_v1_cnn.npy rename to source/tests/tf/nvnmd/ref/weight_v1_cnn.npy diff --git a/source/tests/pairwise_dprc.json b/source/tests/tf/pairwise_dprc.json similarity index 100% rename from source/tests/pairwise_dprc.json rename to source/tests/tf/pairwise_dprc.json diff --git a/source/tests/polar_se_a.json b/source/tests/tf/polar_se_a.json similarity index 100% rename from source/tests/polar_se_a.json rename to source/tests/tf/polar_se_a.json diff --git a/source/tests/polar_se_a_tebd.json b/source/tests/tf/polar_se_a_tebd.json similarity index 100% rename from source/tests/polar_se_a_tebd.json rename to source/tests/tf/polar_se_a_tebd.json diff --git a/source/tests/test.hdf5 b/source/tests/tf/test.hdf5 similarity index 100% rename from source/tests/test.hdf5 rename to source/tests/tf/test.hdf5 diff --git a/source/tests/test_activation_fn_gelu.py b/source/tests/tf/test_activation_fn_gelu.py similarity index 100% rename from source/tests/test_activation_fn_gelu.py rename to source/tests/tf/test_activation_fn_gelu.py diff --git a/source/tests/test_adjust_sel.py b/source/tests/tf/test_adjust_sel.py similarity index 100% rename from source/tests/test_adjust_sel.py rename to source/tests/tf/test_adjust_sel.py diff --git a/source/tests/test_argument_parser.py b/source/tests/tf/test_argument_parser.py similarity index 100% rename from source/tests/test_argument_parser.py rename to source/tests/tf/test_argument_parser.py diff --git a/source/tests/test_auto_batch_size.py b/source/tests/tf/test_auto_batch_size.py similarity index 100% rename from source/tests/test_auto_batch_size.py rename to source/tests/tf/test_auto_batch_size.py diff --git a/source/tests/test_cluster.py b/source/tests/tf/test_cluster.py similarity index 100% rename from source/tests/test_cluster.py rename to source/tests/tf/test_cluster.py diff --git a/source/tests/test_common.py b/source/tests/tf/test_common.py similarity index 100% rename from source/tests/test_common.py rename to source/tests/tf/test_common.py diff --git a/source/tests/test_compat_input.py b/source/tests/tf/test_compat_input.py similarity index 100% rename from source/tests/test_compat_input.py rename to source/tests/tf/test_compat_input.py diff --git a/source/tests/test_compressed_training.py b/source/tests/tf/test_compressed_training.py similarity index 100% rename from source/tests/test_compressed_training.py rename to source/tests/tf/test_compressed_training.py diff --git a/source/tests/test_data_large_batch.py b/source/tests/tf/test_data_large_batch.py similarity index 100% rename from source/tests/test_data_large_batch.py rename to source/tests/tf/test_data_large_batch.py diff --git a/source/tests/test_data_modifier.py b/source/tests/tf/test_data_modifier.py similarity index 100% rename from source/tests/test_data_modifier.py rename to source/tests/tf/test_data_modifier.py diff --git a/source/tests/test_data_modifier_shuffle.py b/source/tests/tf/test_data_modifier_shuffle.py similarity index 100% rename from source/tests/test_data_modifier_shuffle.py rename to source/tests/tf/test_data_modifier_shuffle.py diff --git a/source/tests/test_data_requirement.py b/source/tests/tf/test_data_requirement.py similarity index 100% rename from source/tests/test_data_requirement.py rename to source/tests/tf/test_data_requirement.py diff --git a/source/tests/test_deepdipole.py b/source/tests/tf/test_deepdipole.py similarity index 98% rename from source/tests/test_deepdipole.py rename to source/tests/tf/test_deepdipole.py index 6dffe59fe5..13408bc61c 100644 --- a/source/tests/test_deepdipole.py +++ b/source/tests/tf/test_deepdipole.py @@ -6,8 +6,8 @@ import numpy as np from common import ( finite_difference, + infer_path, strerch_box, - tests_path, tf, ) from packaging.version import parse as parse_version @@ -32,7 +32,7 @@ class TestDeepDipolePBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole.pbtxt")), "deepdipole.pb" + str(infer_path / os.path.join("deepdipole.pbtxt")), "deepdipole.pb" ) cls.dp = DeepDipole("deepdipole.pb") @@ -111,7 +111,7 @@ class TestDeepDipoleNoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole.pbtxt")), "deepdipole.pb" + str(infer_path / os.path.join("deepdipole.pbtxt")), "deepdipole.pb" ) cls.dp = DeepDipole("deepdipole.pb") @@ -185,7 +185,7 @@ class TestDeepDipoleNewPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole_new.pbtxt")), + str(infer_path / os.path.join("deepdipole_new.pbtxt")), "deepdipole_new.pb", ) cls.dp = DeepDipole("deepdipole_new.pb") @@ -656,7 +656,7 @@ class TestDeepDipoleFakePBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole_fake.pbtxt")), + str(infer_path / os.path.join("deepdipole_fake.pbtxt")), "deepdipole_fake.pb", ) cls.dp = DeepDipole("deepdipole_fake.pb") @@ -1042,7 +1042,7 @@ class TestDeepDipoleNewPBCNeighborList(TestDeepDipoleNewPBC): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole_new.pbtxt")), + str(infer_path / os.path.join("deepdipole_new.pbtxt")), "deepdipole_new.pb", ) cls.dp = DeepDipole( diff --git a/source/tests/test_deepdos.py b/source/tests/tf/test_deepdos.py similarity index 99% rename from source/tests/test_deepdos.py rename to source/tests/tf/test_deepdos.py index 3f3d0cda7f..f4980d4d1a 100644 --- a/source/tests/test_deepdos.py +++ b/source/tests/tf/test_deepdos.py @@ -4,7 +4,7 @@ import numpy as np from common import ( - tests_path, + infer_path, ) from deepmd.tf.env import ( @@ -27,7 +27,7 @@ class TestDeepDOS(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdos.pbtxt")), "deepdos.pb" + str(infer_path / os.path.join("deepdos.pbtxt")), "deepdos.pb" ) cls.dp = DeepDOS("deepdos.pb") diff --git a/source/tests/test_deepmd_data.py b/source/tests/tf/test_deepmd_data.py similarity index 100% rename from source/tests/test_deepmd_data.py rename to source/tests/tf/test_deepmd_data.py diff --git a/source/tests/test_deepmd_data_sys.py b/source/tests/tf/test_deepmd_data_sys.py similarity index 100% rename from source/tests/test_deepmd_data_sys.py rename to source/tests/tf/test_deepmd_data_sys.py diff --git a/source/tests/test_deeppolar.py b/source/tests/tf/test_deeppolar.py similarity index 99% rename from source/tests/test_deeppolar.py rename to source/tests/tf/test_deeppolar.py index 18d9cb4ad9..45b420f11a 100644 --- a/source/tests/test_deeppolar.py +++ b/source/tests/tf/test_deeppolar.py @@ -5,7 +5,7 @@ import ase.neighborlist import numpy as np from common import ( - tests_path, + infer_path, tf, ) from packaging.version import parse as parse_version @@ -30,7 +30,7 @@ class TestDeepPolarPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppolar.pbtxt")), "deeppolar.pb" + str(infer_path / os.path.join("deeppolar.pbtxt")), "deeppolar.pb" ) cls.dp = DeepPolar("deeppolar.pb") @@ -121,7 +121,7 @@ class TestDeepPolarNoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppolar.pbtxt")), "deeppolar.pb" + str(infer_path / os.path.join("deeppolar.pbtxt")), "deeppolar.pb" ) cls.dp = DeepPolar("deeppolar.pb") @@ -207,7 +207,7 @@ class TestDeepPolarNewPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppolar_new.pbtxt")), + str(infer_path / os.path.join("deeppolar_new.pbtxt")), "deeppolar_new.pb", ) cls.dp = DeepPolar("deeppolar_new.pb") @@ -1093,7 +1093,7 @@ class TestDeepPolarNewPBCNeighborList(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppolar_new.pbtxt")), + str(infer_path / os.path.join("deeppolar_new.pbtxt")), "deeppolar_new.pb", ) cls.dp = DeepPolar( diff --git a/source/tests/test_deeppot_a.py b/source/tests/tf/test_deeppot_a.py similarity index 98% rename from source/tests/test_deeppot_a.py rename to source/tests/tf/test_deeppot_a.py index 32e92cd8bd..3e3b4e1385 100644 --- a/source/tests/test_deeppot_a.py +++ b/source/tests/tf/test_deeppot_a.py @@ -7,6 +7,7 @@ import dpdata import numpy as np from common import ( + infer_path, run_dp, tests_path, ) @@ -38,7 +39,7 @@ class TestModelMajorCompatability(unittest.TestCase): def setUp(self): - model_file = str(tests_path / os.path.join("infer", "deeppot.pbtxt")) + model_file = str(infer_path / os.path.join("deeppot.pbtxt")) with open(model_file) as fp: # data = fp.read().replace('\n', '') data = fp.read().split("\n") @@ -68,7 +69,7 @@ def test(self): class TestModelMinorCompatability(unittest.TestCase): def setUp(self): - model_file = str(tests_path / os.path.join("infer", "deeppot.pbtxt")) + model_file = str(infer_path / os.path.join("deeppot.pbtxt")) with open(model_file) as fp: # data = fp.read().replace('\n', '') data = fp.read().split("\n") @@ -100,7 +101,7 @@ class TestDeepPotAPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") @@ -327,7 +328,7 @@ class TestDeepPotANoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") @@ -550,7 +551,7 @@ class TestDeepPotALargeBoxNoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") @@ -857,7 +858,7 @@ class TestTypeEmbed(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "se_e2_a_tebd.pbtxt")), + str(infer_path / os.path.join("se_e2_a_tebd.pbtxt")), "se_e2_a_tebd.pb", ) cls.dp = DeepPot("se_e2_a_tebd.pb") @@ -898,7 +899,7 @@ class TestFparamAparam(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "fparam_aparam.pbtxt")), + str(infer_path / os.path.join("fparam_aparam.pbtxt")), "fparam_aparam.pb", ) cls.dp = DeepPot("fparam_aparam.pb") @@ -1155,7 +1156,7 @@ class TestDeepPotAPBCNeighborList(TestDeepPotAPBC): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot( "deeppot.pb", diff --git a/source/tests/test_deeppot_r.py b/source/tests/tf/test_deeppot_r.py similarity index 98% rename from source/tests/test_deeppot_r.py rename to source/tests/tf/test_deeppot_r.py index 47f957d2cd..e345ddd94e 100644 --- a/source/tests/test_deeppot_r.py +++ b/source/tests/tf/test_deeppot_r.py @@ -4,7 +4,7 @@ import numpy as np from common import ( - tests_path, + infer_path, ) from deepmd.tf.env import ( @@ -28,7 +28,7 @@ class TestDeepPotRPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot-r.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot-r.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") @@ -239,7 +239,7 @@ class TestDeepPotRNoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot-r.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot-r.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") @@ -453,7 +453,7 @@ class TestDeepPotRLargeBoxNoPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot-r.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot-r.pbtxt")), "deeppot.pb" ) cls.dp = DeepPot("deeppot.pb") diff --git a/source/tests/test_deeppot_spin.py b/source/tests/tf/test_deeppot_spin.py similarity index 98% rename from source/tests/test_deeppot_spin.py rename to source/tests/tf/test_deeppot_spin.py index b390fe6c79..b1d99b57dd 100644 --- a/source/tests/test_deeppot_spin.py +++ b/source/tests/tf/test_deeppot_spin.py @@ -4,7 +4,7 @@ import numpy as np from common import ( - tests_path, + infer_path, ) from deepmd.tf.env import ( @@ -27,7 +27,7 @@ class TestDeepPotAPBC(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepspin.pbtxt")), "deepspin.pb" + str(infer_path / os.path.join("deepspin.pbtxt")), "deepspin.pb" ) cls.dp = DeepPot("deepspin.pb") diff --git a/source/tests/test_descrpt_hybrid.py b/source/tests/tf/test_descrpt_hybrid.py similarity index 100% rename from source/tests/test_descrpt_hybrid.py rename to source/tests/tf/test_descrpt_hybrid.py diff --git a/source/tests/test_descrpt_nonsmth.py b/source/tests/tf/test_descrpt_nonsmth.py similarity index 100% rename from source/tests/test_descrpt_nonsmth.py rename to source/tests/tf/test_descrpt_nonsmth.py diff --git a/source/tests/test_descrpt_se_a_mask.py b/source/tests/tf/test_descrpt_se_a_mask.py similarity index 97% rename from source/tests/test_descrpt_se_a_mask.py rename to source/tests/tf/test_descrpt_se_a_mask.py index b35bc75b04..8d4dd66ee1 100644 --- a/source/tests/test_descrpt_se_a_mask.py +++ b/source/tests/tf/test_descrpt_se_a_mask.py @@ -5,6 +5,7 @@ import numpy as np from common import ( DataSystem, + infer_path, j_loader, ) @@ -35,10 +36,10 @@ class TestModel(tf.test.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "dp4mask.pbtxt")), - str(tests_path / os.path.join("infer", "dp4mask.pb")), + str(infer_path / os.path.join("dp4mask.pbtxt")), + str(infer_path / os.path.join("dp4mask.pb")), ) - cls.dp = DeepPot(str(tests_path / os.path.join("infer", "dp4mask.pb"))) + cls.dp = DeepPot(str(infer_path / os.path.join("dp4mask.pb"))) def test_dp_mask_model(self): dcoord = np.array( diff --git a/source/tests/test_descrpt_se_a_type.py b/source/tests/tf/test_descrpt_se_a_type.py similarity index 100% rename from source/tests/test_descrpt_se_a_type.py rename to source/tests/tf/test_descrpt_se_a_type.py diff --git a/source/tests/test_descrpt_se_atten.py b/source/tests/tf/test_descrpt_se_atten.py similarity index 100% rename from source/tests/test_descrpt_se_atten.py rename to source/tests/tf/test_descrpt_se_atten.py diff --git a/source/tests/test_descrpt_se_r.py b/source/tests/tf/test_descrpt_se_r.py similarity index 100% rename from source/tests/test_descrpt_se_r.py rename to source/tests/tf/test_descrpt_se_r.py diff --git a/source/tests/test_descrpt_sea_ef.py b/source/tests/tf/test_descrpt_sea_ef.py similarity index 100% rename from source/tests/test_descrpt_sea_ef.py rename to source/tests/tf/test_descrpt_sea_ef.py diff --git a/source/tests/test_descrpt_sea_ef_para.py b/source/tests/tf/test_descrpt_sea_ef_para.py similarity index 100% rename from source/tests/test_descrpt_sea_ef_para.py rename to source/tests/tf/test_descrpt_sea_ef_para.py diff --git a/source/tests/test_descrpt_sea_ef_rot.py b/source/tests/tf/test_descrpt_sea_ef_rot.py similarity index 100% rename from source/tests/test_descrpt_sea_ef_rot.py rename to source/tests/tf/test_descrpt_sea_ef_rot.py diff --git a/source/tests/test_descrpt_sea_ef_vert.py b/source/tests/tf/test_descrpt_sea_ef_vert.py similarity index 100% rename from source/tests/test_descrpt_sea_ef_vert.py rename to source/tests/tf/test_descrpt_sea_ef_vert.py diff --git a/source/tests/test_descrpt_smooth.py b/source/tests/tf/test_descrpt_smooth.py similarity index 100% rename from source/tests/test_descrpt_smooth.py rename to source/tests/tf/test_descrpt_smooth.py diff --git a/source/tests/test_dipole_se_a.py b/source/tests/tf/test_dipole_se_a.py similarity index 100% rename from source/tests/test_dipole_se_a.py rename to source/tests/tf/test_dipole_se_a.py diff --git a/source/tests/test_dipole_se_a_tebd.py b/source/tests/tf/test_dipole_se_a_tebd.py similarity index 100% rename from source/tests/test_dipole_se_a_tebd.py rename to source/tests/tf/test_dipole_se_a_tebd.py diff --git a/source/tests/test_dipolecharge.py b/source/tests/tf/test_dipolecharge.py similarity index 98% rename from source/tests/test_dipolecharge.py rename to source/tests/tf/test_dipolecharge.py index e435eb431a..0c6d0a54b7 100644 --- a/source/tests/test_dipolecharge.py +++ b/source/tests/tf/test_dipolecharge.py @@ -4,7 +4,7 @@ import numpy as np from common import ( - tests_path, + infer_path, ) from deepmd.tf.env import ( @@ -27,7 +27,7 @@ class TestDipoleCharge(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "dipolecharge_d.pbtxt")), + str(infer_path / os.path.join("dipolecharge_d.pbtxt")), "dipolecharge_d.pb", ) cls.dp = DipoleChargeModifier( diff --git a/source/tests/test_dp_test.py b/source/tests/tf/test_dp_test.py similarity index 97% rename from source/tests/test_dp_test.py rename to source/tests/tf/test_dp_test.py index 978cd95804..ce1f683b7c 100644 --- a/source/tests/test_dp_test.py +++ b/source/tests/tf/test_dp_test.py @@ -9,7 +9,7 @@ import dpdata import numpy as np from common import ( - tests_path, + infer_path, ) from deepmd.tf.entrypoints.test import test as dp_test @@ -71,7 +71,7 @@ class TestDPTestEner(unittest.TestCase, TestDPTest): def setUpClass(cls): cls.model_name = "deeppot.pb" convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), cls.model_name + str(infer_path / os.path.join("deeppot.pbtxt")), cls.model_name ) def setUp(self): @@ -207,7 +207,7 @@ class TestDPTestDipole(unittest.TestCase, TestDPTest): def setUpClass(cls): cls.model_name = "deepdipole.pb" convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deepdipole.pbtxt")), cls.model_name + str(infer_path / os.path.join("deepdipole.pbtxt")), cls.model_name ) def setUp(self): @@ -266,7 +266,7 @@ class TestDPTestPolar(unittest.TestCase, TestDPTest): def setUpClass(cls): cls.model_name = "deeppolar.pb" convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppolar.pbtxt")), cls.model_name + str(infer_path / os.path.join("deeppolar.pbtxt")), cls.model_name ) def setUp(self): diff --git a/source/tests/test_embedding_net.py b/source/tests/tf/test_embedding_net.py similarity index 100% rename from source/tests/test_embedding_net.py rename to source/tests/tf/test_embedding_net.py diff --git a/source/tests/test_env.py b/source/tests/tf/test_env.py similarity index 100% rename from source/tests/test_env.py rename to source/tests/tf/test_env.py diff --git a/source/tests/test_ewald.py b/source/tests/tf/test_ewald.py similarity index 100% rename from source/tests/test_ewald.py rename to source/tests/tf/test_ewald.py diff --git a/source/tests/test_examples.py b/source/tests/tf/test_examples.py similarity index 100% rename from source/tests/test_examples.py rename to source/tests/tf/test_examples.py diff --git a/source/tests/test_finetune_se_atten.py b/source/tests/tf/test_finetune_se_atten.py similarity index 100% rename from source/tests/test_finetune_se_atten.py rename to source/tests/tf/test_finetune_se_atten.py diff --git a/source/tests/test_fitting_dos.py b/source/tests/tf/test_fitting_dos.py similarity index 100% rename from source/tests/test_fitting_dos.py rename to source/tests/tf/test_fitting_dos.py diff --git a/source/tests/test_fitting_ener_type.py b/source/tests/tf/test_fitting_ener_type.py similarity index 100% rename from source/tests/test_fitting_ener_type.py rename to source/tests/tf/test_fitting_ener_type.py diff --git a/source/tests/test_fitting_stat.py b/source/tests/tf/test_fitting_stat.py similarity index 100% rename from source/tests/test_fitting_stat.py rename to source/tests/tf/test_fitting_stat.py diff --git a/source/tests/test_gen_stat_data.py b/source/tests/tf/test_gen_stat_data.py similarity index 100% rename from source/tests/test_gen_stat_data.py rename to source/tests/tf/test_gen_stat_data.py diff --git a/source/tests/test_get_potential.py b/source/tests/tf/test_get_potential.py similarity index 100% rename from source/tests/test_get_potential.py rename to source/tests/tf/test_get_potential.py diff --git a/source/tests/test_gui.py b/source/tests/tf/test_gui.py similarity index 100% rename from source/tests/test_gui.py rename to source/tests/tf/test_gui.py diff --git a/source/tests/test_init_frz_model_multi.py b/source/tests/tf/test_init_frz_model_multi.py similarity index 100% rename from source/tests/test_init_frz_model_multi.py rename to source/tests/tf/test_init_frz_model_multi.py diff --git a/source/tests/test_init_frz_model_se_a.py b/source/tests/tf/test_init_frz_model_se_a.py similarity index 100% rename from source/tests/test_init_frz_model_se_a.py rename to source/tests/tf/test_init_frz_model_se_a.py diff --git a/source/tests/test_init_frz_model_se_a_tebd.py b/source/tests/tf/test_init_frz_model_se_a_tebd.py similarity index 100% rename from source/tests/test_init_frz_model_se_a_tebd.py rename to source/tests/tf/test_init_frz_model_se_a_tebd.py diff --git a/source/tests/test_init_frz_model_se_a_type.py b/source/tests/tf/test_init_frz_model_se_a_type.py similarity index 100% rename from source/tests/test_init_frz_model_se_a_type.py rename to source/tests/tf/test_init_frz_model_se_a_type.py diff --git a/source/tests/test_init_frz_model_se_atten.py b/source/tests/tf/test_init_frz_model_se_atten.py similarity index 100% rename from source/tests/test_init_frz_model_se_atten.py rename to source/tests/tf/test_init_frz_model_se_atten.py diff --git a/source/tests/test_init_frz_model_se_r.py b/source/tests/tf/test_init_frz_model_se_r.py similarity index 100% rename from source/tests/test_init_frz_model_se_r.py rename to source/tests/tf/test_init_frz_model_se_r.py diff --git a/source/tests/test_init_frz_model_spin.py b/source/tests/tf/test_init_frz_model_spin.py similarity index 100% rename from source/tests/test_init_frz_model_spin.py rename to source/tests/tf/test_init_frz_model_spin.py diff --git a/source/tests/test_lammps.py b/source/tests/tf/test_lammps.py similarity index 100% rename from source/tests/test_lammps.py rename to source/tests/tf/test_lammps.py diff --git a/source/tests/test_layer_name.py b/source/tests/tf/test_layer_name.py similarity index 100% rename from source/tests/test_layer_name.py rename to source/tests/tf/test_layer_name.py diff --git a/source/tests/test_linear_model.py b/source/tests/tf/test_linear_model.py similarity index 100% rename from source/tests/test_linear_model.py rename to source/tests/tf/test_linear_model.py diff --git a/source/tests/test_loss_gf.py b/source/tests/tf/test_loss_gf.py similarity index 100% rename from source/tests/test_loss_gf.py rename to source/tests/tf/test_loss_gf.py diff --git a/source/tests/test_mixed_prec_training.py b/source/tests/tf/test_mixed_prec_training.py similarity index 100% rename from source/tests/test_mixed_prec_training.py rename to source/tests/tf/test_mixed_prec_training.py diff --git a/source/tests/test_model_compression_se_a.py b/source/tests/tf/test_model_compression_se_a.py similarity index 100% rename from source/tests/test_model_compression_se_a.py rename to source/tests/tf/test_model_compression_se_a.py diff --git a/source/tests/test_model_compression_se_a_ebd.py b/source/tests/tf/test_model_compression_se_a_ebd.py similarity index 100% rename from source/tests/test_model_compression_se_a_ebd.py rename to source/tests/tf/test_model_compression_se_a_ebd.py diff --git a/source/tests/test_model_compression_se_a_ebd_type_one_side.py b/source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py similarity index 100% rename from source/tests/test_model_compression_se_a_ebd_type_one_side.py rename to source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py diff --git a/source/tests/test_model_compression_se_a_type_one_side_exclude_types.py b/source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py similarity index 100% rename from source/tests/test_model_compression_se_a_type_one_side_exclude_types.py rename to source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py diff --git a/source/tests/test_model_compression_se_atten.py b/source/tests/tf/test_model_compression_se_atten.py similarity index 100% rename from source/tests/test_model_compression_se_atten.py rename to source/tests/tf/test_model_compression_se_atten.py diff --git a/source/tests/test_model_compression_se_r.py b/source/tests/tf/test_model_compression_se_r.py similarity index 100% rename from source/tests/test_model_compression_se_r.py rename to source/tests/tf/test_model_compression_se_r.py diff --git a/source/tests/test_model_compression_se_t.py b/source/tests/tf/test_model_compression_se_t.py similarity index 100% rename from source/tests/test_model_compression_se_t.py rename to source/tests/tf/test_model_compression_se_t.py diff --git a/source/tests/test_model_devi.py b/source/tests/tf/test_model_devi.py similarity index 100% rename from source/tests/test_model_devi.py rename to source/tests/tf/test_model_devi.py diff --git a/source/tests/test_model_devi_mix.py b/source/tests/tf/test_model_devi_mix.py similarity index 100% rename from source/tests/test_model_devi_mix.py rename to source/tests/tf/test_model_devi_mix.py diff --git a/source/tests/test_model_dos.py b/source/tests/tf/test_model_dos.py similarity index 100% rename from source/tests/test_model_dos.py rename to source/tests/tf/test_model_dos.py diff --git a/source/tests/test_model_format_utils.py b/source/tests/tf/test_model_format_utils.py similarity index 100% rename from source/tests/test_model_format_utils.py rename to source/tests/tf/test_model_format_utils.py diff --git a/source/tests/test_model_loc_frame.py b/source/tests/tf/test_model_loc_frame.py similarity index 100% rename from source/tests/test_model_loc_frame.py rename to source/tests/tf/test_model_loc_frame.py diff --git a/source/tests/test_model_multi.py b/source/tests/tf/test_model_multi.py similarity index 100% rename from source/tests/test_model_multi.py rename to source/tests/tf/test_model_multi.py diff --git a/source/tests/test_model_pairtab.py b/source/tests/tf/test_model_pairtab.py similarity index 100% rename from source/tests/test_model_pairtab.py rename to source/tests/tf/test_model_pairtab.py diff --git a/source/tests/test_model_se_a.py b/source/tests/tf/test_model_se_a.py similarity index 100% rename from source/tests/test_model_se_a.py rename to source/tests/tf/test_model_se_a.py diff --git a/source/tests/test_model_se_a_aparam.py b/source/tests/tf/test_model_se_a_aparam.py similarity index 100% rename from source/tests/test_model_se_a_aparam.py rename to source/tests/tf/test_model_se_a_aparam.py diff --git a/source/tests/test_model_se_a_ebd.py b/source/tests/tf/test_model_se_a_ebd.py similarity index 100% rename from source/tests/test_model_se_a_ebd.py rename to source/tests/tf/test_model_se_a_ebd.py diff --git a/source/tests/test_model_se_a_ebd_v2.py b/source/tests/tf/test_model_se_a_ebd_v2.py similarity index 100% rename from source/tests/test_model_se_a_ebd_v2.py rename to source/tests/tf/test_model_se_a_ebd_v2.py diff --git a/source/tests/test_model_se_a_fparam.py b/source/tests/tf/test_model_se_a_fparam.py similarity index 100% rename from source/tests/test_model_se_a_fparam.py rename to source/tests/tf/test_model_se_a_fparam.py diff --git a/source/tests/test_model_se_a_srtab.py b/source/tests/tf/test_model_se_a_srtab.py similarity index 100% rename from source/tests/test_model_se_a_srtab.py rename to source/tests/tf/test_model_se_a_srtab.py diff --git a/source/tests/test_model_se_a_type.py b/source/tests/tf/test_model_se_a_type.py similarity index 100% rename from source/tests/test_model_se_a_type.py rename to source/tests/tf/test_model_se_a_type.py diff --git a/source/tests/test_model_se_atten.py b/source/tests/tf/test_model_se_atten.py similarity index 100% rename from source/tests/test_model_se_atten.py rename to source/tests/tf/test_model_se_atten.py diff --git a/source/tests/test_model_se_r.py b/source/tests/tf/test_model_se_r.py similarity index 100% rename from source/tests/test_model_se_r.py rename to source/tests/tf/test_model_se_r.py diff --git a/source/tests/test_model_se_t.py b/source/tests/tf/test_model_se_t.py similarity index 100% rename from source/tests/test_model_se_t.py rename to source/tests/tf/test_model_se_t.py diff --git a/source/tests/test_model_spin.json b/source/tests/tf/test_model_spin.json similarity index 100% rename from source/tests/test_model_spin.json rename to source/tests/tf/test_model_spin.json diff --git a/source/tests/test_model_spin.py b/source/tests/tf/test_model_spin.py similarity index 100% rename from source/tests/test_model_spin.py rename to source/tests/tf/test_model_spin.py diff --git a/source/tests/test_neighbor_stat.py b/source/tests/tf/test_neighbor_stat.py similarity index 100% rename from source/tests/test_neighbor_stat.py rename to source/tests/tf/test_neighbor_stat.py diff --git a/source/tests/test_nvnmd_entrypoints.py b/source/tests/tf/test_nvnmd_entrypoints.py similarity index 100% rename from source/tests/test_nvnmd_entrypoints.py rename to source/tests/tf/test_nvnmd_entrypoints.py diff --git a/source/tests/test_nvnmd_op.py b/source/tests/tf/test_nvnmd_op.py similarity index 100% rename from source/tests/test_nvnmd_op.py rename to source/tests/tf/test_nvnmd_op.py diff --git a/source/tests/test_output_def.py b/source/tests/tf/test_output_def.py similarity index 100% rename from source/tests/test_output_def.py rename to source/tests/tf/test_output_def.py diff --git a/source/tests/test_pairwise_dprc.py b/source/tests/tf/test_pairwise_dprc.py similarity index 100% rename from source/tests/test_pairwise_dprc.py rename to source/tests/tf/test_pairwise_dprc.py diff --git a/source/tests/test_parallel_training.py b/source/tests/tf/test_parallel_training.py similarity index 100% rename from source/tests/test_parallel_training.py rename to source/tests/tf/test_parallel_training.py diff --git a/source/tests/test_polar_se_a.py b/source/tests/tf/test_polar_se_a.py similarity index 100% rename from source/tests/test_polar_se_a.py rename to source/tests/tf/test_polar_se_a.py diff --git a/source/tests/test_polar_se_a_tebd.py b/source/tests/tf/test_polar_se_a_tebd.py similarity index 100% rename from source/tests/test_polar_se_a_tebd.py rename to source/tests/tf/test_polar_se_a_tebd.py diff --git a/source/tests/test_prod_env_mat.py b/source/tests/tf/test_prod_env_mat.py similarity index 100% rename from source/tests/test_prod_env_mat.py rename to source/tests/tf/test_prod_env_mat.py diff --git a/source/tests/test_prod_force.py b/source/tests/tf/test_prod_force.py similarity index 100% rename from source/tests/test_prod_force.py rename to source/tests/tf/test_prod_force.py diff --git a/source/tests/test_prod_force_grad.py b/source/tests/tf/test_prod_force_grad.py similarity index 100% rename from source/tests/test_prod_force_grad.py rename to source/tests/tf/test_prod_force_grad.py diff --git a/source/tests/test_prod_virial.py b/source/tests/tf/test_prod_virial.py similarity index 100% rename from source/tests/test_prod_virial.py rename to source/tests/tf/test_prod_virial.py diff --git a/source/tests/test_prod_virial_grad.py b/source/tests/tf/test_prod_virial_grad.py similarity index 100% rename from source/tests/test_prod_virial_grad.py rename to source/tests/tf/test_prod_virial_grad.py diff --git a/source/tests/test_sel_idx.py b/source/tests/tf/test_sel_idx.py similarity index 100% rename from source/tests/test_sel_idx.py rename to source/tests/tf/test_sel_idx.py diff --git a/source/tests/test_tab_nonsmth.py b/source/tests/tf/test_tab_nonsmth.py similarity index 100% rename from source/tests/test_tab_nonsmth.py rename to source/tests/tf/test_tab_nonsmth.py diff --git a/source/tests/test_tab_smooth.py b/source/tests/tf/test_tab_smooth.py similarity index 100% rename from source/tests/test_tab_smooth.py rename to source/tests/tf/test_tab_smooth.py diff --git a/source/tests/test_tabulate.py b/source/tests/tf/test_tabulate.py similarity index 100% rename from source/tests/test_tabulate.py rename to source/tests/tf/test_tabulate.py diff --git a/source/tests/test_train.py b/source/tests/tf/test_train.py similarity index 100% rename from source/tests/test_train.py rename to source/tests/tf/test_train.py diff --git a/source/tests/test_transfer.py b/source/tests/tf/test_transfer.py similarity index 98% rename from source/tests/test_transfer.py rename to source/tests/tf/test_transfer.py index f73c9eef66..b16c070381 100644 --- a/source/tests/test_transfer.py +++ b/source/tests/tf/test_transfer.py @@ -5,6 +5,7 @@ import numpy as np from common import ( + infer_path, run_dp, tests_path, ) @@ -48,10 +49,10 @@ def setUpClass(self): self.raw_model = str(tests_path / "dp-raw.pb") self.new_model = str(tests_path / "dp-new.pb") convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot.pbtxt")), self.old_model + str(infer_path / os.path.join("deeppot.pbtxt")), self.old_model ) convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot-1.pbtxt")), self.raw_model + str(infer_path / os.path.join("deeppot-1.pbtxt")), self.raw_model ) ret = run_dp( "dp transfer -O " diff --git a/source/tests/test_type_embed.py b/source/tests/tf/test_type_embed.py similarity index 100% rename from source/tests/test_type_embed.py rename to source/tests/tf/test_type_embed.py diff --git a/source/tests/test_type_one_side.py b/source/tests/tf/test_type_one_side.py similarity index 100% rename from source/tests/test_type_one_side.py rename to source/tests/tf/test_type_one_side.py diff --git a/source/tests/test_uni_infer.py b/source/tests/tf/test_uni_infer.py similarity index 85% rename from source/tests/test_uni_infer.py rename to source/tests/tf/test_uni_infer.py index 4cff5e10d5..bdde7ae422 100644 --- a/source/tests/test_uni_infer.py +++ b/source/tests/tf/test_uni_infer.py @@ -5,7 +5,7 @@ import unittest from common import ( - tests_path, + infer_path, ) from deepmd.infer.deep_pot import DeepPot as DeepPot @@ -19,7 +19,7 @@ class TestUniversalInfer(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "deeppot-r.pbtxt")), "deeppot.pb" + str(infer_path / os.path.join("deeppot-r.pbtxt")), "deeppot.pb" ) def test_deep_pot(self): diff --git a/source/tests/test_virtual_type.py b/source/tests/tf/test_virtual_type.py similarity index 97% rename from source/tests/test_virtual_type.py rename to source/tests/tf/test_virtual_type.py index 0aca54dfd6..ef12a1aed4 100644 --- a/source/tests/test_virtual_type.py +++ b/source/tests/tf/test_virtual_type.py @@ -6,8 +6,8 @@ import numpy as np from common import ( gen_data, + infer_path, j_loader, - tests_path, ) from deepmd.tf.common import ( @@ -31,7 +31,7 @@ class TestVirtualType(unittest.TestCase): @classmethod def setUpClass(cls): convert_pbtxt_to_pb( - str(tests_path / os.path.join("infer", "virtual_type.pbtxt")), + str(infer_path / os.path.join("virtual_type.pbtxt")), "virtual_type.pb", ) cls.dp = DeepPot("virtual_type.pb") diff --git a/source/tests/train_dos.json b/source/tests/tf/train_dos.json similarity index 100% rename from source/tests/train_dos.json rename to source/tests/tf/train_dos.json diff --git a/source/tests/water.json b/source/tests/tf/water.json similarity index 100% rename from source/tests/water.json rename to source/tests/tf/water.json diff --git a/source/tests/water_hybrid.json b/source/tests/tf/water_hybrid.json similarity index 100% rename from source/tests/water_hybrid.json rename to source/tests/tf/water_hybrid.json diff --git a/source/tests/water_layer_name.json b/source/tests/tf/water_layer_name.json similarity index 100% rename from source/tests/water_layer_name.json rename to source/tests/tf/water_layer_name.json diff --git a/source/tests/water_multi.json b/source/tests/tf/water_multi.json similarity index 100% rename from source/tests/water_multi.json rename to source/tests/tf/water_multi.json diff --git a/source/tests/water_se_a.json b/source/tests/tf/water_se_a.json similarity index 100% rename from source/tests/water_se_a.json rename to source/tests/tf/water_se_a.json diff --git a/source/tests/water_se_a_afparam.json b/source/tests/tf/water_se_a_afparam.json similarity index 100% rename from source/tests/water_se_a_afparam.json rename to source/tests/tf/water_se_a_afparam.json diff --git a/source/tests/water_se_a_aparam.json b/source/tests/tf/water_se_a_aparam.json similarity index 100% rename from source/tests/water_se_a_aparam.json rename to source/tests/tf/water_se_a_aparam.json diff --git a/source/tests/water_se_a_ebd.json b/source/tests/tf/water_se_a_ebd.json similarity index 100% rename from source/tests/water_se_a_ebd.json rename to source/tests/tf/water_se_a_ebd.json diff --git a/source/tests/water_se_a_fparam.json b/source/tests/tf/water_se_a_fparam.json similarity index 100% rename from source/tests/water_se_a_fparam.json rename to source/tests/tf/water_se_a_fparam.json diff --git a/source/tests/water_se_a_srtab.json b/source/tests/tf/water_se_a_srtab.json similarity index 100% rename from source/tests/water_se_a_srtab.json rename to source/tests/tf/water_se_a_srtab.json diff --git a/source/tests/water_se_a_type.json b/source/tests/tf/water_se_a_type.json similarity index 100% rename from source/tests/water_se_a_type.json rename to source/tests/tf/water_se_a_type.json diff --git a/source/tests/water_se_atten.json b/source/tests/tf/water_se_atten.json similarity index 100% rename from source/tests/water_se_atten.json rename to source/tests/tf/water_se_atten.json diff --git a/source/tests/water_se_atten_compressible_mixed_type.json b/source/tests/tf/water_se_atten_compressible_mixed_type.json similarity index 100% rename from source/tests/water_se_atten_compressible_mixed_type.json rename to source/tests/tf/water_se_atten_compressible_mixed_type.json diff --git a/source/tests/water_se_atten_mixed_type.json b/source/tests/tf/water_se_atten_mixed_type.json similarity index 100% rename from source/tests/water_se_atten_mixed_type.json rename to source/tests/tf/water_se_atten_mixed_type.json diff --git a/source/tests/water_se_r.json b/source/tests/tf/water_se_r.json similarity index 100% rename from source/tests/water_se_r.json rename to source/tests/tf/water_se_r.json diff --git a/source/tests/water_se_t.json b/source/tests/tf/water_se_t.json similarity index 100% rename from source/tests/water_se_t.json rename to source/tests/tf/water_se_t.json diff --git a/source/tests/wfc.json b/source/tests/tf/wfc.json similarity index 100% rename from source/tests/wfc.json rename to source/tests/tf/wfc.json diff --git a/source/tests/yaml_inputs/water_se_a_v1.json b/source/tests/tf/yaml_inputs/water_se_a_v1.json similarity index 100% rename from source/tests/yaml_inputs/water_se_a_v1.json rename to source/tests/tf/yaml_inputs/water_se_a_v1.json diff --git a/source/tests/yaml_inputs/water_se_a_v1.yaml b/source/tests/tf/yaml_inputs/water_se_a_v1.yaml similarity index 100% rename from source/tests/yaml_inputs/water_se_a_v1.yaml rename to source/tests/tf/yaml_inputs/water_se_a_v1.yaml diff --git a/source/tests/yaml_inputs/water_v1.json b/source/tests/tf/yaml_inputs/water_v1.json similarity index 100% rename from source/tests/yaml_inputs/water_v1.json rename to source/tests/tf/yaml_inputs/water_v1.json diff --git a/source/tests/yaml_inputs/water_v1.yaml b/source/tests/tf/yaml_inputs/water_v1.yaml similarity index 100% rename from source/tests/yaml_inputs/water_v1.yaml rename to source/tests/tf/yaml_inputs/water_v1.yaml diff --git a/source/tests/zinc_se_a_mask.json b/source/tests/tf/zinc_se_a_mask.json similarity index 100% rename from source/tests/zinc_se_a_mask.json rename to source/tests/tf/zinc_se_a_mask.json From bc65fa1f0b4182395559a158cda7d10d8e404f51 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 18:51:36 -0500 Subject: [PATCH 02/14] fix infer_path Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_linear_model.py | 6 +++--- source/tests/tf/test_model_devi.py | 7 ++++--- source/tests/tf/test_model_devi_mix.py | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/tests/tf/test_linear_model.py b/source/tests/tf/test_linear_model.py index ef0d324a69..551423001a 100644 --- a/source/tests/tf/test_linear_model.py +++ b/source/tests/tf/test_linear_model.py @@ -24,7 +24,7 @@ DataSystem, del_data, gen_data, - tests_path, + infer_path, ) @@ -35,8 +35,8 @@ def setUp(self): with open(os.path.join(self.data_dir, "type_map.raw"), "w") as f: f.write("O\nH") self.pbtxts = [ - os.path.join(tests_path, "infer/deeppot.pbtxt"), - os.path.join(tests_path, "infer/deeppot-1.pbtxt"), + os.path.join(infer_path, "deeppot.pbtxt"), + os.path.join(infer_path, "deeppot-1.pbtxt"), ] self.graph_dirs = [pbtxt.replace("pbtxt", "pb") for pbtxt in self.pbtxts] for pbtxt, pb in zip(self.pbtxts, self.graph_dirs): diff --git a/source/tests/tf/test_model_devi.py b/source/tests/tf/test_model_devi.py index 21275ee2d1..0085387323 100644 --- a/source/tests/tf/test_model_devi.py +++ b/source/tests/tf/test_model_devi.py @@ -17,6 +17,7 @@ from common import ( del_data, gen_data, + infer_path, tests_path, ) @@ -39,8 +40,8 @@ def setUp(self): self.freq = 10 self.pbtxts = [ - os.path.join(tests_path, "infer/deeppot.pbtxt"), - os.path.join(tests_path, "infer/deeppot-1.pbtxt"), + os.path.join(infer_path, "deeppot.pbtxt"), + os.path.join(infer_path, "deeppot-1.pbtxt"), ] self.graph_dirs = [pbtxt.replace("pbtxt", "pb") for pbtxt in self.pbtxts] for pbtxt, pb in zip(self.pbtxts, self.graph_dirs): @@ -215,7 +216,7 @@ class TestMakeModelDeviFparamAparam(unittest.TestCase): @classmethod def setUpClass(cls): cls.pbtxts = [ - os.path.join(tests_path, "infer/fparam_aparam.pbtxt"), + os.path.join(infer_path, "fparam_aparam.pbtxt"), ] cls.graph_dirs = [pbtxt.replace("pbtxt", "pb") for pbtxt in cls.pbtxts] for pbtxt, pb in zip(cls.pbtxts, cls.graph_dirs): diff --git a/source/tests/tf/test_model_devi_mix.py b/source/tests/tf/test_model_devi_mix.py index 5715b49165..60716d020a 100644 --- a/source/tests/tf/test_model_devi_mix.py +++ b/source/tests/tf/test_model_devi_mix.py @@ -17,6 +17,7 @@ from common import ( del_data, gen_data, + infer_path, tests_path, ) from packaging.version import parse as parse_version @@ -56,8 +57,8 @@ def setUp(self): ) self.pbtxts = [ - os.path.join(tests_path, "infer/se_atten_no_atten_1.pbtxt"), - os.path.join(tests_path, "infer/se_atten_no_atten_2.pbtxt"), + os.path.join(infer_path, "se_atten_no_atten_1.pbtxt"), + os.path.join(infer_path, "se_atten_no_atten_2.pbtxt"), ] self.graph_dirs = [pbtxt.replace("pbtxt", "pb") for pbtxt in self.pbtxts] for pbtxt, pb in zip(self.pbtxts, self.graph_dirs): From 0215e85c2a9fb468caff2ec16a735a1afedafacd Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 18:52:26 -0500 Subject: [PATCH 03/14] fix infer_path Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_deeppot_a.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/tests/tf/test_deeppot_a.py b/source/tests/tf/test_deeppot_a.py index 3e3b4e1385..b19f2bfc6c 100644 --- a/source/tests/tf/test_deeppot_a.py +++ b/source/tests/tf/test_deeppot_a.py @@ -279,7 +279,7 @@ def test_1frame_atm(self): def test_descriptor(self): descpt = self.dp.eval_descriptor(self.coords, self.box, self.atype) - expected_descpt = np.loadtxt(str(tests_path / "infer" / "deeppot_descpt.txt")) + expected_descpt = np.loadtxt(str(infer_path / "deeppot_descpt.txt")) np.testing.assert_almost_equal(descpt.ravel(), expected_descpt.ravel()) def test_2frame_atm(self): @@ -800,7 +800,7 @@ def setUp(self): def test_convert_012(self): old_model = "deeppot.pb" new_model = "deeppot-new.pb" - convert_pbtxt_to_pb(str(tests_path / "infer" / "sea_012.pbtxt"), old_model) + convert_pbtxt_to_pb(str(infer_path / "sea_012.pbtxt"), old_model) run_dp(f"dp convert-from 0.12 -i {old_model} -o {new_model}") dp = DeepPot(new_model) _, _, _, _, _ = dp.eval(self.coords, self.box, self.atype, atomic=True) @@ -810,7 +810,7 @@ def test_convert_012(self): def test_convert(self): old_model = "deeppot.pb" new_model = "deeppot-new.pb" - convert_pbtxt_to_pb(str(tests_path / "infer" / "sea_012.pbtxt"), old_model) + convert_pbtxt_to_pb(str(infer_path / "sea_012.pbtxt"), old_model) run_dp(f"dp convert-from -i {old_model} -o {new_model}") dp = DeepPot(new_model) _, _, _, _, _ = dp.eval(self.coords, self.box, self.atype, atomic=True) @@ -821,11 +821,11 @@ def test_detect(self): old_model = "deeppot.pb" new_model_txt = "deeppot_new.pbtxt" new_model_pb = "deeppot_new.pb" - convert_pbtxt_to_pb(str(tests_path / "infer" / "sea_012.pbtxt"), old_model) + convert_pbtxt_to_pb(str(infer_path / "sea_012.pbtxt"), old_model) version = detect_model_version(old_model) self.assertEqual(version, parse_version("0.12")) os.remove(old_model) - shutil.copyfile(str(tests_path / "infer" / "sea_012.pbtxt"), new_model_txt) + shutil.copyfile(str(infer_path / "sea_012.pbtxt"), new_model_txt) convert_dp012_to_dp10(new_model_txt) convert_pbtxt_to_pb(new_model_txt, new_model_pb) version = detect_model_version(new_model_pb) From 53fcbe8070b2742e12651e086e8c0e7cb8ccee36 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:01:05 -0500 Subject: [PATCH 04/14] move from tests/tf to tests/common Signed-off-by: Jinzhe Zeng --- source/tests/__init__.py | 1 + source/tests/common/__init__.py | 1 + source/tests/common/common.py | 5 +++++ source/tests/{tf => common}/test_argument_parser.py | 2 +- source/tests/{tf => common}/test_examples.py | 6 +++--- source/tests/{tf => common}/test_gui.py | 0 source/tests/{tf => common}/test_model_format_utils.py | 0 source/tests/{tf => common}/test_output_def.py | 0 source/tests/{tf => common}/test_sel_idx.py | 2 +- source/tests/{tf => common}/test_uni_infer.py | 0 10 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 source/tests/__init__.py create mode 100644 source/tests/common/__init__.py create mode 100644 source/tests/common/common.py rename source/tests/{tf => common}/test_argument_parser.py (99%) rename source/tests/{tf => common}/test_examples.py (93%) rename source/tests/{tf => common}/test_gui.py (100%) rename source/tests/{tf => common}/test_model_format_utils.py (100%) rename source/tests/{tf => common}/test_output_def.py (100%) rename source/tests/{tf => common}/test_sel_idx.py (94%) rename source/tests/{tf => common}/test_uni_infer.py (100%) diff --git a/source/tests/__init__.py b/source/tests/__init__.py new file mode 100644 index 0000000000..6ceb116d85 --- /dev/null +++ b/source/tests/__init__.py @@ -0,0 +1 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/source/tests/common/__init__.py b/source/tests/common/__init__.py new file mode 100644 index 0000000000..6ceb116d85 --- /dev/null +++ b/source/tests/common/__init__.py @@ -0,0 +1 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/source/tests/common/common.py b/source/tests/common/common.py new file mode 100644 index 0000000000..4736042150 --- /dev/null +++ b/source/tests/common/common.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later +import pathlib + +tests_path = pathlib.Path(__file__).parent.absolute() +infer_path = (tests_path.parent / "infer").absolute() diff --git a/source/tests/tf/test_argument_parser.py b/source/tests/common/test_argument_parser.py similarity index 99% rename from source/tests/tf/test_argument_parser.py rename to source/tests/common/test_argument_parser.py index 988199d1e4..0b4f053aed 100644 --- a/source/tests/tf/test_argument_parser.py +++ b/source/tests/common/test_argument_parser.py @@ -21,7 +21,7 @@ Union, ) -from deepmd.tf.entrypoints.main import ( +from deepmd.main import ( get_ll, parse_args, ) diff --git a/source/tests/tf/test_examples.py b/source/tests/common/test_examples.py similarity index 93% rename from source/tests/tf/test_examples.py rename to source/tests/common/test_examples.py index ea087fbc9d..ad06925eab 100644 --- a/source/tests/tf/test_examples.py +++ b/source/tests/common/test_examples.py @@ -7,14 +7,14 @@ Path, ) -from deepmd.tf.common import ( +from deepmd.common import ( j_loader, ) -from deepmd.tf.utils.argcheck import ( +from deepmd.utils.argcheck import ( normalize, ) -p_examples = Path(__file__).parent.parent.parent / "examples" +p_examples = Path(__file__).parent.parent.parent.parent / "examples" input_files = ( p_examples / "water" / "se_e2_a" / "input.json", diff --git a/source/tests/tf/test_gui.py b/source/tests/common/test_gui.py similarity index 100% rename from source/tests/tf/test_gui.py rename to source/tests/common/test_gui.py diff --git a/source/tests/tf/test_model_format_utils.py b/source/tests/common/test_model_format_utils.py similarity index 100% rename from source/tests/tf/test_model_format_utils.py rename to source/tests/common/test_model_format_utils.py diff --git a/source/tests/tf/test_output_def.py b/source/tests/common/test_output_def.py similarity index 100% rename from source/tests/tf/test_output_def.py rename to source/tests/common/test_output_def.py diff --git a/source/tests/tf/test_sel_idx.py b/source/tests/common/test_sel_idx.py similarity index 94% rename from source/tests/tf/test_sel_idx.py rename to source/tests/common/test_sel_idx.py index e340ba55e7..d6630e3e83 100644 --- a/source/tests/tf/test_sel_idx.py +++ b/source/tests/common/test_sel_idx.py @@ -3,7 +3,7 @@ import numpy as np -from deepmd.tf.common import ( +from deepmd.common import ( select_idx_map, ) diff --git a/source/tests/tf/test_uni_infer.py b/source/tests/common/test_uni_infer.py similarity index 100% rename from source/tests/tf/test_uni_infer.py rename to source/tests/common/test_uni_infer.py From d1e0132ad72743cabbcbd9006cc6f565cf75e6eb Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:20:15 -0500 Subject: [PATCH 05/14] fix paths Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_descrpt_se_a_mask.py | 4 ++++ source/tests/tf/test_get_potential.py | 7 ++++--- source/tests/tf/test_model_spin.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/tests/tf/test_descrpt_se_a_mask.py b/source/tests/tf/test_descrpt_se_a_mask.py index 8d4dd66ee1..051b6e890d 100644 --- a/source/tests/tf/test_descrpt_se_a_mask.py +++ b/source/tests/tf/test_descrpt_se_a_mask.py @@ -226,6 +226,10 @@ def test_descriptor_se_a_mask(self): jfile = "zinc_se_a_mask.json" jdata = j_loader(jfile) + jdata["training"]["training_data"]["systems"] = str(tests_path / "data_dp_mask") + jdata["training"]["validation_data"]["systems"] = str( + tests_path / "data_dp_mask" + ) systems = j_must_have(jdata["training"]["validation_data"], "systems") # set_pfx = j_must_have(jdata['validation_data'], "set_prefix") set_pfx = "set" diff --git a/source/tests/tf/test_get_potential.py b/source/tests/tf/test_get_potential.py index feb264afe0..a8ed61cdfb 100644 --- a/source/tests/tf/test_get_potential.py +++ b/source/tests/tf/test_get_potential.py @@ -2,8 +2,9 @@ """Test if `DeepPotential` facto function returns the right type of potential.""" import unittest -from pathlib import ( - Path, + +from common import ( + infer_path, ) from deepmd.tf.infer import ( @@ -19,7 +20,7 @@ class TestGetPotential(unittest.TestCase): def setUp(self): - self.work_dir = Path(__file__).parent / "infer" + self.work_dir = infer_path convert_pbtxt_to_pb( str(self.work_dir / "deeppot.pbtxt"), str(self.work_dir / "deep_pot.pb") diff --git a/source/tests/tf/test_model_spin.py b/source/tests/tf/test_model_spin.py index d1a6f59fe1..e6aa585df7 100644 --- a/source/tests/tf/test_model_spin.py +++ b/source/tests/tf/test_model_spin.py @@ -46,7 +46,6 @@ def test_model_spin(self): jdata = j_loader(jfile) # set system information - systems = j_must_have(jdata["training"]["training_data"], "systems") set_pfx = j_must_have(jdata["training"], "set_prefix") batch_size = j_must_have(jdata["training"]["training_data"], "batch_size") batch_size = 2 @@ -59,6 +58,7 @@ def test_model_spin(self): jdata["training"]["validation_data"]["systems"] = [ str(tests_path / "model_spin/") ] + systems = j_must_have(jdata["training"]["training_data"], "systems") data = DataSystem(systems, set_pfx, batch_size, test_size, rcut, run_opt=None) test_data = data.get_test() From 2e86c391cd9a7df5df74408d0d3372c61a35ad31 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:21:33 -0500 Subject: [PATCH 06/14] fix tests_path Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_descrpt_se_a_mask.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/tests/tf/test_descrpt_se_a_mask.py b/source/tests/tf/test_descrpt_se_a_mask.py index 051b6e890d..2572965222 100644 --- a/source/tests/tf/test_descrpt_se_a_mask.py +++ b/source/tests/tf/test_descrpt_se_a_mask.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import os -import pathlib import numpy as np from common import ( DataSystem, infer_path, j_loader, + tests_path, ) from deepmd.tf.common import ( @@ -29,8 +29,6 @@ GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 -tests_path = pathlib.Path(__file__).parent.absolute() - class TestModel(tf.test.TestCase): @classmethod From ca3b1c93a36c4c49f2b7ae3219920760810e3aa2 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:27:17 -0500 Subject: [PATCH 07/14] systems should be a list Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_descrpt_se_a_mask.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/tests/tf/test_descrpt_se_a_mask.py b/source/tests/tf/test_descrpt_se_a_mask.py index 2572965222..675ef4b2e5 100644 --- a/source/tests/tf/test_descrpt_se_a_mask.py +++ b/source/tests/tf/test_descrpt_se_a_mask.py @@ -224,10 +224,12 @@ def test_descriptor_se_a_mask(self): jfile = "zinc_se_a_mask.json" jdata = j_loader(jfile) - jdata["training"]["training_data"]["systems"] = str(tests_path / "data_dp_mask") - jdata["training"]["validation_data"]["systems"] = str( - tests_path / "data_dp_mask" - ) + jdata["training"]["training_data"]["systems"] = [ + str(tests_path / "data_dp_mask") + ] + jdata["training"]["validation_data"]["systems"] = [ + str(tests_path / "data_dp_mask") + ] systems = j_must_have(jdata["training"]["validation_data"], "systems") # set_pfx = j_must_have(jdata['validation_data'], "set_prefix") set_pfx = "set" From 5fd682489448e3280c4a42eefe395d41d2912e66 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:48:46 -0500 Subject: [PATCH 08/14] insert sys.path Signed-off-by: Jinzhe Zeng --- source/tests/common/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/tests/common/__init__.py b/source/tests/common/__init__.py index 6ceb116d85..d30f76b7a1 100644 --- a/source/tests/common/__init__.py +++ b/source/tests/common/__init__.py @@ -1 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later +import os +import sys + +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) From 1e843bc2d9f51963f2ed598e5a276eed884da33a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:55:49 -0500 Subject: [PATCH 09/14] fix common Signed-off-by: Jinzhe Zeng --- source/tests/common/__init__.py | 4 ---- source/tests/tf/test_adjust_sel.py | 14 +++++++------- source/tests/tf/test_compat_input.py | 8 ++++---- source/tests/tf/test_compressed_training.py | 13 +++++++------ source/tests/tf/test_data_large_batch.py | 9 +++++---- source/tests/tf/test_data_modifier.py | 11 ++++++----- source/tests/tf/test_deepdipole.py | 13 +++++++------ source/tests/tf/test_deepdos.py | 7 ++++--- source/tests/tf/test_deepmd_data.py | 7 ++++--- source/tests/tf/test_deeppolar.py | 9 +++++---- source/tests/tf/test_deeppot_a.py | 11 ++++++----- source/tests/tf/test_deeppot_r.py | 7 ++++--- source/tests/tf/test_deeppot_spin.py | 7 ++++--- source/tests/tf/test_descrpt_hybrid.py | 11 ++++++----- source/tests/tf/test_descrpt_nonsmth.py | 15 ++++++++------- source/tests/tf/test_descrpt_se_a_mask.py | 13 +++++++------ source/tests/tf/test_descrpt_se_a_type.py | 11 ++++++----- source/tests/tf/test_descrpt_se_atten.py | 11 ++++++----- source/tests/tf/test_descrpt_se_r.py | 15 ++++++++------- source/tests/tf/test_descrpt_sea_ef.py | 15 ++++++++------- source/tests/tf/test_descrpt_sea_ef_para.py | 15 ++++++++------- source/tests/tf/test_descrpt_sea_ef_vert.py | 15 ++++++++------- source/tests/tf/test_descrpt_smooth.py | 15 ++++++++------- source/tests/tf/test_dipole_se_a.py | 15 ++++++++------- source/tests/tf/test_dipole_se_a_tebd.py | 15 ++++++++------- source/tests/tf/test_dipolecharge.py | 7 ++++--- source/tests/tf/test_dp_test.py | 7 ++++--- source/tests/tf/test_finetune_se_atten.py | 11 ++++++----- source/tests/tf/test_fitting_dos.py | 11 ++++++----- source/tests/tf/test_fitting_ener_type.py | 11 ++++++----- source/tests/tf/test_fitting_stat.py | 7 ++++--- source/tests/tf/test_get_potential.py | 8 ++++---- source/tests/tf/test_init_frz_model_multi.py | 11 ++++++----- source/tests/tf/test_init_frz_model_se_a.py | 11 ++++++----- .../tests/tf/test_init_frz_model_se_a_tebd.py | 11 ++++++----- .../tests/tf/test_init_frz_model_se_a_type.py | 11 ++++++----- .../tests/tf/test_init_frz_model_se_atten.py | 11 ++++++----- source/tests/tf/test_init_frz_model_se_r.py | 11 ++++++----- source/tests/tf/test_init_frz_model_spin.py | 11 ++++++----- source/tests/tf/test_layer_name.py | 13 +++++++------ source/tests/tf/test_linear_model.py | 4 +--- source/tests/tf/test_mixed_prec_training.py | 14 +++++++------- .../tests/tf/test_model_compression_se_a.py | 14 +++++++------- .../tf/test_model_compression_se_a_ebd.py | 14 +++++++------- ...odel_compression_se_a_ebd_type_one_side.py | 14 +++++++------- ...ession_se_a_type_one_side_exclude_types.py | 14 +++++++------- .../tf/test_model_compression_se_atten.py | 14 +++++++------- .../tests/tf/test_model_compression_se_r.py | 14 +++++++------- .../tests/tf/test_model_compression_se_t.py | 14 +++++++------- source/tests/tf/test_model_devi.py | 11 ++++------- source/tests/tf/test_model_devi_mix.py | 19 ++++++++----------- source/tests/tf/test_model_dos.py | 13 +++++++------ source/tests/tf/test_model_loc_frame.py | 11 ++++++----- source/tests/tf/test_model_multi.py | 17 +++++++++-------- source/tests/tf/test_model_pairtab.py | 11 ++++++----- source/tests/tf/test_model_se_a.py | 13 +++++++------ source/tests/tf/test_model_se_a_aparam.py | 11 ++++++----- source/tests/tf/test_model_se_a_ebd.py | 11 ++++++----- source/tests/tf/test_model_se_a_ebd_v2.py | 11 ++++++----- source/tests/tf/test_model_se_a_fparam.py | 11 ++++++----- source/tests/tf/test_model_se_a_srtab.py | 11 ++++++----- source/tests/tf/test_model_se_a_type.py | 11 ++++++----- source/tests/tf/test_model_se_atten.py | 15 ++++++++------- source/tests/tf/test_model_se_r.py | 11 ++++++----- source/tests/tf/test_model_se_t.py | 11 ++++++----- source/tests/tf/test_model_spin.py | 15 ++++++++------- source/tests/tf/test_nvnmd_entrypoints.py | 7 ++++--- source/tests/tf/test_pairwise_dprc.py | 9 +++++---- source/tests/tf/test_parallel_training.py | 8 ++++---- source/tests/tf/test_polar_se_a.py | 15 ++++++++------- source/tests/tf/test_polar_se_a_tebd.py | 15 ++++++++------- source/tests/tf/test_tab_nonsmth.py | 15 ++++++++------- source/tests/tf/test_tab_smooth.py | 15 ++++++++------- source/tests/tf/test_transfer.py | 11 ++++++----- source/tests/tf/test_type_one_side.py | 11 ++++++----- source/tests/tf/test_virtual_type.py | 11 ++++++----- 76 files changed, 466 insertions(+), 418 deletions(-) diff --git a/source/tests/common/__init__.py b/source/tests/common/__init__.py index d30f76b7a1..6ceb116d85 100644 --- a/source/tests/common/__init__.py +++ b/source/tests/common/__init__.py @@ -1,5 +1 @@ # SPDX-License-Identifier: LGPL-3.0-or-later -import os -import sys - -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) diff --git a/source/tests/tf/test_adjust_sel.py b/source/tests/tf/test_adjust_sel.py index 9bed3606fd..c86bad45b7 100644 --- a/source/tests/tf/test_adjust_sel.py +++ b/source/tests/tf/test_adjust_sel.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_compat_input.py b/source/tests/tf/test_compat_input.py index e8a74e9c48..f7c605380c 100644 --- a/source/tests/tf/test_compat_input.py +++ b/source/tests/tf/test_compat_input.py @@ -2,15 +2,15 @@ import os import unittest -from common import ( - j_loader, -) - from deepmd.tf.utils.compat import ( convert_input_v0_v1, convert_input_v1_v2, ) +from .common import ( + j_loader, +) + class TestConvertInput(unittest.TestCase): def test_convert_smth(self): diff --git a/source/tests/tf/test_compressed_training.py b/source/tests/tf/test_compressed_training.py index c3d07762f8..998ef8cb59 100644 --- a/source/tests/tf/test_compressed_training.py +++ b/source/tests/tf/test_compressed_training.py @@ -3,18 +3,19 @@ import os import unittest -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( tf, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + @unittest.skipIf( parse_version(tf.__version__) < parse_version("2"), diff --git a/source/tests/tf/test_data_large_batch.py b/source/tests/tf/test_data_large_batch.py index 84e99591d5..c31a4c4a9a 100644 --- a/source/tests/tf/test_data_large_batch.py +++ b/source/tests/tf/test_data_large_batch.py @@ -3,10 +3,6 @@ import unittest import numpy as np -from common import ( - gen_data, - j_loader, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -31,6 +27,11 @@ TypeEmbedNet, ) +from .common import ( + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_data_modifier.py b/source/tests/tf/test_data_modifier.py index 01e3cdcb2d..98b6c41427 100644 --- a/source/tests/tf/test_data_modifier.py +++ b/source/tests/tf/test_data_modifier.py @@ -2,11 +2,6 @@ import os import numpy as np -from common import ( - Data, - j_loader, - tests_path, -) from deepmd.tf.common import ( data_requirement, @@ -29,6 +24,12 @@ DeepmdDataSystem, ) +from .common import ( + Data, + j_loader, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: global_default_fv_hh = 1e-2 global_default_dw_hh = 1e-2 diff --git a/source/tests/tf/test_deepdipole.py b/source/tests/tf/test_deepdipole.py index 13408bc61c..2c8ec7cc66 100644 --- a/source/tests/tf/test_deepdipole.py +++ b/source/tests/tf/test_deepdipole.py @@ -4,12 +4,6 @@ import ase.neighborlist import numpy as np -from common import ( - finite_difference, - infer_path, - strerch_box, - tf, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -22,6 +16,13 @@ convert_pbtxt_to_pb, ) +from .common import ( + finite_difference, + infer_path, + strerch_box, + tf, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_deepdos.py b/source/tests/tf/test_deepdos.py index f4980d4d1a..d94c2c3f2d 100644 --- a/source/tests/tf/test_deepdos.py +++ b/source/tests/tf/test_deepdos.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from common import ( - infer_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -17,6 +14,10 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_deepmd_data.py b/source/tests/tf/test_deepmd_data.py index e486446ab8..b1a0147771 100644 --- a/source/tests/tf/test_deepmd_data.py +++ b/source/tests/tf/test_deepmd_data.py @@ -5,9 +5,6 @@ import unittest import numpy as np -from common import ( - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -16,6 +13,10 @@ DeepmdData, ) +from .common import ( + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: places = 6 else: diff --git a/source/tests/tf/test_deeppolar.py b/source/tests/tf/test_deeppolar.py index 45b420f11a..cfa115c59f 100644 --- a/source/tests/tf/test_deeppolar.py +++ b/source/tests/tf/test_deeppolar.py @@ -4,10 +4,6 @@ import ase.neighborlist import numpy as np -from common import ( - infer_path, - tf, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -20,6 +16,11 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, + tf, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_deeppot_a.py b/source/tests/tf/test_deeppot_a.py index b19f2bfc6c..af060aca1c 100644 --- a/source/tests/tf/test_deeppot_a.py +++ b/source/tests/tf/test_deeppot_a.py @@ -6,11 +6,6 @@ import ase.neighborlist import dpdata import numpy as np -from common import ( - infer_path, - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -31,6 +26,12 @@ detect_model_version, ) +from .common import ( + infer_path, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_deeppot_r.py b/source/tests/tf/test_deeppot_r.py index e345ddd94e..482a8c42ee 100644 --- a/source/tests/tf/test_deeppot_r.py +++ b/source/tests/tf/test_deeppot_r.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from common import ( - infer_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -18,6 +15,10 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_deeppot_spin.py b/source/tests/tf/test_deeppot_spin.py index b1d99b57dd..d64cdf2dd6 100644 --- a/source/tests/tf/test_deeppot_spin.py +++ b/source/tests/tf/test_deeppot_spin.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from common import ( - infer_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -17,6 +14,10 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_descrpt_hybrid.py b/source/tests/tf/test_descrpt_hybrid.py index 08177f6a08..7c9d38cf7b 100644 --- a/source/tests/tf/test_descrpt_hybrid.py +++ b/source/tests/tf/test_descrpt_hybrid.py @@ -2,11 +2,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -22,6 +17,12 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_descrpt_nonsmth.py b/source/tests/tf/test_descrpt_nonsmth.py index 31f9da7ff2..63c5f15c85 100644 --- a/source/tests/tf/test_descrpt_nonsmth.py +++ b/source/tests/tf/test_descrpt_nonsmth.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, comp=0, pbc=True, sess=None): diff --git a/source/tests/tf/test_descrpt_se_a_mask.py b/source/tests/tf/test_descrpt_se_a_mask.py index 675ef4b2e5..b6488d88c6 100644 --- a/source/tests/tf/test_descrpt_se_a_mask.py +++ b/source/tests/tf/test_descrpt_se_a_mask.py @@ -2,12 +2,6 @@ import os import numpy as np -from common import ( - DataSystem, - infer_path, - j_loader, - tests_path, -) from deepmd.tf.common import ( j_must_have, @@ -25,6 +19,13 @@ convert_pbtxt_to_pb, ) +from .common import ( + DataSystem, + infer_path, + j_loader, + tests_path, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_descrpt_se_a_type.py b/source/tests/tf/test_descrpt_se_a_type.py index f5f294be35..43ed34dc92 100644 --- a/source/tests/tf/test_descrpt_se_a_type.py +++ b/source/tests/tf/test_descrpt_se_a_type.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -19,6 +14,12 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_descrpt_se_atten.py b/source/tests/tf/test_descrpt_se_atten.py index d7e3c31f2c..d7ffc4bf8d 100644 --- a/source/tests/tf/test_descrpt_se_atten.py +++ b/source/tests/tf/test_descrpt_se_atten.py @@ -3,11 +3,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -23,6 +18,12 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_descrpt_se_r.py b/source/tests/tf/test_descrpt_se_r.py index 9e01bc83fd..d95c8fbb21 100644 --- a/source/tests/tf/test_descrpt_se_r.py +++ b/source/tests/tf/test_descrpt_se_r.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, pbc=True, sess=None): diff --git a/source/tests/tf/test_descrpt_sea_ef.py b/source/tests/tf/test_descrpt_sea_ef.py index 42f26da887..e9e990a659 100644 --- a/source/tests/tf/test_descrpt_sea_ef.py +++ b/source/tests/tf/test_descrpt_sea_ef.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, pbc=True, sess=None): diff --git a/source/tests/tf/test_descrpt_sea_ef_para.py b/source/tests/tf/test_descrpt_sea_ef_para.py index 16c92a5dc7..1af6ea648a 100644 --- a/source/tests/tf/test_descrpt_sea_ef_para.py +++ b/source/tests/tf/test_descrpt_sea_ef_para.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, pbc=True, sess=None): diff --git a/source/tests/tf/test_descrpt_sea_ef_vert.py b/source/tests/tf/test_descrpt_sea_ef_vert.py index bc27a7c933..09bca9b754 100644 --- a/source/tests/tf/test_descrpt_sea_ef_vert.py +++ b/source/tests/tf/test_descrpt_sea_ef_vert.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, pbc=True, sess=None): diff --git a/source/tests/tf/test_descrpt_smooth.py b/source/tests/tf/test_descrpt_smooth.py index 206aca8d8a..91a3f7dbf0 100644 --- a/source/tests/tf/test_descrpt_smooth.py +++ b/source/tests/tf/test_descrpt_smooth.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) # load grad of force module from deepmd.tf.env import ( @@ -18,6 +11,14 @@ tf, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + class Inter: def setUp(self, data, pbc=True, sess=None): diff --git a/source/tests/tf/test_dipole_se_a.py b/source/tests/tf/test_dipole_se_a.py index ca31ce87d5..f0e495ef21 100644 --- a/source/tests/tf/test_dipole_se_a.py +++ b/source/tests/tf/test_dipole_se_a.py @@ -1,12 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - finite_difference, - gen_data, - j_loader, - strerch_box, -) from deepmd.tf.common import ( j_must_have, @@ -24,6 +17,14 @@ DipoleModel, ) +from .common import ( + DataSystem, + finite_difference, + gen_data, + j_loader, + strerch_box, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_dipole_se_a_tebd.py b/source/tests/tf/test_dipole_se_a_tebd.py index b211d0eb48..ed403bd047 100644 --- a/source/tests/tf/test_dipole_se_a_tebd.py +++ b/source/tests/tf/test_dipole_se_a_tebd.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - finite_difference, - gen_data, - j_loader, - strerch_box, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -30,6 +23,14 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + finite_difference, + gen_data, + j_loader, + strerch_box, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_dipolecharge.py b/source/tests/tf/test_dipolecharge.py index 0c6d0a54b7..408b1bbdf2 100644 --- a/source/tests/tf/test_dipolecharge.py +++ b/source/tests/tf/test_dipolecharge.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from common import ( - infer_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -17,6 +14,10 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_dp_test.py b/source/tests/tf/test_dp_test.py index ce1f683b7c..9a3dde3da0 100644 --- a/source/tests/tf/test_dp_test.py +++ b/source/tests/tf/test_dp_test.py @@ -8,15 +8,16 @@ import dpdata import numpy as np -from common import ( - infer_path, -) from deepmd.tf.entrypoints.test import test as dp_test from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + default_places = 6 diff --git a/source/tests/tf/test_finetune_se_atten.py b/source/tests/tf/test_finetune_se_atten.py index 47fedcf685..35eb994a46 100644 --- a/source/tests/tf/test_finetune_se_atten.py +++ b/source/tests/tf/test_finetune_se_atten.py @@ -5,11 +5,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -32,6 +27,12 @@ get_tensor_by_name, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_fitting_dos.py b/source/tests/tf/test_fitting_dos.py index 532bcfafbc..a2a54d6287 100644 --- a/source/tests/tf/test_fitting_dos.py +++ b/source/tests/tf/test_fitting_dos.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -19,6 +14,12 @@ DOSFitting, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_fitting_ener_type.py b/source/tests/tf/test_fitting_ener_type.py index 05a9d053ab..4dd6fb80a1 100644 --- a/source/tests/tf/test_fitting_ener_type.py +++ b/source/tests/tf/test_fitting_ener_type.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -19,6 +14,12 @@ EnerFitting, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_fitting_stat.py b/source/tests/tf/test_fitting_stat.py index 2b20dd5a4c..9e2408c57b 100644 --- a/source/tests/tf/test_fitting_stat.py +++ b/source/tests/tf/test_fitting_stat.py @@ -5,9 +5,6 @@ ) import numpy as np -from common import ( - j_loader, -) from deepmd.tf.descriptor import ( DescrptSeA, @@ -16,6 +13,10 @@ EnerFitting, ) +from .common import ( + j_loader, +) + input_json = "water_se_a_afparam.json" diff --git a/source/tests/tf/test_get_potential.py b/source/tests/tf/test_get_potential.py index a8ed61cdfb..47462a20a3 100644 --- a/source/tests/tf/test_get_potential.py +++ b/source/tests/tf/test_get_potential.py @@ -3,10 +3,6 @@ import unittest -from common import ( - infer_path, -) - from deepmd.tf.infer import ( DeepDipole, DeepPolar, @@ -17,6 +13,10 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + class TestGetPotential(unittest.TestCase): def setUp(self): diff --git a/source/tests/tf/test_init_frz_model_multi.py b/source/tests/tf/test_init_frz_model_multi.py index fc37d82397..b723134ca1 100644 --- a/source/tests/tf/test_init_frz_model_multi.py +++ b/source/tests/tf/test_init_frz_model_multi.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -33,6 +28,12 @@ replace_model_params_with_frz_multi_model, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_se_a.py b/source/tests/tf/test_init_frz_model_se_a.py index 7545e3aae9..5d4ed1063c 100644 --- a/source/tests/tf/test_init_frz_model_se_a.py +++ b/source/tests/tf/test_init_frz_model_se_a.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -30,6 +25,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_se_a_tebd.py b/source/tests/tf/test_init_frz_model_se_a_tebd.py index 1b282c00d5..afc1e46ed8 100644 --- a/source/tests/tf/test_init_frz_model_se_a_tebd.py +++ b/source/tests/tf/test_init_frz_model_se_a_tebd.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -30,6 +25,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_se_a_type.py b/source/tests/tf/test_init_frz_model_se_a_type.py index b356dbf6d0..48ff4eb294 100644 --- a/source/tests/tf/test_init_frz_model_se_a_type.py +++ b/source/tests/tf/test_init_frz_model_se_a_type.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -30,6 +25,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_se_atten.py b/source/tests/tf/test_init_frz_model_se_atten.py index 7889440cd3..a114deffc8 100644 --- a/source/tests/tf/test_init_frz_model_se_atten.py +++ b/source/tests/tf/test_init_frz_model_se_atten.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -31,6 +26,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_se_r.py b/source/tests/tf/test_init_frz_model_se_r.py index fd916b3fdc..100c09196e 100644 --- a/source/tests/tf/test_init_frz_model_se_r.py +++ b/source/tests/tf/test_init_frz_model_se_r.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -30,6 +25,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_init_frz_model_spin.py b/source/tests/tf/test_init_frz_model_spin.py index b5c480c2ba..c2c433cde0 100644 --- a/source/tests/tf/test_init_frz_model_spin.py +++ b/source/tests/tf/test_init_frz_model_spin.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - j_loader, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -30,6 +25,12 @@ DeepmdDataSystem, ) +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_layer_name.py b/source/tests/tf/test_layer_name.py index 71229b5ce7..8c2264315f 100644 --- a/source/tests/tf/test_layer_name.py +++ b/source/tests/tf/test_layer_name.py @@ -1,11 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - del_data, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -24,6 +18,13 @@ MultiModel, ) +from .common import ( + DataSystem, + del_data, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_linear_model.py b/source/tests/tf/test_linear_model.py index 551423001a..95ece9c19f 100644 --- a/source/tests/tf/test_linear_model.py +++ b/source/tests/tf/test_linear_model.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import os -import sys import numpy as np @@ -19,8 +18,7 @@ convert_pbtxt_to_pb, ) -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) -from common import ( +from .common import ( DataSystem, del_data, gen_data, diff --git a/source/tests/tf/test_mixed_prec_training.py b/source/tests/tf/test_mixed_prec_training.py index 620a9b9fd0..63504134af 100644 --- a/source/tests/tf/test_mixed_prec_training.py +++ b/source/tests/tf/test_mixed_prec_training.py @@ -5,13 +5,6 @@ import unittest import numpy as np - -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) from packaging.version import ( Version, ) @@ -20,6 +13,13 @@ TF_VERSION, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + def _file_delete(file): if os.path.isdir(file): diff --git a/source/tests/tf/test_model_compression_se_a.py b/source/tests/tf/test_model_compression_se_a.py index 0a6b7c85cb..37d1857661 100644 --- a/source/tests/tf/test_model_compression_se_a.py +++ b/source/tests/tf/test_model_compression_se_a.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_compression_se_a_ebd.py b/source/tests/tf/test_model_compression_se_a_ebd.py index 8b64117acd..1ab0cfe5cc 100644 --- a/source/tests/tf/test_model_compression_se_a_ebd.py +++ b/source/tests/tf/test_model_compression_se_a_ebd.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py b/source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py index 741c95b26e..5ae8ef4990 100644 --- a/source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py +++ b/source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py b/source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py index bdf09cf3e8..3726fc2bda 100644 --- a/source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py +++ b/source/tests/tf/test_model_compression_se_a_type_one_side_exclude_types.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_compression_se_atten.py b/source/tests/tf/test_model_compression_se_atten.py index 2e250fe80e..dbc54dd51a 100644 --- a/source/tests/tf/test_model_compression_se_atten.py +++ b/source/tests/tf/test_model_compression_se_atten.py @@ -5,13 +5,6 @@ import unittest import numpy as np - -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf.env import ( @@ -21,6 +14,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + def _file_delete(file): if os.path.isdir(file): diff --git a/source/tests/tf/test_model_compression_se_r.py b/source/tests/tf/test_model_compression_se_r.py index 0c5912164f..4a5d9ad9f6 100644 --- a/source/tests/tf/test_model_compression_se_r.py +++ b/source/tests/tf/test_model_compression_se_r.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_compression_se_t.py b/source/tests/tf/test_model_compression_se_t.py index eb33ce2b93..0cf1135f8a 100644 --- a/source/tests/tf/test_model_compression_se_t.py +++ b/source/tests/tf/test_model_compression_se_t.py @@ -6,13 +6,6 @@ import numpy as np -# from deepmd.tf.entrypoints.compress import compress -from common import ( - j_loader, - run_dp, - tests_path, -) - from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) @@ -20,6 +13,13 @@ DeepPot, ) +# from deepmd.tf.entrypoints.compress import compress +from .common import ( + j_loader, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_model_devi.py b/source/tests/tf/test_model_devi.py index 0085387323..58a6266ca9 100644 --- a/source/tests/tf/test_model_devi.py +++ b/source/tests/tf/test_model_devi.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import os -import sys import unittest import numpy as np @@ -12,19 +11,17 @@ from deepmd.tf.infer.model_devi import ( make_model_devi, ) +from deepmd.tf.utils.convert import ( + convert_pbtxt_to_pb, +) -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) -from common import ( +from .common import ( del_data, gen_data, infer_path, tests_path, ) -from deepmd.tf.utils.convert import ( - convert_pbtxt_to_pb, -) - class TestMakeModelDevi(unittest.TestCase): def setUp(self): diff --git a/source/tests/tf/test_model_devi_mix.py b/source/tests/tf/test_model_devi_mix.py index 60716d020a..d9062e939a 100644 --- a/source/tests/tf/test_model_devi_mix.py +++ b/source/tests/tf/test_model_devi_mix.py @@ -1,10 +1,13 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import os -import sys import unittest import numpy as np +from packaging.version import parse as parse_version +from deepmd.tf.env import ( + tf, +) from deepmd.tf.infer import ( DeepPotential, calc_model_devi, @@ -12,22 +15,16 @@ from deepmd.tf.infer.model_devi import ( make_model_devi, ) +from deepmd.tf.utils.convert import ( + convert_pbtxt_to_pb, +) -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) -from common import ( +from .common import ( del_data, gen_data, infer_path, tests_path, ) -from packaging.version import parse as parse_version - -from deepmd.tf.env import ( - tf, -) -from deepmd.tf.utils.convert import ( - convert_pbtxt_to_pb, -) @unittest.skipIf( diff --git a/source/tests/tf/test_model_dos.py b/source/tests/tf/test_model_dos.py index 72cd9db524..d88c81c332 100644 --- a/source/tests/tf/test_model_dos.py +++ b/source/tests/tf/test_model_dos.py @@ -1,11 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - del_data, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -23,6 +17,13 @@ DOSModel, ) +from .common import ( + DataSystem, + del_data, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_loc_frame.py b/source/tests/tf/test_model_loc_frame.py index 035ffc868e..f97e349145 100644 --- a/source/tests/tf/test_model_loc_frame.py +++ b/source/tests/tf/test_model_loc_frame.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_multi.py b/source/tests/tf/test_model_multi.py index fa75951366..c526b479a6 100644 --- a/source/tests/tf/test_model_multi.py +++ b/source/tests/tf/test_model_multi.py @@ -1,13 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - del_data, - finite_difference, - gen_data, - j_loader, - strerch_box, -) from deepmd.tf.common import ( j_must_have, @@ -26,6 +18,15 @@ MultiModel, ) +from .common import ( + DataSystem, + del_data, + finite_difference, + gen_data, + j_loader, + strerch_box, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_pairtab.py b/source/tests/tf/test_model_pairtab.py index 8a7ebd605c..e2c45ee50c 100644 --- a/source/tests/tf/test_model_pairtab.py +++ b/source/tests/tf/test_model_pairtab.py @@ -1,11 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np import scipy.spatial.distance -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -17,6 +12,12 @@ Model, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a.py b/source/tests/tf/test_model_se_a.py index f537452385..57a8f4af52 100644 --- a/source/tests/tf/test_model_se_a.py +++ b/source/tests/tf/test_model_se_a.py @@ -1,12 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import dpdata import numpy as np -from common import ( - DataSystem, - del_data, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -27,6 +21,13 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + del_data, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_aparam.py b/source/tests/tf/test_model_se_a_aparam.py index aca2d8c63c..6b37dfd459 100644 --- a/source/tests/tf/test_model_se_a_aparam.py +++ b/source/tests/tf/test_model_se_a_aparam.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_ebd.py b/source/tests/tf/test_model_se_a_ebd.py index 2e133a9a63..b819c2ddc9 100644 --- a/source/tests/tf/test_model_se_a_ebd.py +++ b/source/tests/tf/test_model_se_a_ebd.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_ebd_v2.py b/source/tests/tf/test_model_se_a_ebd_v2.py index f302308a73..0cc89f5151 100644 --- a/source/tests/tf/test_model_se_a_ebd_v2.py +++ b/source/tests/tf/test_model_se_a_ebd_v2.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -25,6 +20,12 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_fparam.py b/source/tests/tf/test_model_se_a_fparam.py index 46aac18fcb..806ae13582 100644 --- a/source/tests/tf/test_model_se_a_fparam.py +++ b/source/tests/tf/test_model_se_a_fparam.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_srtab.py b/source/tests/tf/test_model_se_a_srtab.py index 3fcb55050d..3a93349741 100644 --- a/source/tests/tf/test_model_se_a_srtab.py +++ b/source/tests/tf/test_model_se_a_srtab.py @@ -2,11 +2,6 @@ import os import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -24,6 +19,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_a_type.py b/source/tests/tf/test_model_se_a_type.py index bc2a2c3045..4b19378cf6 100644 --- a/source/tests/tf/test_model_se_a_type.py +++ b/source/tests/tf/test_model_se_a_type.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -25,6 +20,12 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_atten.py b/source/tests/tf/test_model_se_atten.py index 592858db2a..ad6926e0da 100644 --- a/source/tests/tf/test_model_se_atten.py +++ b/source/tests/tf/test_model_se_atten.py @@ -3,13 +3,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - check_smooth_efv, - finite_difference_fv, - gen_data, - j_loader, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -31,6 +24,14 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + check_smooth_efv, + finite_difference_fv, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_r.py b/source/tests/tf/test_model_se_r.py index acfe6e95dd..a635e6c3c4 100644 --- a/source/tests/tf/test_model_se_r.py +++ b/source/tests/tf/test_model_se_r.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_se_t.py b/source/tests/tf/test_model_se_t.py index cb8ed97833..881a0e06c4 100644 --- a/source/tests/tf/test_model_se_t.py +++ b/source/tests/tf/test_model_se_t.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -22,6 +17,12 @@ EnerModel, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_model_spin.py b/source/tests/tf/test_model_spin.py index e6aa585df7..26100c19d0 100644 --- a/source/tests/tf/test_model_spin.py +++ b/source/tests/tf/test_model_spin.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - del_data, - gen_data, - j_loader, - tests_path, -) from deepmd.tf.common import ( j_must_have, @@ -29,6 +22,14 @@ Spin, ) +from .common import ( + DataSystem, + del_data, + gen_data, + j_loader, + tests_path, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_nvnmd_entrypoints.py b/source/tests/tf/test_nvnmd_entrypoints.py index b257f8fffa..cc7a92c032 100644 --- a/source/tests/tf/test_nvnmd_entrypoints.py +++ b/source/tests/tf/test_nvnmd_entrypoints.py @@ -3,9 +3,6 @@ import numpy as np import pytest -from common import ( - tests_path, -) from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, @@ -44,6 +41,10 @@ update_deepmd_input, ) +from .common import ( + tests_path, +) + class TestNvnmdEntrypointsV0(tf.test.TestCase): @pytest.mark.run(order=0) diff --git a/source/tests/tf/test_pairwise_dprc.py b/source/tests/tf/test_pairwise_dprc.py index a38c856c26..afe6885542 100644 --- a/source/tests/tf/test_pairwise_dprc.py +++ b/source/tests/tf/test_pairwise_dprc.py @@ -5,10 +5,6 @@ import dpdata import numpy as np -from common import ( - run_dp, - tests_path, -) from packaging.version import parse as parse_version from deepmd.tf import ( @@ -38,6 +34,11 @@ run_sess, ) +from .common import ( + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_parallel_training.py b/source/tests/tf/test_parallel_training.py index 85311cf558..1f93c809a2 100644 --- a/source/tests/tf/test_parallel_training.py +++ b/source/tests/tf/test_parallel_training.py @@ -3,14 +3,14 @@ import subprocess as sp import unittest -from common import ( - tests_path, -) - from deepmd.tf.cluster.local import ( get_gpus, ) +from .common import ( + tests_path, +) + class TestSingleMachine(unittest.TestCase): def setUp(self): diff --git a/source/tests/tf/test_polar_se_a.py b/source/tests/tf/test_polar_se_a.py index 39c34f0a01..04487dec7b 100644 --- a/source/tests/tf/test_polar_se_a.py +++ b/source/tests/tf/test_polar_se_a.py @@ -1,12 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - finite_difference, - gen_data, - j_loader, - strerch_box, -) from deepmd.tf.common import ( j_must_have, @@ -24,6 +17,14 @@ PolarModel, ) +from .common import ( + DataSystem, + finite_difference, + gen_data, + j_loader, + strerch_box, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_polar_se_a_tebd.py b/source/tests/tf/test_polar_se_a_tebd.py index 1c82488dca..38c3ae20ef 100644 --- a/source/tests/tf/test_polar_se_a_tebd.py +++ b/source/tests/tf/test_polar_se_a_tebd.py @@ -2,13 +2,6 @@ import unittest import numpy as np -from common import ( - DataSystem, - finite_difference, - gen_data, - j_loader, - strerch_box, -) from packaging.version import parse as parse_version from deepmd.tf.common import ( @@ -30,6 +23,14 @@ TypeEmbedNet, ) +from .common import ( + DataSystem, + finite_difference, + gen_data, + j_loader, + strerch_box, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_tab_nonsmth.py b/source/tests/tf/test_tab_nonsmth.py index 6b09b98428..d65ec8f9c4 100644 --- a/source/tests/tf/test_tab_nonsmth.py +++ b/source/tests/tf/test_tab_nonsmth.py @@ -3,13 +3,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) from test_descrpt_nonsmth import ( Inter, ) @@ -24,6 +17,14 @@ PairTab, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + def _make_tab(ntype): xx = np.arange(0, 9, 0.001) diff --git a/source/tests/tf/test_tab_smooth.py b/source/tests/tf/test_tab_smooth.py index f823b366c8..578daf68ad 100644 --- a/source/tests/tf/test_tab_smooth.py +++ b/source/tests/tf/test_tab_smooth.py @@ -3,13 +3,6 @@ import unittest import numpy as np -from common import ( - Data, - force_dw_test, - force_test, - virial_dw_test, - virial_test, -) from test_descrpt_smooth import ( Inter, ) @@ -23,6 +16,14 @@ PairTab, ) +from .common import ( + Data, + force_dw_test, + force_test, + virial_dw_test, + virial_test, +) + def _make_tab(ntype): xx = np.arange(0, 9, 0.001) diff --git a/source/tests/tf/test_transfer.py b/source/tests/tf/test_transfer.py index b16c070381..e5b7f0a906 100644 --- a/source/tests/tf/test_transfer.py +++ b/source/tests/tf/test_transfer.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - infer_path, - run_dp, - tests_path, -) from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, @@ -20,6 +15,12 @@ convert_pbtxt_to_pb, ) +from .common import ( + infer_path, + run_dp, + tests_path, +) + if GLOBAL_NP_FLOAT_PRECISION == np.float32: default_places = 4 else: diff --git a/source/tests/tf/test_type_one_side.py b/source/tests/tf/test_type_one_side.py index d1c02981e7..5c71a41739 100644 --- a/source/tests/tf/test_type_one_side.py +++ b/source/tests/tf/test_type_one_side.py @@ -1,10 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from common import ( - DataSystem, - gen_data, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -16,6 +11,12 @@ tf, ) +from .common import ( + DataSystem, + gen_data, + j_loader, +) + GLOBAL_ENER_FLOAT_PRECISION = tf.float64 GLOBAL_TF_FLOAT_PRECISION = tf.float64 GLOBAL_NP_FLOAT_PRECISION = np.float64 diff --git a/source/tests/tf/test_virtual_type.py b/source/tests/tf/test_virtual_type.py index ef12a1aed4..5ceb1c7637 100644 --- a/source/tests/tf/test_virtual_type.py +++ b/source/tests/tf/test_virtual_type.py @@ -4,11 +4,6 @@ import unittest import numpy as np -from common import ( - gen_data, - infer_path, - j_loader, -) from deepmd.tf.common import ( j_must_have, @@ -26,6 +21,12 @@ NeighborStat, ) +from .common import ( + gen_data, + infer_path, + j_loader, +) + class TestVirtualType(unittest.TestCase): @classmethod From 1342e6b8e07b0eb285f7b302dd4fb9f01144c187 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:56:24 -0500 Subject: [PATCH 10/14] fix Signed-off-by: Jinzhe Zeng --- source/tests/common/test_uni_infer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/tests/common/test_uni_infer.py b/source/tests/common/test_uni_infer.py index bdde7ae422..139d1f9ec9 100644 --- a/source/tests/common/test_uni_infer.py +++ b/source/tests/common/test_uni_infer.py @@ -4,16 +4,16 @@ import os import unittest -from common import ( - infer_path, -) - from deepmd.infer.deep_pot import DeepPot as DeepPot from deepmd.tf.infer.deep_pot import DeepPot as DeepPotTF from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + class TestUniversalInfer(unittest.TestCase): @classmethod From cd72f9d21f996a0016b7451c34bdfabf176d3516 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 19:57:03 -0500 Subject: [PATCH 11/14] add __init__.py Signed-off-by: Jinzhe Zeng --- source/tests/tf/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 source/tests/tf/__init__.py diff --git a/source/tests/tf/__init__.py b/source/tests/tf/__init__.py new file mode 100644 index 0000000000..6ceb116d85 --- /dev/null +++ b/source/tests/tf/__init__.py @@ -0,0 +1 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later From 219b78a3ae30e7812cafc5f2feaebf17e01e6720 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 20:00:42 -0500 Subject: [PATCH 12/14] fix the path of test_lammps.py Signed-off-by: Jinzhe Zeng --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6c8632ddb9..1d37246a88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,7 +130,7 @@ test-command = [ "python -m deepmd -h", "dp -h", "dp_ipi", - "pytest {project}/source/tests/test_lammps.py" + "pytest {project}/source/tests/tf/test_lammps.py" ] test-extras = ["cpu", "test", "lmp", "ipi"] build = ["cp310-*"] From ca582fda0a9a0a952df7a4ec593bc3df300cba60 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 20:24:02 -0500 Subject: [PATCH 13/14] fix infer_path in test_lammps Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_lammps.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/tests/tf/test_lammps.py b/source/tests/tf/test_lammps.py index d235d6576e..b295d5212a 100644 --- a/source/tests/tf/test_lammps.py +++ b/source/tests/tf/test_lammps.py @@ -2,14 +2,15 @@ import os import subprocess import unittest -from pathlib import ( - Path, -) from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) +from .common import ( + infer_path, +) + @unittest.skipIf( os.environ.get("CIBUILDWHEEL", "0") != "1", @@ -20,7 +21,7 @@ class TestLAMMPS(unittest.TestCase): @classmethod def setUpClass(cls): - cls.work_dir = (Path(__file__).parent / "infer").absolute() + cls.work_dir = infer_path convert_pbtxt_to_pb( str(cls.work_dir / "deeppot.pbtxt"), str(cls.work_dir / "deep_pot.pb") From 8d8f564172a465bbc7f40a93d92e7bbd90a96ac8 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 28 Jan 2024 20:24:38 -0500 Subject: [PATCH 14/14] fix import Signed-off-by: Jinzhe Zeng --- source/tests/tf/test_tab_nonsmth.py | 6 +++--- source/tests/tf/test_tab_smooth.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/tests/tf/test_tab_nonsmth.py b/source/tests/tf/test_tab_nonsmth.py index d65ec8f9c4..7132d0c206 100644 --- a/source/tests/tf/test_tab_nonsmth.py +++ b/source/tests/tf/test_tab_nonsmth.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from test_descrpt_nonsmth import ( - Inter, -) # load grad of force module import deepmd.tf.op # noqa: F401 @@ -24,6 +21,9 @@ virial_dw_test, virial_test, ) +from .test_descrpt_nonsmth import ( + Inter, +) def _make_tab(ntype): diff --git a/source/tests/tf/test_tab_smooth.py b/source/tests/tf/test_tab_smooth.py index 578daf68ad..e0cf564cd6 100644 --- a/source/tests/tf/test_tab_smooth.py +++ b/source/tests/tf/test_tab_smooth.py @@ -3,9 +3,6 @@ import unittest import numpy as np -from test_descrpt_smooth import ( - Inter, -) # load grad of force module from deepmd.tf.env import ( @@ -23,6 +20,9 @@ virial_dw_test, virial_test, ) +from .test_descrpt_smooth import ( + Inter, +) def _make_tab(ntype):