MCPcopy
hub / github.com/kohya-ss/sd-scripts / encode_tokens

Method encode_tokens

library/strategy_base.py:298–306  ·  view source on GitHub ↗

Encode tokens into embeddings and outputs. :param tokens: list of token tensors for each TextModel :return: list of output embeddings for each architecture

(
        self, tokenize_strategy: TokenizeStrategy, models: List[Any], tokens: List[torch.Tensor]
    )

Source from the content-addressed store, hash-verified

296 return cls._strategy
297
298 def encode_tokens(
299 self, tokenize_strategy: TokenizeStrategy, models: List[Any], tokens: List[torch.Tensor]
300 ) -> List[torch.Tensor]:
301 """
302 Encode tokens into embeddings and outputs.
303 :param tokens: list of token tensors for each TextModel
304 :return: list of output embeddings for each architecture
305 """
306 raise NotImplementedError
307
308 def encode_tokens_with_weights(
309 self, tokenize_strategy: TokenizeStrategy, models: List[Any], tokens: List[torch.Tensor], weights: List[torch.Tensor]

Callers 15

generate_imageFunction · 0.45
encode_promptFunction · 0.45
trainMethod · 0.45
encodeFunction · 0.45
prepare_text_inputsFunction · 0.45
process_batchMethod · 0.45
sample_image_inferenceFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected