修補HuggingFace 這個版本的 bug:class-level 的 _tied_weights_keys 是 list(官方文件也這樣寫),但 _get_tied_weight_keys 卻把子模組的同名屬性當 dict 處理。
Browse files- modeling_kuixing.py +1 -1
modeling_kuixing.py
CHANGED
|
@@ -112,11 +112,11 @@ class _KuiXingCore(nn.Module):
|
|
| 112 |
class KuiXingForCausalLM(PreTrainedModel, GenerationMixin):
|
| 113 |
config_class = KuiXingHFConfig
|
| 114 |
supports_gradient_checkpointing = False
|
| 115 |
-
_tied_weights_keys = ["model.lm_head.weight"] # 加這行
|
| 116 |
|
| 117 |
def __init__(self, config):
|
| 118 |
super().__init__(config)
|
| 119 |
self.model = _KuiXingCore(config)
|
|
|
|
| 120 |
self.post_init()
|
| 121 |
|
| 122 |
def get_output_embeddings(self): # 加這個 method
|
|
|
|
| 112 |
class KuiXingForCausalLM(PreTrainedModel, GenerationMixin):
|
| 113 |
config_class = KuiXingHFConfig
|
| 114 |
supports_gradient_checkpointing = False
|
|
|
|
| 115 |
|
| 116 |
def __init__(self, config):
|
| 117 |
super().__init__(config)
|
| 118 |
self.model = _KuiXingCore(config)
|
| 119 |
+
self._tied_weights_keys = ["model.lm_head.weight"] # 加這行
|
| 120 |
self.post_init()
|
| 121 |
|
| 122 |
def get_output_embeddings(self): # 加這個 method
|