MCPcopy Index your code
hub / github.com/vladmandic/sdnext / clone_embeds

Method clone_embeds

modules/prompt_parser_diffusers.py:255–270  ·  view source on GitHub ↗
(self, batchidx, idx)

Source from the content-addressed store, hash-verified

253 get_tokens(pipe, 'negative', negative_prompt)
254
255 def clone_embeds(self, batchidx, idx):
256 def _clone(target):
257 if len(target) <= idx:
258 return
259 src = target[idx]
260 if isinstance(src, list):
261 target[batchidx] = [item if not isinstance(item, list) else list(item) for item in src]
262 else:
263 target[batchidx] = src
264
265 _clone(self.prompt_embeds)
266 _clone(self.negative_prompt_embeds)
267 _clone(self.positive_pooleds)
268 _clone(self.negative_pooleds)
269 _clone(self.prompt_attention_masks)
270 _clone(self.negative_prompt_attention_masks)
271
272 def __call__(self, key, step=0):
273 batch = getattr(self, key)

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected