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

Error processing video: AttributeError: AttributeError: 'SAM2ImagePredictor' object has no attribute 'reset_state' #9

Open
medatasci opened this issue Dec 15, 2024 · 2 comments

Comments

@medatasci
Copy link

I'm getting this error when using the "Video processing" tab for .mp4 files.

The tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization. 
The tokenizer class you load from this checkpoint is 'GPTNeoXTokenizer'. 
The class this function is called from is 'GPT2TokenizerFast'.
pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 28.9G/28.9G [10:38<00:00, 42.0MB/s]
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)
generation_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 120/120 [00:00<00:00, 761kB/s]
Traceback (most recent call last):
  File "/root/verb-workspace/SAM_Molmo_Whisper3/SAM_Molmo_Whisper/./app.py", line 326, in process_video
    sam_predictor.reset_state(inference_state)
AttributeError: 'SAM2ImagePredictor' object has no attribute 'reset_state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/gradio/blocks.py", line 2016, in process_api
    result = await self.call_function(
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/gradio/blocks.py", line 1569, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2505, in run_sync_in_worker_thread
    return await future
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1005, in run
    result = context.run(func, *args)
  File "/opt/conda/envs/SAM_Molmo_Whisper3/lib/python3.10/site-packages/gradio/utils.py", line 846, in wrapper
    response = f(*args, **kwargs)
  File "/root/verb-workspace/SAM_Molmo_Whisper3/SAM_Molmo_Whisper/./app.py", line 329, in process_video
    inference_state = sam_predictor.init_state(video_path=temp_dir)
AttributeError: 'SAM2ImagePredictor' object has no attribute 'init_state'
@sovit-123
Copy link
Owner

I will check this.

@sovit-123
Copy link
Owner

@medatasci I tried with the updated requirements and the latest SAM 2.1 GitHub repo installation. Everything ran fine. Can you please try with another video or pulling and installing the latest SAM 2.

For more context, I got the following result with the prompt "Point to the ball".
molmo_points_output.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants