Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
vidai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
vidai
Commits
91ace43b
Commit
91ace43b
authored
Oct 09, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all debug and progress messages conditional on --debug flag
parent
f315edea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
+25
-13
worker_analysis.py
vidai/worker_analysis.py
+25
-13
No files found.
vidai/worker_analysis.py
View file @
91ace43b
...
...
@@ -30,7 +30,7 @@ import time
import
uuid
from
.comm
import
SocketCommunicator
,
Message
from
.models
import
get_model
from
.config
import
get_system_prompt_content
,
get_comm_type
,
get_backend_worker_port
from
.config
import
get_system_prompt_content
,
get_comm_type
,
get_backend_worker_port
,
get_debug
# Set PyTorch CUDA memory management
os
.
environ
[
'PYTORCH_CUDA_ALLOC_CONF'
]
=
'expandable_segments:True'
...
...
@@ -186,7 +186,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Initializing analysis job'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 5
% -
Initializing analysis job"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 5
% -
Initializing analysis job"
)
torch
.
cuda
.
empty_cache
()
total_tokens
=
0
...
...
@@ -205,7 +206,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
f
'Model {model_path.split("/")[-1]} loaded successfully'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 8
% -
Model loaded successfully"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 8
% -
Model loaded successfully"
)
# Get system prompt
print
(
f
"DEBUG: Retrieving system prompt for job {job_id}"
)
...
...
@@ -231,7 +233,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
f
'Extracted {total_frames} frames'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 10
% -
Extracted {total_frames} frames"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 10
% -
Extracted {total_frames} frames"
)
descriptions
=
[]
...
...
@@ -248,7 +251,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
f
'Processing frame {i+1}/{total_frames} at {ts:.1f}s'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - {progress_percent}
% -
Processing frame {i+1}/{total_frames}"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - {progress_percent}
% -
Processing frame {i+1}/{total_frames}"
)
# Check for cancellation
if
job_id
and
check_job_cancelled
(
job_id
):
...
...
@@ -283,7 +287,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
f
'Completed frame {i+1}/{total_frames} ({progress_percent}
%
)'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - {progress_percent}
% -
Completed frame {i+1}/{total_frames}"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - {progress_percent}
% -
Completed frame {i+1}/{total_frames}"
)
if
output_dir
:
import
shutil
...
...
@@ -300,7 +305,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Generating video summary'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 85
% -
Generating video summary"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 85
% -
Generating video summary"
)
# Check for cancellation before summary
if
job_id
and
check_job_cancelled
(
job_id
):
...
...
@@ -339,7 +345,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Analysis completed'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 100
% -
Analysis completed"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 100
% -
Analysis completed"
)
result
=
f
"Frame Descriptions:
\n
"
+
"
\n
"
.
join
(
descriptions
)
+
f
"
\n\n
Summary:
\n
{summary}"
return
result
,
total_tokens
...
...
@@ -355,7 +362,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Starting image analysis'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 20
% -
Starting image analysis"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 20
% -
Starting image analysis"
)
# Check for cancellation before processing image
if
job_id
and
check_job_cancelled
(
job_id
):
...
...
@@ -371,7 +379,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Processing image with AI model'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 50
% -
Processing image with AI model"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 50
% -
Processing image with AI model"
)
result
,
tokens
=
analyze_single_image
(
media_path
,
full_prompt
,
model
)
total_tokens
+=
tokens
...
...
@@ -386,7 +395,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Finalizing analysis results'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 90
% -
Finalizing analysis results"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 90
% -
Finalizing analysis results"
)
# Send final progress update
if
comm
:
...
...
@@ -397,7 +407,8 @@ def analyze_media(media_path, prompt, model_path, interval=10, job_id=None, comm
'message'
:
'Image analysis completed successfully'
})
comm
.
send_message
(
progress_msg
)
print
(
f
"PROGRESS: Job {job_id} - 100
% -
Image analysis completed successfully"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {job_id} - 100
% -
Image analysis completed successfully"
)
torch
.
cuda
.
empty_cache
()
return
result
,
total_tokens
...
...
@@ -434,7 +445,8 @@ def worker_process(backend_type: str):
model_path
=
data
.
get
(
'model_path'
,
'Qwen/Qwen2.5-VL-7B-Instruct'
)
interval
=
data
.
get
(
'interval'
,
10
)
job_id
=
message
.
msg_id
# Use message ID for job identification
print
(
f
"PROGRESS: Job {message.msg_id} accepted - Starting analysis"
)
if
get_debug
():
print
(
f
"PROGRESS: Job {message.msg_id} accepted - Starting analysis"
)
print
(
f
"DEBUG: Starting analysis of {media_path} with model {model_path} for job {job_id}"
)
result
,
tokens_used
=
analyze_media
(
media_path
,
prompt
,
model_path
,
interval
,
job_id
,
comm
)
print
(
f
"DEBUG: Analysis completed for job {message.msg_id}, used {tokens_used} tokens"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment