Skip to content

Commit

Permalink
Fix init_model_old_ratio for multitask (deepmodeling#221)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
  - Enhanced data initialization to support multiple tasks.
- Improved handling of multitask configurations for more accurate
calculations.
  - Updated input script generation for better automation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: zjgemi <[email protected]>
  • Loading branch information
zjgemi authored May 17, 2024
1 parent b96a3ca commit 76c9657
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dpgen2/op/run_dp_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ def execute(
auto_prob_str = "prob_sys_size"
if do_init_model:
old_ratio = config["init_model_old_ratio"]
numb_old = len(init_data) + len(iter_data_old_exp)
if config["multitask"]:
head = config["head"]
multi_init_data_idx = config["multi_init_data_idx"]
len_init = len(multi_init_data_idx[head])
else:
len_init = len(init_data)
numb_old = len_init + len(iter_data_old_exp)
numb_new = numb_old + len(iter_data_new_exp)
auto_prob_str = f"prob_sys_size; 0:{numb_old}:{old_ratio}; {numb_old}:{numb_new}:{1.-old_ratio:g}"

Expand Down Expand Up @@ -418,6 +424,7 @@ def write_data_to_input_script(
]
if k == head:
v["training_data"]["systems"] += [str(ii) for ii in iter_data]
v["training_data"]["auto_prob"] = auto_prob_str
return odict
data_list = [str(ii) for ii in init_data] + [str(ii) for ii in iter_data]
if major_version == "1":
Expand Down

0 comments on commit 76c9657

Please sign in to comment.