Dummy decode - return staged format strings for VERL compatibility.
(self, sequences, skip_special_tokens=True)
| 46 | self.pad_token_id = 0 |
| 47 | |
| 48 | def batch_decode(self, sequences, skip_special_tokens=True): |
| 49 | """Dummy decode - return staged format strings for VERL compatibility.""" |
| 50 | try: |
| 51 | import torch |
| 52 | if isinstance(sequences, torch.Tensor): |
| 53 | # Return proper staged responses for each item in batch |
| 54 | batch_size = sequences.shape[0] if len(sequences.shape) > 0 else 1 |
| 55 | responses = [] |
| 56 | for i in range(batch_size): |
| 57 | response = f"""<plan> |
| 58 | I need to explore the environment and find the exit. |
| 59 | <memory query>previous exploration</memory query> |
| 60 | <memory result>No previous exploration found</memory result> |
| 61 | </plan> |
| 62 | |
| 63 | <action> |
| 64 | tool: search |
| 65 | parameters: {{"query": "exit door"}} |
| 66 | </action> |
| 67 | |
| 68 | <memory store> |
| 69 | Started exploration in room {i}, searching for exit |
| 70 | </memory store> |
| 71 | |
| 72 | <reflection> |
| 73 | I should continue exploring to find the exit. |
| 74 | </reflection>""" |
| 75 | responses.append(response) |
| 76 | return responses |
| 77 | except ImportError: |
| 78 | pass |
| 79 | |
| 80 | if isinstance(sequences, list): |
| 81 | return [f"Decoded: {seq}" if isinstance(seq, str) else str(seq) for seq in sequences] |
| 82 | return ["Decoded sequence"] |
| 83 | |
| 84 | def encode(self, text): |
| 85 | """Dummy encode.""" |
no outgoing calls
no test coverage detected