Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pt: support multitask finetune #3480

Merged
merged 17 commits into from
Mar 22, 2024
Merged

Conversation

iProzd
Copy link
Collaborator

@iProzd iProzd commented Mar 17, 2024

This PR:

  1. merge change_energy_bias into compute_output_stats and reformat it into change_out_bias of model level.
  2. support single-task/multi-task finetuning from single-task/multi-task pretrained model.

Need fix in future PR:

  1. Finetuned model has covered type_map. (If fixed, change_out_bias func will not need the input params origin_type_map and full_type_map.) See also [BUG] Finetuned model has wrong type_map #3455.
  2. change_out_bias support for other models.(e.g. Spin, ZBL, Polar, Dipole and Dos.)

Copy link

codecov bot commented Mar 17, 2024

Codecov Report

Attention: Patch coverage is 91.81034% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 77.59%. Comparing base (145f501) to head (19b9e79).

Files Patch % Lines
deepmd/dpmodel/atomic_model/linear_atomic_model.py 40.00% 3 Missing ⚠️
...eepmd/pt/model/atomic_model/linear_atomic_model.py 40.00% 3 Missing ⚠️
deepmd/pt/utils/finetune.py 95.65% 3 Missing ⚠️
deepmd/dpmodel/atomic_model/dp_atomic_model.py 50.00% 2 Missing ⚠️
...eepmd/dpmodel/atomic_model/pairtab_atomic_model.py 50.00% 2 Missing ⚠️
...epmd/pt/model/atomic_model/pairtab_atomic_model.py 50.00% 2 Missing ⚠️
deepmd/utils/finetune.py 50.00% 2 Missing ⚠️
deepmd/pt/model/atomic_model/base_atomic_model.py 96.87% 1 Missing ⚠️
deepmd/pt/utils/auto_batch_size.py 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3480      +/-   ##
==========================================
+ Coverage   77.48%   77.59%   +0.10%     
==========================================
  Files         432      432              
  Lines       37182    37314     +132     
  Branches     1620     1620              
==========================================
+ Hits        28812    28955     +143     
+ Misses       7502     7491      -11     
  Partials      868      868              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

deepmd/pt/utils/stat.py Outdated Show resolved Hide resolved
deepmd/pt/utils/stat.py Outdated Show resolved Hide resolved
deepmd/pt/utils/stat.py Outdated Show resolved Hide resolved
deepmd/pt/utils/finetune.py Show resolved Hide resolved
deepmd/pt/model/model/ener_model.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It seems that the change output bias should be place in atomic model (current bias can also be computed by the forward_atomic method)
  • the implementation should be able to reused by other atomic models, including the zbl and linear models, thus it is either placed in base_atomic_model, or be designed as a common method called by models, just like the compute_output_stat.

deepmd/pt/model/model/ener_model.py Outdated Show resolved Hide resolved
@anyangml anyangml mentioned this pull request Mar 18, 2024
5 tasks
@iProzd iProzd requested a review from wanghan-iapcm March 21, 2024 12:11
deepmd/pt/model/atomic_model/base_atomic_model.py Outdated Show resolved Hide resolved
deepmd/pt/model/atomic_model/base_atomic_model.py Outdated Show resolved Hide resolved
deepmd/pt/model/atomic_model/base_atomic_model.py Outdated Show resolved Hide resolved
deepmd/pt/model/atomic_model/base_atomic_model.py Outdated Show resolved Hide resolved
deepmd/pt/train/training.py Outdated Show resolved Hide resolved
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Mar 22, 2024
Merged via the queue into deepmodeling:devel with commit e47478f Mar 22, 2024
48 checks passed
@njzjz njzjz mentioned this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

need support for multitask mode need an interface instead of fetching fitting_net!!!!!!!!!
4 participants