Observed since 21 Oct, 11:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AI Marketplace Python SDK
This package provides the class-based SDK used by model authors.
python -m pip install ai-marketplace-sdk
cd packages/python/sdk
uv pip install .
cd packages/python/sdk
uv pip install -e .
Model containers must use the canonical executable module:
python -m aimp_sdk.model_runner --module /app/main.py
aimp_sdk.model_runner is the only supported public model runtime entrypoint.
It starts the long-lived stdin/stdout runner that emits the initial {"type":"ready"}
protocol message and serves mode requests.
Stream.text(text=Schema.Outputs.<field>, status=Schema.Outputs.<json>) with
StreamState for status(...) updates; done() returns validated outputs. The execution sink
remains internal.PlaygroundSpec in playground.py only: When, SectionRole,
Markdown(..., stream=True), sources=PlaygroundSources(history=source.chat_history()),
computed=PlaygroundComputed(...) with computed.asset_ref / computed.asset_refs, and typed
item fields via JsonField(schema=..., multiple=True) plus Image.asset_ref(...).
Only outputs referenced by views are UI-rendered; other outputs stay contract-only.The fine-tune flow has two sides:
Model authors declare fine-tune inputs by subclassing FineTuneSchema in
tuning/dataset.py.
Available field types:
ImageFieldAudioFieldVideoFieldFileFieldTextFieldJsonFieldExample:
from aimp_sdk import FineTuneSchema, ImageField
def validate_png(value: object) -> None:
if not str(value).lower().endswith(".png"):
raise ValueError("Only PNG files are allowed")
class ModelFineTuneSchema(FineTuneSchema):
query_image = ImageField(required=True, validators=[validate_png])
candidate_image = ImageField(required=True, validators=[validate_png])
Use field-level validators=[...] and preprocessors=[...] when one field needs custom cleanup or
validation. These hooks run during local bundle build, before upload.
Model authors implement tuning behavior in tuning/runner.py and bind it from
main.py using tuning = ....
The runner declares strategy plus tuning contracts and implements run(session) -> TuneResult.
from aimp_sdk import Model, TuneResult
class CoreTuning:
strategy = "lora"
dataset_schema = CoreDataset
hyperparams_schema = CoreHyperparams
async def run(self, session) -> TuneResult:
learning_rate = session.suggest_float("learning_rate", 1e-5, 1e-3, default=5e-4)
epochs = session.suggest_int("epochs", 1, 5, default=3)
for record in session.train_dataset:
train_step(
query_image=session.resolve_path(record.query_image),
candidate_image=session.resolve_path(record.candidate_image),
learning_rate=learning_rate,
)
_ = epochs
validation_recall_at_10 = evaluate(session.validation_dataset)
return TuneResult(metrics={"validation_recall_at_10": validation_recall_at_10})
class CoreModel(Model):
engine = CoreEngine
tuning = CoreTuning
The runner owns only model-authored training logic and typed schemas. Dataset bundle format, validation split policy, optimization targets, and hardware selection belong to job/platform inputs, not runner class attributes.
session exposes only training concerns:
session.train_datasetsession.validation_datasetsession.paramssession.resolve_path(...)session.suggest_float(...)session.suggest_int(...)session.suggest_categorical(...)In the current SDK, authors implement build(self, ctx) to load runtime state once. The separate
load(...) method is framework-internal cache/lifecycle plumbing and is not the author-facing hook.
session.params comes from the model's published tuning.parameters contract. Defaults and search
space metadata are contract-owned by the platform. Use session.suggest_* helpers for explicit
default handling; the SDK does not add random or hidden fallbacks.
Model code does not handle dataset files, S3 uploads, adapter URIs, or trial orchestration.
Consumers do not write model-side tuning code. They use the published schema through the CLI:
ai fine-tune schema --model <model-slug>ai fine-tune scaffold --model <model-slug>prepare_bundle.py and add any local assets/python prepare_bundle.pyai fine-tune create --model <model-slug> --output-dir .During bundle build the SDK:
data.parquet and manifest.jsonThat means field preprocessors and validators run before upload, not during remote execution.
Successful LoRA fine-tunes produce a derived executable model with its own asset ID and slug. Clients should execute that derived model directly, as if it were a new model:
job = client.fine_tune_job(job_id="ft-123").wait_for_completion()
result = client.models.execute(
model=job.tuned_model_slug,
mode="generate",
input={"prompt": "hello"},
)
Client code should not pass adapter_id to executions. Adapter resolution is platform-internal.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.6.9 | 2 May 2026 | 3 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 21 Oct, 11:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:107f1759207aec21a114b774be6f095636ea8cf068a738fd9147e2b2340580bc