MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / process

Method process

diffsynth/prompters/omost.py:198–232  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196 return
197
198 def process(self):
199 # sort components
200 self.components = sorted(self.components, key=lambda x: x['distance_to_viewer'], reverse=True)
201
202 # compute initial latent
203 # print(self.color)
204 initial_latent = np.zeros(shape=(90, 90, 3), dtype=np.float32) + self.color
205
206 for component in self.components:
207 a, b, c, d = component['rect']
208 initial_latent[a:b, c:d] = 0.7 * component['color'] + 0.3 * initial_latent[a:b, c:d]
209
210 initial_latent = initial_latent.clip(0, 255).astype(np.uint8)
211
212 # compute conditions
213
214 bag_of_conditions = [
215 dict(mask=np.ones(shape=(90, 90), dtype=np.float32), prefixes=self.prefixes, suffixes=self.suffixes,location= "full")
216 ]
217
218 for i, component in enumerate(self.components):
219 a, b, c, d = component['rect']
220 m = np.zeros(shape=(90, 90), dtype=np.float32)
221 m[a:b, c:d] = 1.0
222 bag_of_conditions.append(dict(
223 mask = m,
224 prefixes = component['prefixes'],
225 suffixes = component['suffixes'],
226 location = component['location'],
227 ))
228
229 return dict(
230 initial_latent = initial_latent,
231 bag_of_conditions = bag_of_conditions,
232 )
233
234
235class OmostPromter(torch.nn.Module):

Callers 2

__call__Method · 0.80
_generate_beamsearchMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected