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

Online Conversion #47

Merged
merged 36 commits into from
Nov 15, 2024
Merged

Online Conversion #47

merged 36 commits into from
Nov 15, 2024

Conversation

kozlov721
Copy link
Collaborator

@kozlov721 kozlov721 commented Oct 31, 2024

Changes

  • Added new hub subcommand to the CLI
    • Interactions with models, versions and instances
    • Support for online conversion
  • Cleaned up the CLI
    • Moved types, enums and helper functions out of __main__.py

Online Conversion API

The online conversion can be run either from CLI or using python API.

  1. New model resource is created on HubAI if it doesn't exist
  2. New modelVersion is created
    • The name of the modelVersion will be "{model_name} {height}x{width}"
    • If it's the first version, the version number will be "0.1.0"
    • Otherwise, the last part of the version number is auto-incremented
    • User can also specify the version argument for a custom version number
  3. New modelInstance is created
    • The name will be "{version_name} base instance"
  4. Export is started on the HubAI
    • The instance name of the exported modelInstance will be "{version_name} exported to {target}"
  5. Once the conversion finishes successfully, the model is downloaded to a newly created directory with the same name as the exported modelInstance slug
    • Can be customized using the output_dir argument

Python API

from modelconverter.hub import convert

converted_model = convert("RVC2", "path/to/model.onnx")

It's also possible to specify numerous arguments related to model, modelVersion, and modelInstance resources:

from modelconverter.hub import convert

converted_model_path = convert(
    "RVC2",
    "path/to/model.onnx", 
    description_short="description",
    tasks=["CLASSIFICATION"],
    license_type="MIT",
    is_public=False,
    quantization_data="WAREHOUSE",
    tool_version="2021.4.0",
)

CLI

modelconverter hub convert rvc2 --path path/to/model.onnx       \
                                --description-short description \
                                --tasks CLASSIFICATION          \
                                --license-type MIT              \
                                --no-is-public                  \
                                --quantization-data WAREHOUSE   \
                                --tool-version 2021.4.0

Environment Variables

  • HUBAI_API_KEY - contains the HubAI API token
  • HUBAI_URL - can be used to change the used URL

New Commands

  • modelconverter hub convert

model

  • modelconverter hub model ls
  • modelconverter hub model info
  • modelconverter hub model create
  • modelconverter hub model delete

version

  • modelconverter hub version ls
  • modelconverter hub version info
  • modelconverter hub version create
  • modelconverter hub version delete

instance

  • modelconverter hub instance ls
  • modelconverter hub instance info
  • modelconverter hub instance create
  • modelconverter hub instance delete
  • modelconverter hub instance download
  • modelconverter hub instance upload
  • modelconverter hub instance config

Example

  • modelconvereter hub version ls
  • modelconverter hub model info 6a3d3f58-ab45-4cdf-8eb9-32a38d6d3297

@kozlov721 kozlov721 requested a review from a team as a code owner October 31, 2024 19:52
@kozlov721 kozlov721 requested review from klemen1999, tersekmatija and conorsim and removed request for a team October 31, 2024 19:52
@kozlov721 kozlov721 changed the title Feature/online Online Conversion Oct 31, 2024
@kozlov721 kozlov721 self-assigned this Oct 31, 2024
@kozlov721 kozlov721 added enhancement New feature or request CLI Changes affecting the CLI labels Oct 31, 2024
modelconverter/hub/__main__.py Outdated Show resolved Hide resolved
modelconverter/hub/__main__.py Outdated Show resolved Hide resolved
modelconverter/hub/__main__.py Outdated Show resolved Hide resolved
modelconverter/hub/__main__.py Outdated Show resolved Hide resolved
modelconverter/hub/__main__.py Outdated Show resolved Hide resolved
@kozlov721 kozlov721 merged commit f09f9ed into main Nov 15, 2024
1 check passed
@kozlov721 kozlov721 deleted the feature/online branch November 15, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Changes affecting the CLI enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants