-
Notifications
You must be signed in to change notification settings - Fork 3
LLM Speech Summarization #418
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
Open
eric-mccann-pro
wants to merge
178
commits into
develop
Choose a base branch
from
feat/qwen-speech-summarization
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 177 commits
Commits
Show all changes
178 commits
Select commit
Hold shift + click to select a range
2689205
Add QwenSpeechSummarization
eric-mccann-pro f01498a
Runs main() in container... does not run main during build for testin…
eric-mccann-pro 98bc842
Logger won't log. Deal with it later
eric-mccann-pro 98bb794
Fix format strings
eric-mccann-pro e29c34a
Add primary_topic and other_topics to output
eric-mccann-pro 0604c07
Make sure we download the tokenizer giblets during docker build
eric-mccann-pro 97ae53f
Mock an LLM generator's events stream. Run pytest if RUN_TESTS is true
eric-mccann-pro f04d5b0
Use releasable descriptor
eric-mccann-pro 86a7ab4
Readme
eric-mccann-pro 50cb5f7
Change default RUN_TEST to false
eric-mccann-pro e006afd
Parameterize VLLM_MODEL and VLLM_URI at container scope, as they're e…
eric-mccann-pro b0b1c15
+x
eric-mccann-pro 198f3ec
Include served-model-name param in the entrypoint, not the CMD
eric-mccann-pro 0908932
Make sure tokenizer pull step has VLLM_MODEL defined in env if overriden
eric-mccann-pro c20c3d2
License blocks
eric-mccann-pro ebbecd7
Make exception text less useless when there are no FF tracks
eric-mccann-pro 5aea1b7
Fix typo
eric-mccann-pro 68c8456
Fix another typo
eric-mccann-pro ae4f6f0
Fix default in descriptor
eric-mccann-pro de6f2d3
Make speaker id optional
eric-mccann-pro cc151c6
input_cleanup: be cool
eric-mccann-pro 16a367c
again
eric-mccann-pro 7d231e5
Change summary and print the final summary after it comes back from t…
eric-mccann-pro 3c04189
Print number of results from component video track func when called b…
eric-mccann-pro 47ca541
Actually return results. duh
eric-mccann-pro dbed34c
Set an ImageLocation for video tracks
eric-mccann-pro bb5d333
Define CLASSIFIERS_FILE and ENABLED_CLASSIFIERS in the json, now that…
eric-mccann-pro 6948569
Gate some of the output behind debug parameter
eric-mccann-pro 82f37b6
Provide Items of Interest instruction
eric-mccann-pro 9e47148
Remove businesses from entities list
eric-mccann-pro ed36524
Parameterization and documentation
eric-mccann-pro 17e8c54
Switch propertiesKeys instead of defaultValues
eric-mccann-pro 8f299b8
Remove partial word from README.md
eric-mccann-pro 6fc5a37
PROMPT_TEMPLATE is a property
eric-mccann-pro f3500db
Fix a typo and mention VLLM_URI
eric-mccann-pro 64d62bb
Don't mention VRAM
eric-mccann-pro 247ca37
Make sample classifiers match readme AND put ticks around properties+…
eric-mccann-pro d18a7af
Switch to defaults for the properties that have a default
eric-mccann-pro c192dca
Output => tracks
eric-mccann-pro c32d4bb
justification => reasoning
eric-mccann-pro 60e7fa3
Specific Items of Interest appendage is never empty if present
eric-mccann-pro 9eb3a39
reasonining
eric-mccann-pro eb4fccc
Use classifier confidence for detection confidence
eric-mccann-pro fc5dc70
Use FakeClass for all of the manual openai-api client mock buildout
eric-mccann-pro d838d0b
Make sure the tracks are ordered in accordance with their index
eric-mccann-pro ceb6801
Validate schema, close clients between calls (prevents deadlock)
eric-mccann-pro 67e680f
Fix path to vllm-entrypoint.sh.
jrobble 3097d3f
Disable XET for hf download and fix deprecation warning
eric-mccann-pro 7318613
Perform download in separate stage
eric-mccann-pro 84e170c
Fix max-model-length parameter name
eric-mccann-pro 8f5f61d
Merge branch 'develop' into feat/qwen-speech-summarization
jrobble 177671b
Update versions to 10.0.
jrobble 9202086
Fix JSONArgsRecommended warning.
jrobble 04f7e1a
Fix how Whisper is returning duplicate tracks for videos.
jrobble 541fac1
Wait up to two minutes for vllm to be healthy for each call to summarize
eric-mccann-pro e6506bd
Merge remote-tracking branch 'origin/feat/qwen-speech-summarization' …
eric-mccann-pro 2a14fe1
Use algorithm prop.
jrobble e3d6327
Fix test.
jrobble 08d5531
Fix test round 2.
jrobble f7fa93c
Fix bug.
jrobble e3e9c0d
Use local_files_only=True.
jrobble 48acdaa
Download autotokenizer in Dockerfile.
jrobble f38fc8a
Fix syntax.
jrobble 31f1b68
Proper quotes.
jrobble 4710b35
Use import.
jrobble c5d9d52
Bug fix.
jrobble 319d1a7
Use HF_HUB_OFFLINE.
jrobble 073003b
Use HF_HUB_OFFLINE before import.
jrobble e0be4ec
Merge remote-tracking branch 'origin/jrobble/qwen-speech-summarizatio…
eric-mccann-pro 15404ee
Filter out low confidence classifiers
eric-mccann-pro 79ffed8
Add classifier_confidence_minimum to descriptor
eric-mccann-pro 05e12ee
Add requests to setup.cfg
eric-mccann-pro b935b2e
descriptor: true ==> "TRUE"
eric-mccann-pro c11328e
Fix bug reading classifiers.json from $MPF_HOME.
jrobble 03213f0
Add a todo about manually aglommerating lists instead of making the m…
eric-mccann-pro 39810e4
Force minimum_chunk_size=2 by default to force json array chunking to…
eric-mccann-pro b381967
descriptor: prevent segmentation to avoid redundant summarization bet…
eric-mccann-pro b7f139c
Remove vestigial functions from non-component qwen summarization impl…
eric-mccann-pro a319bd0
Replace deprecated pkg_resources
eric-mccann-pro b0fd935
Merge remote-tracking branch 'origin/feat/qwen-speech-summarization' …
eric-mccann-pro 1b257fa
Use PROMPT_TEMPLATE property default to handle both the overriden and…
eric-mccann-pro 3d6e258
_underscore_private_class_methods
eric-mccann-pro 5683ff9
Fix test_slapchop test expected to match minimum 2-object chunk size …
eric-mccann-pro f652c72
Assume HF_HUB_OFFLINE shouldn't be one for pytest, allowing downloadi…
eric-mccann-pro 78f5999
Add a shortcut for the tail of summarize_summaries grouping. Don't su…
eric-mccann-pro 5dccb08
Revert 39810e4 and 5683ff9: min_grouping is selected in summarize_sum…
eric-mccann-pro f22a61a
If chunk isn't a string, don't loads it
eric-mccann-pro ef29659
pydantic: fix deprecated call to .json()
eric-mccann-pro 292b2bf
Fixup path handling for prompt_template AND its default value
eric-mccann-pro d584076
CORRECT the extension on the prompt template
eric-mccann-pro 494cb9f
If you're a float, be a float
eric-mccann-pro 0381f8b
Correct property name
eric-mccann-pro 9a9c478
Copy topics+entities to main detection more defensively
eric-mccann-pro f61fa98
Update python/QwenSpeechSummarization/qwen_speech_summarization_compo…
eric-mccann-pro 968684b
Raise proper exception abhout audio detection not being supported
eric-mccann-pro 12d6f06
Freeze versions of some deps
eric-mccann-pro 0fb3f55
Replace setup.cfg
eric-mccann-pro 562d02a
Move env vars to config
eric-mccann-pro 790c472
print => logger
eric-mccann-pro cb74610
Pin vllm version
eric-mccann-pro 1878752
Update overview
eric-mccann-pro 723ba20
Prompt grammar and clarity
eric-mccann-pro 84411f0
Give more control over healthcheck
eric-mccann-pro 83ed483
Skip healthcheck if vllm_health_uri is falsey
eric-mccann-pro 1d2b204
Remove duplicate import
eric-mccann-pro 5fd25e1
Merge remote-tracking branch 'origin/master' into feat/qwen-speech-su…
eric-mccann-pro 40b48f9
Correct exported component path
eric-mccann-pro 2f6199b
Update python/QwenSpeechSummarization/qwen_speech_summarization_compo…
eric-mccann-pro cdfaad4
Describe get_detections_from_all_video_tracks
eric-mccann-pro 19c84aa
No parent package? no problem
eric-mccann-pro 779845d
Rename file about public domain origin of test.txt to NOTICE
eric-mccann-pro 4236821
Correct env var name in the readme
eric-mccann-pro e8a8a22
Make copyrights right
eric-mccann-pro bd0c557
Make more of the parameters live permanently on config rather than on…
eric-mccann-pro ba8204c
Fix deprecated logging method
eric-mccann-pro b84bf88
Lower the roof. Raise a real mpf DetectionError
eric-mccann-pro f9d0ace
Correct property name for CLASSIFIERS_LIST
eric-mccann-pro d8ad16e
Fix (and test) chunk overlap
eric-mccann-pro 03d2374
Fix counting of overlaps AND fix tests after related logic was changed
eric-mccann-pro 0a93995
Rename to LlmSpeechSummarization
eric-mccann-pro 08336e1
Missed component rebranding instances
eric-mccann-pro 46423d1
Use urljoin instead of path join for health uri default
eric-mccann-pro 8ce36d6
Don't leak contexts
eric-mccann-pro f5ae9a8
Create a constant for BOUNDARY_TOKEN_FOR_COUNTING
eric-mccann-pro 55a940e
Fix slapchop overlap and add a new test for overlap >1
eric-mccann-pro 014076d
Add another test for longish overlaps
eric-mccann-pro 56f5be9
Fix tests' expected output in light of slapchop corrections
eric-mccann-pro 5918691
Remove prints
eric-mccann-pro 6bf3b25
Don't rely on __dict__ to access entities
eric-mccann-pro 7a62b5d
Prevent newlines within an utterance when mangling a book as test tra…
eric-mccann-pro 9f6666f
Fix counting of tokens per each input line
eric-mccann-pro 6d00138
Force spoken tracks to not contain newlines
eric-mccann-pro 07015a9
run_component_test: now with logging configured, and env variable han…
eric-mccann-pro d10dd7f
Set slapchop logger level too
eric-mccann-pro 04d20a8
Don't describe the output schema in the prompt. Just include the json…
eric-mccann-pro c36bcbd
Add COMBINATION_INSTRUCTIONs to the schema that are specifically for …
eric-mccann-pro 4f659b0
Update test_llm_speech_summarization_component assertion to match upd…
eric-mccann-pro b9e92db
Move classifiers instructions into schema.py
eric-mccann-pro f59410e
Add more specific language about summary combination
eric-mccann-pro 587e8de
Fix some wonk with when summarizing big chunks
eric-mccann-pro e79f7b4
Lower default chunk size now that tokens are counted correctly
eric-mccann-pro 3c94b8f
Merge remote-tracking branch 'origin/feat/qwen-speech-summarization' …
eric-mccann-pro 48ce688
Increase safety margin on max_completion_tokens
eric-mccann-pro 5f4a1fe
Add properties ALLOW_REFUSAL_RESPONSE and ALLOW_PARTIAL_RESPONSE. Log…
eric-mccann-pro 8731fe2
Merge remote-tracking branch 'origin/feat/qwen-speech-summarization' …
eric-mccann-pro be7c7fa
Restore global logger instance
eric-mccann-pro 260a369
Create a utility fn and test for throwing errors with mpf types
eric-mccann-pro 49a4045
Only use mpf exception types
eric-mccann-pro 9064cca
Reduce streaming COMPLETION messages to de bug (only enabled when DEB…
eric-mccann-pro 998bb2b
Remove redundant debug messages
eric-mccann-pro c4f2910
Fix tests with FakeLLM after adjustments to _get_output
eric-mccann-pro e24d3b6
Make last_error in connection loop more reliable
eric-mccann-pro 0d43ed8
Fix default VLLM_URI in descriptor, post-rename
eric-mccann-pro 9a6d47b
Allow an empty vllm_health_uri to skip the health check
eric-mccann-pro 7edcd83
Add a separate TOKENIZER_MODEL in case the model name used for the op…
eric-mccann-pro 6b63f85
Azure support
eric-mccann-pro d23b333
Make the schema compatible with azure's gpt
eric-mccann-pro 0b4ace3
Sometimes ChatGPT will stream an event without choices. Continue when…
eric-mccann-pro a976278
Make confidence be a rating that's strictly about true positives
eric-mccann-pro 8037c23
Export LlmSpeechSummaryComponent
eric-mccann-pro e9d45ce
classifiers: conditionally restore partial instructions to default pr…
eric-mccann-pro 3ef168f
codify the length requirement for the classifiers list in the schema
eric-mccann-pro 85a8192
Restore previous monolithic classifier... 50 is probably way too many
eric-mccann-pro 4cb1ddc
Dynamically build pydantic model such that classifiers is an object N…
eric-mccann-pro 6c7634f
Revert "classifiers: conditionally restore partial instructions to de…
eric-mccann-pro e1237fa
Restore TRUE NEGATIVE confidence specification
eric-mccann-pro a9eb818
Correct simulated test input for new LLM response_format AND correct …
eric-mccann-pro 892ab9e
Fix handling of dynamic strict model fields for azure gpt
eric-mccann-pro 3dd3e6c
Expose more util functions to callers when used as a module
eric-mccann-pro 91987cf
Ensure text is always a string before trying to remove newlines
eric-mccann-pro 6cbb8e6
Handle and report content_filter errors when encountered
eric-mccann-pro a68e118
SUCCESSFULLY make sure there are no newlines in the CSV's text field,…
eric-mccann-pro 67c6256
Reword descriptions of properties that allow continuation after a pos…
eric-mccann-pro cf5e1e3
Make property names less variable specific
eric-mccann-pro d9dcd42
Use TEXT if no TRANSCRIPT and no TRANSLATION
eric-mccann-pro e0e24a6
llmspeechsummarization/Dockerfile: download both qwen and gpt-oss tok…
eric-mccann-pro c8a95d9
Merge branch 'develop' into feat/qwen-speech-summarization
jrobble b7d9350
Merge remote-tracking branch 'origin/develop' into feat/qwen-speech-s…
tstrass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # syntax=docker/dockerfile:1.2 | ||
|
|
||
| ############################################################################# | ||
| # NOTICE # | ||
| # # | ||
| # This software (or technical data) was produced for the U.S. Government # | ||
| # under contract, and is subject to the Rights in Data-General Clause # | ||
| # 52.227-14, Alt. IV (DEC 2007). # | ||
| # # | ||
| # Copyright 2025 The MITRE Corporation. All Rights Reserved. # | ||
| ############################################################################# | ||
|
|
||
| ############################################################################# | ||
| # Copyright 2025 The MITRE Corporation # | ||
| # # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); # | ||
| # you may not use this file except in compliance with the License. # | ||
| # You may obtain a copy of the License at # | ||
| # # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 # | ||
| # # | ||
| # Unless required by applicable law or agreed to in writing, software # | ||
| # distributed under the License is distributed on an "AS IS" BASIS, # | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # | ||
| # See the License for the specific language governing permissions and # | ||
| # limitations under the License. # | ||
| ############################################################################# | ||
|
|
||
| ARG BUILD_REGISTRY | ||
| ARG BUILD_TAG=latest | ||
| FROM ${BUILD_REGISTRY}openmpf_python_executor_ssb:${BUILD_TAG} | ||
|
|
||
| ARG RUN_TESTS=false | ||
| RUN set -x; DEPS="transformers>=4.51.0 accelerate==1.12.0 pydantic==2.12.5 openai==2.16.0 jinja2"; \ | ||
| if [ "${RUN_TESTS,,}" == true ]; then DEPS="$DEPS pytest"; fi; \ | ||
| pip3 install --no-cache-dir $DEPS | ||
|
|
||
| ARG VLLM_MODEL="Qwen/Qwen3-30B-A3B-Instruct-2507-FP8" | ||
| ARG TOKENIZER_MODELS="${VLLM_MODEL} openai/gpt-oss-120b" | ||
|
|
||
| RUN --mount=target=.,readwrite \ | ||
| install-component.sh; \ | ||
| # make sure the tokenizers are available offline | ||
| for tokenizer_model in ${TOKENIZER_MODELS}; do /opt/mpf/plugin-venv/bin/python3 -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained(\"${tokenizer_model}\")"; done; \ | ||
| if [ "${RUN_TESTS,,}" == true ]; then pytest llm_speech_summarization_component; fi | ||
|
|
||
| LABEL org.label-schema.license="Apache 2.0" \ | ||
| org.label-schema.name="OpenMPF LLM Speech Summarization" \ | ||
| org.label-schema.schema-version="1.0" \ | ||
| org.label-schema.url="https://openmpf.github.io" \ | ||
| org.label-schema.vcs-url="https://github.com/openmpf/openmpf-components" \ | ||
| org.label-schema.vendor="MITRE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| ############################################################################# | ||
| # NOTICE # | ||
| # # | ||
| # This software (or technical data) was produced for the U.S. Government # | ||
| # under contract, and is subject to the Rights in Data-General Clause # | ||
| # 52.227-14, Alt. IV (DEC 2007). # | ||
| # # | ||
| # Copyright 2025 The MITRE Corporation. All Rights Reserved. # | ||
| ############################################################################# | ||
|
|
||
| ############################################################################# | ||
| # Copyright 2025 The MITRE Corporation # | ||
| # # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); # | ||
| # you may not use this file except in compliance with the License. # | ||
| # You may obtain a copy of the License at # | ||
| # # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 # | ||
| # # | ||
| # Unless required by applicable law or agreed to in writing, software # | ||
| # distributed under the License is distributed on an "AS IS" BASIS, # | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # | ||
| # See the License for the specific language governing permissions and # | ||
| # limitations under the License. # | ||
| ############################################################################# | ||
|
|
||
| FROM ubuntu:20.04 AS download_model | ||
|
|
||
| RUN --mount=type=tmpfs,target=/var/cache/apt \ | ||
| --mount=type=tmpfs,target=/var/lib/apt/lists \ | ||
| --mount=type=tmpfs,target=/tmp \ | ||
| apt-get update && apt-get install --no-install-recommends -y curl ca-certificates python3-venv python3-pip python3-certifi python3-urllib3 && \ | ||
| pip install huggingface_hub[cli] | ||
|
|
||
| ARG VLLM_MODEL="Qwen/Qwen3-30B-A3B-Instruct-2507-FP8" | ||
| ENV VLLM_MODEL="${VLLM_MODEL}" | ||
| RUN HF_HUB_DISABLE_XET=1 hf download ${VLLM_MODEL} | ||
|
|
||
|
|
||
| FROM vllm/vllm-openai:v0.15.0 | ||
| ARG VLLM_MODEL="Qwen/Qwen3-30B-A3B-Instruct-2507-FP8" | ||
| ENV VLLM_MODEL="${VLLM_MODEL}" | ||
|
|
||
| USER root | ||
| RUN mkdir -p /root/.cache | ||
| COPY --chown=root:root --from=download_model /root/.cache/huggingface /root/.cache/huggingface | ||
|
|
||
| # default value | ||
| ENV MAX_MODEL_LEN=45000 | ||
|
|
||
| COPY --chown=root:root vllm-entrypoint.sh /usr/bin/ | ||
|
|
||
| ENTRYPOINT ["/usr/bin/vllm-entrypoint.sh"] | ||
|
|
||
| CMD [ \ | ||
| "--host", "0.0.0.0",\ | ||
| "--port", "11434"\ | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Overview | ||
|
|
||
| LlmSpeechSummarization component uses a vllm-served LLM model (Qwen3 by default) to summarize FeedForward video tracks' speech detections. | ||
|
|
||
| # Details | ||
|
|
||
| This folder contains source code for the OpenMPF LLM Speech Summarization Component. | ||
|
|
||
| This component requires a base image python3.10+ and an mpf_component_api that supports mpf.AllVideoTracksJob. | ||
|
|
||
| We have tested Qwen/Qwen3-30B-A3B-Instruct-2507 on an 80GB card and Qwen/Qwen3-30B-A3B-Instruct-2507-FP8 on a 40GB card. Both seem quite viable. | ||
|
|
||
| If you are daring, any openai-compatible API could be substituted for VLLM and any model could replace Qwen3-30B BUT these scenarios are untested | ||
| and your mileage may vary. | ||
|
|
||
| In either case, the component assumes anonymous access to the openai-api-compatible endpoint that performs the summarization. | ||
|
|
||
| # Inputs | ||
|
|
||
| - classifiers.json: contains a definition of subjects of interest to score with a low 0-1 confidence if the input DOES NOT include the defined classifier OR high if it does | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "Classifier": "Major League Baseball", | ||
| "Definition": "discussions regarding major league baseball teams, professional baseball players, and baseball stadiums", | ||
| "Items of Interest": "Baseball fields, baseball teams, baseball players, baseballs, baseball bats, baseball hats" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| # Properties | ||
|
|
||
| - `CLASSIFIERS_FILE`: when set to an absolute path (with a valid classifiers.json in a volume mounted such that the file is at the specified path), will replace the default classifiers.json | ||
| - `CLASSIFIERS_LIST`: Either "ALL", or a comma-separated list of specific names of the "Classifier" fields of defined classifiers | ||
| - `PROMPT_TEMPLATE`: if set, will replace the packaged `templates/prompt.jinja` with one read from this location. Must include self-recursive summarization instructions and the jinja templates `{{ classifiers }}` and `{{ input }}`. | ||
|
|
||
| # Docker build-args | ||
|
|
||
| - `VLLM_MODEL`: if building Dockerfile.vllm for vllm (which downloads the model during docker build), this is the ONLY model that your llm_speech_summarization_component will be able to use. | ||
|
|
||
| NOTE: if you have an internet connection at runtime, you may use the image `vllm/vllm-openai:latest` directly in lieu of building Dockerfile.vllm. We do not support this arrangement BUT it is possible with the right command on the docker service. | ||
|
|
||
| # Environment variables | ||
|
|
||
| - `VLLM_MODEL`: must MATCH the model name being served by vllm OR be available at whichver openai-api-compatible API you choose to talk to. | ||
| - `VLLM_URI`: the base_url of the openai-api-compatible API providing access to your model. If your vllm service is named vllm, then this would need to be `http://vllm:11434/v1`. | ||
| - `MAX_MODEL_LEN` should be defined on both the llm-speech-summarization container AND the llm-speech-summarization-server (VLLM) container. It is the maximum input+output token count you can use without erroring. We have tried 45000 for the -FP8 model and 120000 for the nonquantized model on a 40GB and 80GB card, respectively. | ||
| - `INPUT_TOKEN_CHUNK_SIZE` should be about 20%-30% of your `MAX_MODEL_LEN`, and is the token size that your input will be split into during chunking before making a series of calls to the LLM. | ||
| - `INPUT_CHUNK_TOKEN_OVERLAP` should be small and constant. If it is too small, there will be no overlap between chunks, which could negatively impact performance with huge input tracks. | ||
|
|
||
| # Outputs | ||
|
|
||
| A list of mpf.VideoTracks or mpf.AudioTracks (once supported). | ||
|
|
||
| Track[0] will always contain the overall summary of the input, including primary/other topics and entities. | ||
|
|
||
| Track[1-n] will be the confidences, reasoning, and name for each of the intersection of enabled classifiers AND classifiers defined in classifiers.json. | ||
33 changes: 33 additions & 0 deletions
33
python/LlmSpeechSummarization/llm_speech_summarization_component/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ############################################################################# | ||
| # NOTICE # | ||
| # # | ||
| # This software (or technical data) was produced for the U.S. Government # | ||
| # under contract, and is subject to the Rights in Data-General Clause # | ||
| # 52.227-14, Alt. IV (DEC 2007). # | ||
| # # | ||
| # Copyright 2025 The MITRE Corporation. All Rights Reserved. # | ||
| ############################################################################# | ||
|
|
||
| ############################################################################# | ||
| # Copyright 2025 The MITRE Corporation # | ||
| # # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); # | ||
| # you may not use this file except in compliance with the License. # | ||
| # You may obtain a copy of the License at # | ||
| # # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 # | ||
| # # | ||
| # Unless required by applicable law or agreed to in writing, software # | ||
| # distributed under the License is distributed on an "AS IS" BASIS, # | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # | ||
| # See the License for the specific language governing permissions and # | ||
| # limitations under the License. # | ||
| ############################################################################# | ||
|
|
||
| from .llm_speech_summarization_component import LlmSpeechSummaryComponent, JobConfig | ||
|
|
||
| from .schema import StructuredResponseClassFactory | ||
|
|
||
| from .llm_util.classifiers import get_classifier_lines, get_classifier_dict | ||
| from .llm_util.slapchop import split_csv_into_chunks, summarize_summaries, BOUNDARY_TOKEN_FOR_COUNTING | ||
| from .llm_util.input_cleanup import convert_speech_tracks_to_csv |
7 changes: 7 additions & 0 deletions
7
python/LlmSpeechSummarization/llm_speech_summarization_component/classifiers.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [ | ||
| { | ||
| "Classifier": "Major League Baseball", | ||
| "Definition": "discussions regarding major league baseball teams, professional baseball players, and baseball stadiums", | ||
| "Items of Interest": "Baseball fields, baseball teams, baseball players, baseballs, baseball bats, baseball hats" | ||
| } | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.