Skip to content

Commit 0fcedc0

Browse files
shihaobaibaishihao
and
baishihao
authored
fix: vit config (#704)
Co-authored-by: baishihao <[email protected]>
1 parent 40f1d20 commit 0fcedc0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightllm/models/vit/model.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from lightllm.models.vit.layer_weights.pre_and_post_layer_weight import ViTPreAndPostLayerWeight
88
from lightllm.models.vit.layer_weights.transformer_layer_weight import ViTTransformerLayerWeight
99
from lightllm.models.vit.layer_weights.hf_load_utils import load_hf_weights
10+
from lightllm.common.build_utils import repair_config
1011
from lightllm.utils.log_utils import init_logger
1112
from lightllm.models.vit import get_load_image_func
1213
import torchvision.transforms as T
@@ -59,6 +60,9 @@ def _init_config(self):
5960
self.config["vision_config"]["llm_hidden_size"] = self.config["llm_config"]["hidden_size"]
6061
self.config["vision_config"]["downsample_ratio"] = self.config["downsample_ratio"]
6162
self.config = self.config["vision_config"]
63+
repair_config(self.config, same_names=["num_attention_heads", "n_head"])
64+
repair_config(self.config, same_names=["hidden_size", "n_embd", "n_embed"])
65+
repair_config(self.config, same_names=["num_hidden_layers", "n_layer"])
6266
self.layers_num = self.config["num_hidden_layers"]
6367
return
6468

0 commit comments

Comments
 (0)