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

Method encode

test/test_rollout_env.py:63–68  ·  view source on GitHub ↗
(self, text, return_tensors=None)

Source from the content-addressed store, hash-verified

61 self.pad_token_id = 0
62
63 def encode(self, text, return_tensors=None):
64 # Simple character-level encoding
65 tokens = [ord(c) % 256 for c in text[:512]] # Limit length
66 if return_tensors == "pt":
67 return {"input_ids": torch.tensor([tokens])}
68 return tokens
69
70 def decode(self, tokens, skip_special_tokens=True):
71 if isinstance(tokens, torch.Tensor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected