MCPcopy Create free account
hub / github.com/modelscope/modelscope / post_encode

Method post_encode

modelscope/preprocessors/templates/base.py:239–246  ·  view source on GitHub ↗

This method will be called after data_collator and before the forward Args: data: The `_data` field from the example batch, this field should be packed manually Returns: Any extra fields need to be passed into the model.forward

(self, model: Module, data: Any)

Source from the content-addressed store, hash-verified

237 setattr(self, key, value)
238
239 def post_encode(self, model: Module, data: Any) -> Dict[str, Any]:
240 """This method will be called after data_collator and before the forward
241 Args:
242 data: The `_data` field from the example batch, this field should be packed manually
243 Returns:
244 Any extra fields need to be passed into the model.forward
245 """
246 return {}
247
248 def check_example(self, example: Dict[str, Any]) -> None:
249 """Check example valid"""

Callers 1

encodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected