Upload 2 files
Browse files- modeling_internlm2.py +1 -0
- modeling_internvl_chat.py +0 -2
modeling_internlm2.py
CHANGED
|
@@ -1494,6 +1494,7 @@ class InternLM2ForCausalLM_score(InternLM2ForCausalLM):
|
|
| 1494 |
logits = logits.float()
|
| 1495 |
|
| 1496 |
scores = self.lm_regression_head(hidden_states)
|
|
|
|
| 1497 |
|
| 1498 |
if input_ids is not None:
|
| 1499 |
batch_size = input_ids.shape[0]
|
|
|
|
| 1494 |
logits = logits.float()
|
| 1495 |
|
| 1496 |
scores = self.lm_regression_head(hidden_states)
|
| 1497 |
+
scores = F.sigmoid(scores)
|
| 1498 |
|
| 1499 |
if input_ids is not None:
|
| 1500 |
batch_size = input_ids.shape[0]
|
modeling_internvl_chat.py
CHANGED
|
@@ -28,8 +28,6 @@ weight_tensor = torch.Tensor([5.,4.,3.,2.,1.])
|
|
| 28 |
|
| 29 |
def get_special_token(tokenizer):
|
| 30 |
preferential_ids_ = [id_[-1] for id_ in tokenizer(special_words)["input_ids"]]
|
| 31 |
-
print(preferential_ids_)
|
| 32 |
-
print(tokenizer.batch_decode(preferential_ids_))
|
| 33 |
return preferential_ids_
|
| 34 |
|
| 35 |
|
|
|
|
| 28 |
|
| 29 |
def get_special_token(tokenizer):
|
| 30 |
preferential_ids_ = [id_[-1] for id_ in tokenizer(special_words)["input_ids"]]
|
|
|
|
|
|
|
| 31 |
return preferential_ids_
|
| 32 |
|
| 33 |
|