Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ WORKDIR /app

# Install dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y ffmpeg cmake swig libavcodec-dev libavformat-dev
RUN ln -s /usr/bin/ffmpeg /usr/local/bin/ffmpeg
RUN apt-get update && apt-get install -y cmake swig


# Other configurations
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ run_model:
run_rq_worker:
while true; do python manage.py run_rq_worker; done

run_video_matcher:
while true; do python manage.py run_video_matcher; done

test: wait
python manage.py init_perl_functions
coverage run --source=app/main/ manage.py test
Expand Down
1 change: 0 additions & 1 deletion app/main/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Config:
MODEL_NAME = os.getenv('MODEL_NAME')
MAX_CLAUSE_COUNT = 1000
PERSISTENT_DISK_PATH = os.getenv('PERSISTENT_DISK_PATH', '/app/persistent_disk')
VIDEO_MODEL = os.getenv('VIDEO_MODEL', 'video-model')
try:
VIDEO_MODEL_L1_SCORE = float(os.getenv('video_model_l1_score', '0.7'))
except:
Expand Down
2 changes: 1 addition & 1 deletion app/main/lib/graph_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def audio_model():
return SharedModel.get_client()

def video_model():
return SharedModel.get_client(app.config['VIDEO_MODEL'])
return SharedModel.get_client()

def get_iterable_objects(graph, data_type):
try:
Expand Down
3 changes: 1 addition & 2 deletions app/main/lib/shared_models/video_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import tmkpy
from sqlalchemy.orm.exc import NoResultFound

from app.main.lib.shared_models.shared_model import SharedModel
from app.main.lib.similarity_helpers import get_context_query, drop_context_from_record
from app.main.lib.helpers import context_matches
from app.main.lib import media_crud
Expand All @@ -28,7 +27,7 @@
def _after_log(retry_state):
app.logger.debug("Retrying video similarity...")

class VideoModel(SharedModel):
class VideoModel():
def overload_context_to_denote_content_type(self, task):
return {**task, **{"context": {**task.get("context", {}), **{"content_type": "video"}}}}

Expand Down
2 changes: 1 addition & 1 deletion app/main/lib/similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def audio_model():
return AudioModel()

def video_model():
return VideoModel(app.config['VIDEO_MODEL'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are not reading VIDEO_MODEL config anymore, can we remove it from config?

VIDEO_MODEL = os.getenv('VIDEO_MODEL', 'video-model')
. Or are there other things that read this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can safely remove I think.

return VideoModel()

def model_response_package(item, command):
response_package = {
Expand Down
2 changes: 1 addition & 1 deletion app/test/test_video_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def respond(self, task):
class TestVideoSimilarityBlueprint(BaseTestCase):
def setUp(self):
super().setUp()
self.model = VideoModel('video')
self.model = VideoModel()

def test_get_tempfile(self):
self.assertIsInstance(self.model.get_tempfile(), tempfile._TemporaryFileWrapper)
Expand Down
12 changes: 0 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ services:
# - .env_file
# environment:
# MODEL_NAME: mdebertav3filipino
# video:
# build: .
# platform: linux/x86_64
# command: ["make", "run_model"]
# volumes:
# - ".:/app"
# depends_on:
# - redis
# env_file:
# - .env_file
# environment:
# MODEL_NAME: video
queue_worker:
build: .
platform: linux/x86_64
Expand Down
6 changes: 0 additions & 6 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ def run_model():
model_config['options']
)


@manager.command
def run_video_matcher():
"""Runs the video matcher."""
VideoMatcher.start_server()

@manager.command
def init():
"""Initializes the service."""
Expand Down
4 changes: 1 addition & 3 deletions production/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ RUN chmod 755 /opt/bin/*.sh

WORKDIR /app

RUN apt-get update && apt-get install -y ffmpeg cmake swig libavcodec-dev libavformat-dev
RUN apt-get update && apt-get install -y ffmpeg swig
RUN apt-get update && apt-get install -y cmake swig
RUN apt-get clean
RUN ln -s /usr/bin/ffmpeg /usr/local/bin/ffmpeg

COPY . .

Expand Down
Loading