You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for f_name in ['https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog1.png',
'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog2.png',
'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog3.png']:
p(f_name)
p.flush()
search image by text
decode = ops.image_decode.cv2('rgb')
p = (
pipe.input('text')
.map('text', 'vec', ops.image_text_embedding.clip(model_name='clip_vit_base_patch32', modality='text'))
.map('vec', 'vec', ops.towhee.np_normalize())
# faiss op result format: [[id, score, [file_name], ...]
.map('vec', 'row', ops.ann_search.faiss_index('./faiss', 3))
.map('row', 'images', lambda x: [decode(item[2][0]) for item in x])
.output('text', 'images')
)
DataCollection(p('a cat')).show()`
But I am getting this error
`RuntimeError Traceback (most recent call last)
Cell In[1], line 9
1 from towhee import ops, pipe, DataCollection
2 # create image embeddings and build index
3 p = (
4 pipe.input('file_name')
5 .map('file_name', 'img', ops.image_decode.cv2())
6 .map('img', 'vec', ops.image_text_embedding.clip(model_name='clip_vit_base_patch32', modality='image'))
7 .map('vec', 'vec', ops.towhee.np_normalize())
8 .map(('vec', 'file_name'), (), ops.ann_insert.faiss_index('[./faiss], 512))
----> 9 .output()
10 )
12 for f_name in ['https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog1.png',
13 'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog2.png',
14 'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog3.png']:
15 p(f_name)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.
Hello Everyone,
I am new to using Towhee, I am trying to run a basic code provided in their user guide
I am trying to run this code
`from towhee import ops, pipe, DataCollection
p = (
pipe.input('file_name')
.map('file_name', 'img', ops.image_decode.cv2())
.map('img', 'vec', ops.image_text_embedding.clip(model_name='clip_vit_base_patch32', modality='image'))
.map('vec', 'vec', ops.towhee.np_normalize())
.map(('vec', 'file_name'), (), ops.ann_insert.faiss_index('./faiss', 512))
.output()
)
for f_name in ['https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog1.png',
'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog2.png',
'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog3.png']:
p(f_name)
p.flush()
search image by text
decode = ops.image_decode.cv2('rgb')
p = (
pipe.input('text')
.map('text', 'vec', ops.image_text_embedding.clip(model_name='clip_vit_base_patch32', modality='text'))
.map('vec', 'vec', ops.towhee.np_normalize())
# faiss op result format: [[id, score, [file_name], ...]
.map('vec', 'row', ops.ann_search.faiss_index('./faiss', 3))
.map('row', 'images', lambda x: [decode(item[2][0]) for item in x])
.output('text', 'images')
)
DataCollection(p('a cat')).show()`
But I am getting this error
`RuntimeError Traceback (most recent call last)
Cell In[1], line 9
1 from towhee import ops, pipe, DataCollection
2 # create image embeddings and build index
3 p = (
4 pipe.input('file_name')
5 .map('file_name', 'img', ops.image_decode.cv2())
6 .map('img', 'vec', ops.image_text_embedding.clip(model_name='clip_vit_base_patch32', modality='image'))
7 .map('vec', 'vec', ops.towhee.np_normalize())
8 .map(('vec', 'file_name'), (), ops.ann_insert.faiss_index('[./faiss], 512))
----> 9 .output()
10 )
12 for f_name in ['https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog1.png',
13 'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog2.png',
14 'https://raw.githubusercontent.com/towhee-io/towhee/main/assets/dog3.png']:
15 p(f_name)
File c:\Anaconda3\envs\py310\lib\site-packages\towhee\runtime\pipeline.py:101, in Pipeline.output(self, *output_schema)
98 dag_dict[self._clo_node]['next_nodes'].append(uid)
100 run_pipe = RuntimePipeline(dag_dict)
--> 101 run_pipe.preload()
102 return run_pipe
File c:\Anaconda3\envs\py310\lib\site-packages\towhee\runtime\runtime_pipeline.py:153, in RuntimePipeline.preload(self)
...
op = self._op_loader.load_operator(hub_op_id, op_args, op_kws, tag, latest)
File "c:\Anaconda3\envs\py310\lib\site-packages\towhee\runtime\operator_manager\operator_loader.py", line 158, in load_operator
raise RuntimeError('Load operator failed')
RuntimeError: Load operator failed`
Can some one let me know what is wrong
The text was updated successfully, but these errors were encountered: