Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Loading operator with error:Load operator failed #2663

Closed
vig720 opened this issue Sep 8, 2023 · 2 comments
Closed

RuntimeError: Loading operator with error:Load operator failed #2663

vig720 opened this issue Sep 8, 2023 · 2 comments
Labels

Comments

@vig720
Copy link

vig720 commented Sep 8, 2023

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

@junjiejiangjjj
Copy link
Contributor

towhee-io/examples#236

@stale
Copy link

stale bot commented Oct 13, 2023

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.

@stale stale bot added the stale label Oct 13, 2023
@stale stale bot closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants