MCPcopy Create free account
hub / github.com/OpenManus/OpenManus-RL / batch_decode

Method batch_decode

test/test_rollout_mock.py:48–82  ·  view source on GitHub ↗

Dummy decode - return staged format strings for VERL compatibility.

(self, sequences, skip_special_tokens=True)

Source from the content-addressed store, hash-verified

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>
58I 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>
64tool: search
65parameters: {{"query": "exit door"}}
66</action>
67
68<memory store>
69Started exploration in room {i}, searching for exit
70</memory store>
71
72<reflection>
73I 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."""

Callers 5

bart_predictFunction · 0.45
bart_predictFunction · 0.45
generate_search.pyFile · 0.45
multi_turn_loopMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected