From 0bdb579326c57ed852757c6f17924324c29b111d Mon Sep 17 00:00:00 2001 From: ChengZi Date: Thu, 2 Feb 2023 10:24:51 +0800 Subject: [PATCH] update readme with dc2 --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d49999f..c3498d4 100644 --- a/README.md +++ b/README.md @@ -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)