|
|
@ -28,9 +28,8 @@ For `ind` input, if a data in one of the modalities is invalid(such as NaN) or y |
|
|
|
*Write the pipeline code*: |
|
|
|
|
|
|
|
```python |
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
import torch |
|
|
|
from towhee import Entity |
|
|
|
import towhee |
|
|
|
|
|
|
|
torch.manual_seed(42) |
|
|
|
|
|
|
@ -59,8 +58,13 @@ ind = { |
|
|
|
} |
|
|
|
text = torch.randn(batch_size, 1, 37, 768).to(device) |
|
|
|
|
|
|
|
towhee.dc([Entity(experts=experts, ind=ind, text=text)]) \ |
|
|
|
.video_text_embedding.collaborative_experts[('experts', 'ind', 'text'), ('text_embds', 'vid_embds')](device=device).show() |
|
|
|
p = ( |
|
|
|
pipe.input('experts', 'ind', 'text') \ |
|
|
|
.map(('experts', 'ind', 'text'),('text_embds', 'vid_embds') , ops.video_text_embedding.collaborative_experts(device=device)) \ |
|
|
|
.output('experts', 'ind', 'text', 'text_embds', 'vid_embds') |
|
|
|
) |
|
|
|
|
|
|
|
DataCollection(p(experts, ind, text)).show() |
|
|
|
``` |
|
|
|
|
|
|
|
![](img.png) |
|
|
|