Add debug prints to restore method and fix angle brackets formatting
Browse files- adapter.py +8 -1
adapter.py
CHANGED
|
@@ -905,9 +905,16 @@ class AbLang2PairedHuggingFaceAdapter(AbEncoding, AbRestore, AbAlignment, AbScor
|
|
| 905 |
return [res_to_list(state, seq) for state, seq in zip(probs, formatted_seqs)]
|
| 906 |
|
| 907 |
def restore(self, seqs, align=False, **kwargs):
|
|
|
|
| 908 |
hf_abrestore = HFAbRestore(self.AbLang, self.tokenizer, spread=self.spread, device=self.used_device, ncpu=self.ncpu)
|
| 909 |
restored = hf_abrestore.restore(seqs, align=align)
|
| 910 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
return restored
|
| 912 |
|
| 913 |
def extract_input_ids(tokens, device):
|
|
|
|
| 905 |
return [res_to_list(state, seq) for state, seq in zip(probs, formatted_seqs)]
|
| 906 |
|
| 907 |
def restore(self, seqs, align=False, **kwargs):
|
| 908 |
+
print(f"DEBUG: Input sequences: {seqs}")
|
| 909 |
hf_abrestore = HFAbRestore(self.AbLang, self.tokenizer, spread=self.spread, device=self.used_device, ncpu=self.ncpu)
|
| 910 |
restored = hf_abrestore.restore(seqs, align=align)
|
| 911 |
+
print(f"DEBUG: Restored before formatting: {restored}")
|
| 912 |
+
# Apply angle brackets formatting
|
| 913 |
+
if isinstance(restored, np.ndarray):
|
| 914 |
+
restored = np.array([add_angle_brackets(seq) for seq in restored])
|
| 915 |
+
else:
|
| 916 |
+
restored = [add_angle_brackets(seq) for seq in restored]
|
| 917 |
+
print(f"DEBUG: Final output: {restored}")
|
| 918 |
return restored
|
| 919 |
|
| 920 |
def extract_input_ids(tokens, device):
|