@@ -841,10 +841,10 @@ class DPAFineTuner:
841841 Auto-detected from the checkpoint if not provided.
842842 downstream_task_type : str
843843 (MFT only) Task type of the downstream head (``"property"`` etc.).
844- aux_batch_size : str or None
844+ aux_batch_size : str or int or None
845845 (MFT only) Batch-size spec for the auxiliary head.
846- downstream_batch_size : int or None
847- (MFT only) Batch size for the downstream head.
846+ downstream_batch_size : str or int or None
847+ (MFT only) Batch- size spec for the downstream head.
848848 """
849849
850850 _VALID_POOLING : ClassVar [set [str ]] = {"mean" , "sum" , "mean+std" , "mean+std+max+min" }
@@ -886,8 +886,8 @@ def __init__(
886886 aux_prob : float = 0.5 ,
887887 type_map : list [str ] | None = None ,
888888 downstream_task_type : str = "property" ,
889- aux_batch_size : str | None = None ,
890- downstream_batch_size : int | None = None ,
889+ aux_batch_size : str | int | None = None ,
890+ downstream_batch_size : str | int | None = None ,
891891 ) -> None :
892892 if pooling not in self ._VALID_POOLING :
893893 raise ValueError (
@@ -1041,7 +1041,7 @@ def _extract_features_cached(self, systems: list[dpdata.System]) -> np.ndarray:
10411041 except Exception :
10421042 # Cache read failed (e.g. corrupted file, permissions) —
10431043 # fall through and recompute features from scratch.
1044- pass
1044+ _LOG . debug ( "Descriptor cache read failed, recomputing." , exc_info = True )
10451045
10461046 features = self ._extract_features (systems )
10471047 try :
@@ -1050,7 +1050,7 @@ def _extract_features_cached(self, systems: list[dpdata.System]) -> np.ndarray:
10501050 except Exception :
10511051 # Cache write is best-effort — silently skip on permission errors
10521052 # or disk-full conditions; the features are already in memory.
1053- pass
1053+ _LOG . debug ( "Descriptor cache write failed." , exc_info = True )
10541054 return features
10551055
10561056 def _extract_features (self , systems : list [dpdata .System ]) -> np .ndarray :
@@ -1099,9 +1099,10 @@ def _resolve_type_maps(self, train_data: str | list[str]) -> list[str]:
10991099
11001100 try :
11011101 elements = read_data_type_map_union (systems )
1102- validate_type_map_subset (elements , tm , label = "train data" )
11031102 except ValueError :
11041103 pass # no atom_names — deepmd uses raw atom indices
1104+ else :
1105+ validate_type_map_subset (elements , tm , label = "train data" )
11051106
11061107 return tm
11071108
@@ -1372,6 +1373,10 @@ def fit(
13721373 "strategy='mft' requires aux_data. "
13731374 "Provide auxiliary system directories for the force-field head."
13741375 )
1376+ if type_map is not None :
1377+ self .type_map = type_map
1378+ if self ._mft is not None :
1379+ self ._mft .type_map = type_map
13751380 return self ._fit_mft (train_data , aux_data , valid_data )
13761381
13771382 # ---- single-task training paradigms ----
@@ -1719,6 +1724,5 @@ def freeze(self, output_path: str = "frozen_model.pth") -> str:
17191724 import torch
17201725
17211726 torch .save (bundle , output_path )
1722- _LOG = logging .getLogger ("dpa_adapt" )
17231727 _LOG .info ("Frozen model saved to: %s" , output_path )
17241728 return output_path
0 commit comments