summerMC commited on
Commit
b5f9a2e
·
verified ·
1 Parent(s): 12e0dee

Upload modeling_trm_text_ism.py

Browse files
Files changed (1) hide show
  1. modeling_trm_text_ism.py +2 -3
modeling_trm_text_ism.py CHANGED
@@ -51,6 +51,7 @@ class TRMBlock(nn.Module):
51
 
52
  class TRMTextISMForCausalLM(PreTrainedModel, GenerationMixin):
53
  config_class = TRMTextISMConfig
 
54
  def __init__(self, config):
55
  super().__init__(config)
56
  self.token_emb = nn.Embedding(config.vocab_size, config.dim)
@@ -76,9 +77,7 @@ class TRMTextISMForCausalLM(PreTrainedModel, GenerationMixin):
76
  def set_output_embeddings(self, value):
77
  self.lm_head = value
78
 
79
- def tie_weights(self, *args, **kwargs):
80
- if hasattr(self, 'lm_head'):
81
- self.lm_head.weight = self.token_emb.weight
82
 
83
  def prepare_inputs_for_generation(self, input_ids, attention_mask=None, **kwargs):
84
  return {"input_ids": input_ids, "attention_mask": attention_mask, "use_cache": False}
 
51
 
52
  class TRMTextISMForCausalLM(PreTrainedModel, GenerationMixin):
53
  config_class = TRMTextISMConfig
54
+
55
  def __init__(self, config):
56
  super().__init__(config)
57
  self.token_emb = nn.Embedding(config.vocab_size, config.dim)
 
77
  def set_output_embeddings(self, value):
78
  self.lm_head = value
79
 
80
+ # tie_weights は削除 → lm_head と token_emb を独立したweightとして保持
 
 
81
 
82
  def prepare_inputs_for_generation(self, input_ids, attention_mask=None, **kwargs):
83
  return {"input_ids": input_ids, "attention_mask": attention_mask, "use_cache": False}