-
Notifications
You must be signed in to change notification settings - Fork 4k
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 support for uri inputs in audio models for transformers #8495
Add support for uri inputs in audio models for transformers #8495
Conversation
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
@pytest.mark.skipif( | ||
Version(transformers.__version__) < Version("4.29.0"), reason="Feature does not exist" | ||
) | ||
@pytest.mark.skipif(RUNNING_IN_GITHUB_ACTIONS, reason="url dependency") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is marked as a non-CI test due to the url dependency
Signed-off-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
Documentation preview for 3a80995 will be available here when this CircleCI job completes successfully. More info
|
docs/source/models.rst
Outdated
will be thrown at inference time. | ||
|
||
.. warning:: If using a uri (`str`) as an input type for a `pyfunc` model, you *must* specify a custom model signature when logging or saving the model. | ||
The default signature value of ``bytes`` will, in `MLflow Model serving`, force the conversion of the string to ``bytes``, which will cause an Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Can we avoid automatically converting string input to bytes
but raising error instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll see if I can make this work!
def test_whisper_model_with_url(whisper_pipeline): | ||
artifact_path = "whisper_url" | ||
|
||
url = "https://www.nasa.gov/mp3/590325main_ringtone_kennedy_WeChoose.mp3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we commit an audio file in this repo, use it, and remove skipif
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good point. I'll convert to pulling the .wav file I added in the last audio PR :)
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
dbc1058
to
6b409a9
Compare
Signed-off-by: Ben Wilson <39283302+BenWilson2@users.noreply.github.com>
@mlflow-automation autoformat |
Signed-off-by: mlflow-automation <mlflow-automation@users.noreply.github.com>
if "Malformed soundfile" in str(e): | ||
raise MlflowException( | ||
"Failed to process the input audio data. Either the audio file is " | ||
"corrupted or a uri was passed in without overriding the default model " | ||
"signature. If submitting a string uri, please ensure that the model has " | ||
"been saved with a signature that defines a string input type.", | ||
error_code=INVALID_PARAMETER_VALUE, | ||
) from e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this testable? If yes, can we add a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's currently tested in test_whisper_model_using_uri_with_default_signature_raises()
. I'll add another test explicitly for the direct usage in pyfunc just to make it more obvious that we're validating this logic instead of allowing the highly cryptic and difficult to understand underlying exception from ffmpeg to throw if the user calls the pyfunc model with an invalid audio file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once https://github.com/mlflow/mlflow/pull/8495/files#r1203259673 is addressed!
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
@mlflow-automation autoformat |
Related Issues/PRs
#xxxWhat changes are proposed in this pull request?
Add support for uri inputs for audio models in transformers
How is this patch tested?
Manual validation of multiple audio formats from multiple public domain audio clip repositories
Does this PR change the documentation?
Release Notes
Is this a user-facing change?
Audio pipelines for transformers now support uri references as input to pyfunc flavor
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/docs
: MLflow documentation pagesarea/examples
: Example codearea/model-registry
: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models
: MLmodel format, model serialization/deserialization, flavorsarea/recipes
: Recipes, Recipe APIs, Recipe configs, Recipe Templatesarea/projects
: MLproject format, project running backendsarea/scoring
: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra
: MLflow Tracking server backendarea/tracking
: Tracking Service, tracking client APIs, autologgingInterface
area/uiux
: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker
: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy
: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows
: Windows supportLanguage
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesIntegrations
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsHow should the PR be classified in the release notes? Choose one:
rn/breaking-change
- The PR will be mentioned in the "Breaking Changes" sectionrn/none
- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/feature
- A new user-facing feature worth mentioning in the release notesrn/bug-fix
- A user-facing bug fix worth mentioning in the release notesrn/documentation
- A user-facing documentation change worth mentioning in the release notes