Vinyzu / recognizer

🦉Gracefully face reCAPTCHA challenge with ultralytics YOLOv8-seg, CLIPs VIT-B/16 and CLIP-Seg/RD64. Implemented in playwright or an easy-to-use API.
GNU General Public License v3.0
125 stars 20 forks source link

[BUG] Too many errors reported, unable to run #54

Open 12189108 opened 5 months ago

12189108 commented 5 months ago

Describe the bug My Python version is 3.9. Since you didn't mention your version, I assumed all versions were compatible, but encountered many errors. error 1 :

 File "/usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py", line 1510, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/dist-packages/transformers/models/vit/image_processing_vit.py", line 21, in <module>
    from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
ImportError: cannot import name 'BaseImageProcessor' from partially initialized module 'transformers.image_processing_utils' (most likely due to a circular import) (/usr/local/lib/python3.9/dist-packages/transformers/image_processing_utils.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/recaptcha_solver_test/main.py", line 81, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/root/recaptcha_solver_test/main.py", line 78, in main
    await run(playwright,"free.vps.vc","6Lf6qrMjAAAAAK3VbiN3PkzoXux6p3kEVDmBJA5p")
  File "/root/recaptcha_solver_test/main.py", line 71, in run
    await challenger.solve_recaptcha()
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 204, in solve_recaptcha
    return await self.handle_recaptcha()
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 149, in handle_recaptcha
    result_clicked = await self.detect_tiles(prompt, area_captcha)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 83, in detect_tiles
    response, coordinates = self.detector.detect(prompt, image, area_captcha=area_captcha)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 288, in detect
    detection_models.check_loaded()
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 76, in check_loaded
    raise e
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 66, in check_loaded
    future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 60, in _load_seg_processor
    self.seg_processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
  File "/usr/local/lib/python3.9/dist-packages/transformers/processing_utils.py", line 465, in from_pretrained
    args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/transformers/processing_utils.py", line 509, in _get_arguments_from_pretrained
    attribute_class = getattr(transformers_module, class_name)
  File "/usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py", line 1501, in __getattr__
    value = getattr(module, name)
  File "/usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py", line 1500, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py", line 1512, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.models.vit.image_processing_vit because of the following error (look up to see its traceback):
cannot import name 'BaseImageProcessor' from partially initialized module 'transformers.image_processing_utils' (most likely due to a circular import) (/usr/local/lib/python3.9/dist-packages/transformers/image_processing_utils.py)

error 2:

File "/root/recaptcha_solver_test/main.py", line 71, in run
    await challenger.solve_recaptcha()
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 204, in solve_recaptcha
    return await self.handle_recaptcha()
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 149, in handle_recaptcha
    result_clicked = await self.detect_tiles(prompt, area_captcha)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/agents/playwright/async_control.py", line 83, in detect_tiles
    response, coordinates = self.detector.detect(prompt, image, area_captcha=area_captcha)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 342, in detect
    response = self.clip_detector.detect_image(cv2_images, label)
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 237, in detect_image
    return self.clipseg_detect_rd64(combined_image, task_type, len(images))
  File "/usr/local/lib/python3.9/dist-packages/recognizer/components/detector.py", line 200, in clipseg_detect_rd64
    inputs = detection_models.seg_processor(text=segment_label, images=[image], return_tensors="pt")
AttributeError: 'DetectionModels' object has no attribute 'seg_processor'

error 3:

huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)

Desktop (please complete the following information):