LossFunctionLover commited on
Commit
44d5eef
Β·
verified Β·
1 Parent(s): e3a4d71

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -68,7 +68,7 @@ Input Text (Reasoning Trace)
68
  ↓
69
  [Frozen Base LM Encoder] ← Pre-trained, frozen during training
70
  ↓
71
- [Final Token (EOS) Pooling]
72
  ↓
73
  [Lightweight Linear Head] ← Only these parameters are trained
74
  ↓
@@ -219,12 +219,13 @@ base_model = AutoModel.from_pretrained("facebook/opt-1.3b")
219
  tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
220
 
221
  # Load the trained scoring head weights
222
- scoring_head_weights = torch.load(model_path, map_location="cpu")
 
223
 
224
  # Initialize scoring head (single linear layer)
225
  hidden_size = base_model.config.hidden_size
226
  scoring_head = torch.nn.Linear(hidden_size, 1)
227
- scoring_head.load_state_dict(scoring_head_weights)
228
 
229
  # Move to device
230
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
68
  ↓
69
  [Frozen Base LM Encoder] ← Pre-trained, frozen during training
70
  ↓
71
+ [Final Non-Padding Token Pooling (attention-mask aware)]
72
  ↓
73
  [Lightweight Linear Head] ← Only these parameters are trained
74
  ↓
 
219
  tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
220
 
221
  # Load the trained scoring head weights
222
+ ckpt = torch.load(model_path, map_location="cpu")
223
+ state = ckpt["model_state"] if "model_state" in ckpt else ckpt
224
 
225
  # Initialize scoring head (single linear layer)
226
  hidden_size = base_model.config.hidden_size
227
  scoring_head = torch.nn.Linear(hidden_size, 1)
228
+ scoring_head.load_state_dict(state)
229
 
230
  # Move to device
231
  device = "cuda" if torch.cuda.is_available() else "cpu"