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

add new models and fix sessions #4

Merged
merged 6 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Set server default for task.completed_at and task.assigned_at to none and add num_retries.
Revision ID: b9860676dd49
Revises: 5ad873484aa3
Create Date: 2024-08-22 07:54:55.921710
"""
from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "b9860676dd49"
down_revision: str | None = "5ad873484aa3"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
"""Upgrade database to this revision from previous."""
with op.batch_alter_table("tasks", schema=None) as batch_op:
batch_op.alter_column(
"completed_at",
server_default=None,
)
batch_op.alter_column(
"assigned_at",
server_default=None,
)
batch_op.add_column(
sa.Column(
"num_retries",
sa.Integer(),
nullable=False,
comment="Number of retries",
server_default=sa.text("0"),
)
)

# ### end Alembic commands ###


def downgrade() -> None:
"""Downgrade database from this revision to previous."""
with op.batch_alter_table("tasks", schema=None) as batch_op:
batch_op.drop_column("num_retries")

# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""added extended video.

Revision ID: d93a90261ee5
Revises: 5ad873484aa3
Revises: b9860676dd49
Create Date: 2024-07-29 12:41:04.976640

"""
Expand All @@ -12,7 +12,7 @@

# revision identifiers, used by Alembic.
revision: str = 'd93a90261ee5'
down_revision: str | None = '5ad873484aa3'
down_revision: str | None = 'b9860676dd49'
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None

Expand Down
21 changes: 12 additions & 9 deletions aana_chat_with_video/configs/deployments.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from aana.core.models.sampling import SamplingParams
from aana.core.models.types import Dtype
from aana.deployments.hf_blip2_deployment import HFBlip2Config, HFBlip2Deployment
from aana.deployments.vad_deployment import VadConfig, VadDeployment
from aana.deployments.vllm_deployment import VLLMConfig, VLLMDeployment
from aana.deployments.whisper_deployment import (
Expand All @@ -18,7 +17,7 @@
max_ongoing_requests=1000,
ray_actor_options={"num_gpus": 0.25},
user_config=WhisperConfig(
model_size=WhisperModelSize.MEDIUM,
model_size=WhisperModelSize.TURBO,
compute_type=WhisperComputeType.FLOAT16,
).model_dump(mode="json"),
),
Expand All @@ -41,15 +40,19 @@
},
{
"name": "captioning_deployment",
"instance": HFBlip2Deployment.options(
"instance": VLLMDeployment.options(
num_replicas=1,
max_ongoing_requests=1000,
ray_actor_options={"num_gpus": 0.25},
user_config=HFBlip2Config(
model="Salesforce/blip2-opt-2.7b",
dtype=Dtype.FLOAT16,
batch_size=2,
num_processing_threads=2,
user_config=VLLMConfig(
model="Qwen/Qwen2-VL-2B-Instruct",
dtype=Dtype.AUTO,
gpu_memory_reserved=12000,
max_model_len=32768,
enforce_eager=True,
default_sampling_params=SamplingParams(
temperature=0.0, top_p=1.0, top_k=-1, max_tokens=512
),
engine_args={"trust_remote_code": True},
).model_dump(mode="json"),
),
},
Expand Down
2 changes: 1 addition & 1 deletion aana_chat_with_video/configs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Settings(AanaSettings):
"""A pydantic model for App settings."""

asr_model_name: str = "whisper_medium"
captioning_model_name: str = "hf_blip2_opt_2_7b"
captioning_model_name: str = "qwen2-vl-2b-instruct"
max_video_len: int = 60 * 20 # 20 minutes


Expand Down
5 changes: 3 additions & 2 deletions aana_chat_with_video/endpoints/delete_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from aana.api.api_generation import Endpoint
from aana.core.models.media import MediaId
from aana.storage.session import get_session
from aana_chat_with_video.storage.repository.extended_video import (
ExtendedVideoRepository,
)
Expand All @@ -19,9 +20,9 @@ class DeleteVideoEndpoint(Endpoint):
async def initialize(self):
HRashidi marked this conversation as resolved.
Show resolved Hide resolved
"""Initialize the endpoint."""
await super().initialize()
self.video_repo = ExtendedVideoRepository(self.session)

async def run(self, media_id: MediaId) -> DeleteVideoOutput:
"""Delete video."""
self.video_repo.delete(media_id)
with get_session() as session:
ExtendedVideoRepository(session).delete(media_id)
return DeleteVideoOutput(media_id=media_id)
Loading
Loading