MCPcopy Create free account
hub / github.com/InternScience/SciReason / encode

Method encode

opencompass/models/base.py:111–122  ·  view source on GitHub ↗

Encode prompt to tokens. Not necessary for most cases. Args: prompt (str): Input string. Returns: torch.Tensor: Encoded tokens.

(self, prompt: str)

Source from the content-addressed store, hash-verified

109
110 @abstractmethod
111 def encode(self, prompt: str) -> torch.Tensor:
112 """Encode prompt to tokens. Not necessary for most cases.
113
114 Args:
115 prompt (str): Input string.
116
117 Returns:
118 torch.Tensor: Encoded tokens.
119 """
120 raise NotImplementedError(
121 f'{self.__class__.__name__} does not implement'
122 '`encode` method.')
123
124 @abstractmethod
125 def decode(self, tokens: torch.Tensor) -> str:

Callers 15

sync_inputsMethod · 0.95
get_prompt_hashFunction · 0.80
get_prompt_hashFunction · 0.80
get_scoreMethod · 0.80
inferenceMethod · 0.80
inferenceMethod · 0.80
forwardMethod · 0.80
_code_eval_serviceMethod · 0.80
_inferenceMethod · 0.80
loadMethod · 0.80
scoreMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected