towhee-io / examples

Analyze the unstructured data with Towhee, such as reverse image search, reverse video search, audio classification, question and answer systems, molecular search, etc.
Apache License 2.0
449 stars 112 forks source link

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

Open vig720 opened 1 year ago

vig720 commented 1 year ago

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 commented 1 year ago

Any detail logs?

vig720 commented 1 year ago

2023-09-08 11:24:23,074 - 19692 - operator_loader.py-operator_loader:134 - ERROR: [WinError 1314] A required privilege is not held by the client: '[C:\\Users\\.towhee\\operators\\image-decode\\cv2\\files\\ad2c20794adb0781ec953359ff6273ab55b73377](file:///C://Users//.towhee//operators//image-decode//cv2//files//ad2c20794adb0781ec953359ff6273ab55b73377)' -> '[C:\\Users\\.towhee\\operators\\image-decode\\cv2\\tmpn90651ms\\.gitattributes](file:///C://Users//.towhee//operators//image-decode//cv2//tmpn90651ms//.gitattributes)', Traceback (most recent call last):

It is saying I don't have required privilege,

do I need Admin privileges to install it

junjiejiangjjj commented 1 year ago

It may be that the Window has disabled the symlink: https://stackoverflow.com/questions/32877260/privlege-error-trying-to-create-symlink-using-python-on-windows-10

vig720 commented 1 year ago

I tried this, but I can't do this. My system admin blocks it. Is there any other way

Sarfaraz021 commented 9 months ago

yes follow this tut https://youtu.be/n_mmsnZ9BVE?si=xQQ7sKN8P-vCzDUk