Skip to content

Update additional requirements for model init --streaming-video#987

Open
mimarcel wants to merge 1 commit intomasterfrom
983-install-shapely-pip-package-when-building-model-using---streaming-video-flag
Open

Update additional requirements for model init --streaming-video#987
mimarcel wants to merge 1 commit intomasterfrom
983-install-shapely-pip-package-when-building-model-using---streaming-video-flag

Conversation

@mimarcel
Copy link
Contributor

Why

  • new package shapely is required for polygon filtering in streaming videos

How

  • Instead of hardcoding the new package in the list of requirements, we suggest to install clarifai-protocol with the auto-annotation extra that will dynamically include the necessary requirements for video livestreaming

Tests

clarifai model init --streaming-video
Initializing model with default template...

  Model initialized in /Users/abc/my-model

  1. Edit 1/model.py with your model logic
  2. Add dependencies to requirements.txt
  3. Customize Dockerfile if needed (auto-regenerated on upload if deleted)

  Test locally:
    clarifai model serve /Users/abc/my-model
    clarifai model serve /Users/abc/my-model --mode env       # auto-create venv and install deps
    clarifai model serve /Users/abc/my-model --mode container # run inside Docker

  Deploy to Clarifai:
    clarifai model deploy /Users/abc/my-model --instance gpu-nvidia-a10g
    clarifai list-instances                             # list available instances

Notes

@github-actions
Copy link

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 61%
clarifai.cli.templates 67%
clarifai.cli.templates.toolkits 100%
clarifai.client 65%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 69%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 58%
clarifai.runners.pipeline_steps 39%
clarifai.runners.pipelines 72%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 58%
clarifai.utils 65%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
Summary 60% (11357 / 18957)

Minimum allowed line rate is 50%

COPY --from=public.ecr.aws/clarifai-models/static-streaming:5.1.8 /ffprobe /usr/local/bin/
# COPY --from=public.ecr.aws/clarifai-models/static-streaming:5.1.8 /src /usr/local/src/
RUN uv pip install --no-cache-dir av
RUN uv pip install 'clarifai-protocol[auto-annotation]=={CLARIFAI_PROTOCOL_LATEST_VERSION}'
Copy link
Contributor

Choose a reason for hiding this comment

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

NOTE, the Dockerfile template; after the ${ADDITIONAL_PACKAGES} insertion -- which includes this test -- we subsequently install the requirements file:

RUN ["uv", "pip", "install", "--no-cache-dir", "-r", "/home/nonroot/requirements.txt"]

Concern: if a user defines a different version of clarify protocol in their local requirements.txt, the subsequent installation of their version could override the initial install, causing the add-ons to be lost.

Could you please test:

  • whether those two extra packages actually remain after the installation from requirements.txt?
  • If there any way to install only the add-ons and not the main package itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point! I tested this and it is not a problem,: the additional packages remain installed after installing a different version of the clarifai-protocol package.

Test details follow.

  1. install clarifai-protocol with auto-annotation extra:
    uv pip install 'clarifai-protocol[auto-annotation]==0.0.60'
  2. check additional packages installed
    uv pip list | grep -E "shapely|av"
    av                                       16.1.0
    shapely                                  2.1.2
  3. install different clarifai-protocol version without auto-annotation extra:
    uv pip install 'clarifai-protocol==0.0.59'
  4. check additional packages installed
    uv pip list | grep -E "shapely|av"
    av                                       16.1.0
    shapely                                  2.1.2

@mimarcel mimarcel requested a review from josh-tepper March 17, 2026 20:56
@mimarcel mimarcel enabled auto-merge (squash) March 17, 2026 20:57
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

Successfully merging this pull request may close these issues.

Install shapely pip package when building model using --streaming-video flag

2 participants