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

Method forward

modelscope/models/nlp/veco/backbone.py:62–84  ·  view source on GitHub ↗

Returns: Returns `modelscope.outputs.AttentionBackboneModelOutputWithEmbedding` Examples: >>> from modelscope.models import Model >>> from modelscope.preprocessors import Preprocessor >>> model = Model.from_pretrained('damo/nlp_veco_f

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

60 super(Model, self).__init__(config)
61
62 def forward(self, *args, **kwargs):
63 """
64 Returns:
65 Returns `modelscope.outputs.AttentionBackboneModelOutputWithEmbedding`
66
67 Examples:
68 >>> from modelscope.models import Model
69 >>> from modelscope.preprocessors import Preprocessor
70 >>> model = Model.from_pretrained('damo/nlp_veco_fill-mask-large', task='backbone')
71 >>> preprocessor = Preprocessor.from_pretrained('damo/nlp_veco_fill-mask-large')
72 >>> print(model(**preprocessor('这是个测试')))
73
74 """
75 kwargs['return_dict'] = True
76 outputs = super(Model, self).forward(*args, **kwargs)
77 return AttentionBackboneModelOutput(
78 last_hidden_state=outputs.last_hidden_state,
79 pooler_output=outputs.pooler_output,
80 past_key_values=outputs.past_key_values,
81 hidden_states=outputs.hidden_states,
82 attentions=outputs.attentions,
83 cross_attentions=outputs.cross_attentions,
84 )
85
86 @classmethod
87 def _instantiate(cls, **kwargs):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected