Compare commits

...

2 Commits

Author SHA1 Message Date
Michelle0474
182f7853d7 Merge branch 'feat/moe-layer' of github-michelle:RYDE-WORK/lnp_ml into feat/moe-layer
# Conflicts:
#	lnp_ml/modeling/layers/llm_prompt.py
2026-06-22 19:46:05 +08:00
Michelle0474
54c734dc16 feat: integrate MolT5 LLM encoder and fix desc dim 2026-06-22 19:39:24 +08:00
2 changed files with 16 additions and 2 deletions

View File

@ -25,7 +25,7 @@ DEFAULT_INPUT_DIMS = {
"mpnn": 600, # D-MPNN embedding "mpnn": 600, # D-MPNN embedding
"morgan": 1024, # Morgan fingerprint "morgan": 1024, # Morgan fingerprint
"maccs": 167, # MACCS keys "maccs": 167, # MACCS keys
"desc": 210, # RDKit descriptors "desc": 217, # RDKit descriptors
# Channel B: 配方/实验条件 # Channel B: 配方/实验条件
"comp": 5, # 配方比例 "comp": 5, # 配方比例
"phys": 12, # 物理参数 one-hot "phys": 12, # 物理参数 one-hot

View File

@ -55,6 +55,13 @@ def load_model(
fusion_strategy=config["fusion_strategy"], fusion_strategy=config["fusion_strategy"],
head_hidden_dim=config["head_hidden_dim"], head_hidden_dim=config["head_hidden_dim"],
dropout=config["dropout"], dropout=config["dropout"],
use_llm=config.get("use_llm", False),
llm_model_path=config.get("llm_model_path", "models/molt5-base"),
llm_freeze=config.get("llm_freeze", True),
llm_use_lora=config.get("llm_use_lora", False),
llm_lora_r=config.get("llm_lora_r", 8),
llm_lora_alpha=config.get("llm_lora_alpha", 16),
llm_lora_dropout=config.get("llm_lora_dropout", 0.05),
mpnn_ensemble_paths=ensemble_paths, mpnn_ensemble_paths=ensemble_paths,
mpnn_device=mpnn_device, mpnn_device=mpnn_device,
) )
@ -66,9 +73,16 @@ def load_model(
fusion_strategy=config["fusion_strategy"], fusion_strategy=config["fusion_strategy"],
head_hidden_dim=config["head_hidden_dim"], head_hidden_dim=config["head_hidden_dim"],
dropout=config["dropout"], dropout=config["dropout"],
use_llm=config.get("use_llm", False),
llm_model_path=config.get("llm_model_path", "models/molt5-base"),
llm_freeze=config.get("llm_freeze", True),
llm_use_lora=config.get("llm_use_lora", False),
llm_lora_r=config.get("llm_lora_r", 8),
llm_lora_alpha=config.get("llm_lora_alpha", 16),
llm_lora_dropout=config.get("llm_lora_dropout", 0.05),
) )
model.load_state_dict(checkpoint["model_state_dict"]) model.load_state_dict(checkpoint["model_state_dict"], strict=False)
model.to(device) model.to(device)
model.eval() model.eval()