acprof 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- acprof/__init__.py +3 -0
- acprof/__main__.py +5 -0
- acprof/_bundle/.dockerignore +20 -0
- acprof/_bundle/LICENSE +202 -0
- acprof/_bundle/NOTICE +43 -0
- acprof/_bundle/acprof/__init__.py +3 -0
- acprof/_bundle/acprof/__main__.py +5 -0
- acprof/_bundle/acprof/analysis/__init__.py +1 -0
- acprof/_bundle/acprof/analysis/audit.py +276 -0
- acprof/_bundle/acprof/analysis/comparison.py +364 -0
- acprof/_bundle/acprof/analysis/compatibility.py +223 -0
- acprof/_bundle/acprof/analysis/conditions.py +185 -0
- acprof/_bundle/acprof/analysis/independent_comparison.py +191 -0
- acprof/_bundle/acprof/analysis/latency_model.py +1106 -0
- acprof/_bundle/acprof/analysis/latency_report.py +577 -0
- acprof/_bundle/acprof/analysis/model.py +276 -0
- acprof/_bundle/acprof/analysis/precision.py +51 -0
- acprof/_bundle/acprof/analysis/uncertainty.py +144 -0
- acprof/_bundle/acprof/application/__init__.py +1 -0
- acprof/_bundle/acprof/application/download.py +14 -0
- acprof/_bundle/acprof/application/errors.py +5 -0
- acprof/_bundle/acprof/application/notifications.py +302 -0
- acprof/_bundle/acprof/application/preparation.py +333 -0
- acprof/_bundle/acprof/application/resources.py +66 -0
- acprof/_bundle/acprof/application/run.py +462 -0
- acprof/_bundle/acprof/application/terminal_log.py +136 -0
- acprof/_bundle/acprof/artifact_layout.py +261 -0
- acprof/_bundle/acprof/artifacts.py +161 -0
- acprof/_bundle/acprof/capabilities.py +404 -0
- acprof/_bundle/acprof/cli/__init__.py +1 -0
- acprof/_bundle/acprof/cli/audit.py +74 -0
- acprof/_bundle/acprof/cli/auto.py +41 -0
- acprof/_bundle/acprof/cli/backfill_compute.py +498 -0
- acprof/_bundle/acprof/cli/compare.py +34 -0
- acprof/_bundle/acprof/cli/coverage.py +70 -0
- acprof/_bundle/acprof/cli/doctor.py +47 -0
- acprof/_bundle/acprof/cli/inspect.py +101 -0
- acprof/_bundle/acprof/cli/load.py +190 -0
- acprof/_bundle/acprof/cli/main.py +64 -0
- acprof/_bundle/acprof/cli/model_store.py +22 -0
- acprof/_bundle/acprof/cli/plot.py +211 -0
- acprof/_bundle/acprof/cli/posthoc.py +113 -0
- acprof/_bundle/acprof/cli/probe.py +186 -0
- acprof/_bundle/acprof/cli/report.py +35 -0
- acprof/_bundle/acprof/cli/results.py +37 -0
- acprof/_bundle/acprof/cli/run.py +54 -0
- acprof/_bundle/acprof/cli/stats.py +94 -0
- acprof/_bundle/acprof/cli/tui.py +65 -0
- acprof/_bundle/acprof/config.py +177 -0
- acprof/_bundle/acprof/container/__init__.py +1 -0
- acprof/_bundle/acprof/container/compat/__init__.py +1 -0
- acprof/_bundle/acprof/container/compat/transformers_dynamic.py +54 -0
- acprof/_bundle/acprof/container/compat/transformers_model_types.json +1091 -0
- acprof/_bundle/acprof/container/compute_profile_runner.py +392 -0
- acprof/_bundle/acprof/container/download_model.py +165 -0
- acprof/_bundle/acprof/container/execution.py +73 -0
- acprof/_bundle/acprof/container/handlers/__init__.py +298 -0
- acprof/_bundle/acprof/container/handlers/audio.py +743 -0
- acprof/_bundle/acprof/container/handlers/custom_pipeline.py +74 -0
- acprof/_bundle/acprof/container/handlers/cv.py +321 -0
- acprof/_bundle/acprof/container/handlers/diffusion.py +728 -0
- acprof/_bundle/acprof/container/handlers/moss.py +64 -0
- acprof/_bundle/acprof/container/handlers/multimodal.py +609 -0
- acprof/_bundle/acprof/container/handlers/nlp.py +747 -0
- acprof/_bundle/acprof/container/handlers/onnx_tasks.py +231 -0
- acprof/_bundle/acprof/container/handlers/onnxruntime.py +90 -0
- acprof/_bundle/acprof/container/handlers/structured.py +185 -0
- acprof/_bundle/acprof/container/handlers/timeseries.py +178 -0
- acprof/_bundle/acprof/container/load_policy.py +81 -0
- acprof/_bundle/acprof/container/loading_quality.py +48 -0
- acprof/_bundle/acprof/container/local_pipeline.py +31 -0
- acprof/_bundle/acprof/container/model_files.py +280 -0
- acprof/_bundle/acprof/container/model_probe.py +80 -0
- acprof/_bundle/acprof/container/onnx_session.py +150 -0
- acprof/_bundle/acprof/container/runtime_manifest.py +150 -0
- acprof/_bundle/acprof/container/runtime_validate.py +156 -0
- acprof/_bundle/acprof/container/server.py +209 -0
- acprof/_bundle/acprof/container/torch_execution.py +55 -0
- acprof/_bundle/acprof/container/validation.py +172 -0
- acprof/_bundle/acprof/cpu_affinity.py +35 -0
- acprof/_bundle/acprof/dependency_locks.py +129 -0
- acprof/_bundle/acprof/experiment.py +356 -0
- acprof/_bundle/acprof/extensions/__init__.py +294 -0
- acprof/_bundle/acprof/extensions/builtin/manifest.json +3591 -0
- acprof/_bundle/acprof/extensions/onnxruntime/manifest.json +191 -0
- acprof/_bundle/acprof/extensions/schema.py +238 -0
- acprof/_bundle/acprof/extensions/transformers/4.57.6.json +1639 -0
- acprof/_bundle/acprof/extensions/transformers/5.10.4.json +1812 -0
- acprof/_bundle/acprof/failures.py +115 -0
- acprof/_bundle/acprof/hardware_conditions.py +18 -0
- acprof/_bundle/acprof/hf_download.py +143 -0
- acprof/_bundle/acprof/hf_endpoints.py +62 -0
- acprof/_bundle/acprof/hf_transport.py +238 -0
- acprof/_bundle/acprof/host/__init__.py +1 -0
- acprof/_bundle/acprof/host/automation.py +161 -0
- acprof/_bundle/acprof/host/client.py +520 -0
- acprof/_bundle/acprof/host/collection_history.py +77 -0
- acprof/_bundle/acprof/host/collection_workflow.py +285 -0
- acprof/_bundle/acprof/host/command.py +119 -0
- acprof/_bundle/acprof/host/container_lifecycle.py +225 -0
- acprof/_bundle/acprof/host/container_state.py +128 -0
- acprof/_bundle/acprof/host/coverage_state.py +259 -0
- acprof/_bundle/acprof/host/detect.py +669 -0
- acprof/_bundle/acprof/host/docker_runtime.py +359 -0
- acprof/_bundle/acprof/host/doctor.py +158 -0
- acprof/_bundle/acprof/host/env_utils.py +233 -0
- acprof/_bundle/acprof/host/execution_conditions.py +87 -0
- acprof/_bundle/acprof/host/gpu_device.py +66 -0
- acprof/_bundle/acprof/host/hardware_conditions.py +130 -0
- acprof/_bundle/acprof/host/images/__init__.py +1 -0
- acprof/_bundle/acprof/host/images/dependencies.py +169 -0
- acprof/_bundle/acprof/host/images/environment.py +313 -0
- acprof/_bundle/acprof/host/images/graph.py +143 -0
- acprof/_bundle/acprof/host/images/identity.py +6 -0
- acprof/_bundle/acprof/host/images/inventory.py +445 -0
- acprof/_bundle/acprof/host/images/runtime.py +457 -0
- acprof/_bundle/acprof/host/images/scan.py +154 -0
- acprof/_bundle/acprof/host/input_plan.py +1056 -0
- acprof/_bundle/acprof/host/interface_probe.py +141 -0
- acprof/_bundle/acprof/host/largest_scale_probe.py +566 -0
- acprof/_bundle/acprof/host/matrix_plan.py +98 -0
- acprof/_bundle/acprof/host/measurement/__init__.py +1 -0
- acprof/_bundle/acprof/host/measurement/boundary.py +162 -0
- acprof/_bundle/acprof/host/measurement/capture.py +139 -0
- acprof/_bundle/acprof/host/measurement/checkpoint.py +275 -0
- acprof/_bundle/acprof/host/measurement/config.py +212 -0
- acprof/_bundle/acprof/host/measurement/diagnostics.py +247 -0
- acprof/_bundle/acprof/host/measurement/energy_validation.py +172 -0
- acprof/_bundle/acprof/host/measurement/errors.py +25 -0
- acprof/_bundle/acprof/host/measurement/execution.py +396 -0
- acprof/_bundle/acprof/host/measurement/load.py +237 -0
- acprof/_bundle/acprof/host/measurement/metrics.py +975 -0
- acprof/_bundle/acprof/host/measurement/monitors.py +143 -0
- acprof/_bundle/acprof/host/measurement/publication.py +171 -0
- acprof/_bundle/acprof/host/measurement/requests.py +97 -0
- acprof/_bundle/acprof/host/measurement/types.py +82 -0
- acprof/_bundle/acprof/host/model_coverage.py +337 -0
- acprof/_bundle/acprof/host/model_errors.py +116 -0
- acprof/_bundle/acprof/host/model_inspection.py +107 -0
- acprof/_bundle/acprof/host/model_schema.py +35 -0
- acprof/_bundle/acprof/host/model_store.py +733 -0
- acprof/_bundle/acprof/host/network_preflight.py +229 -0
- acprof/_bundle/acprof/host/orchestrator.py +1133 -0
- acprof/_bundle/acprof/host/permissions.py +117 -0
- acprof/_bundle/acprof/host/platform_metadata.py +63 -0
- acprof/_bundle/acprof/host/posthoc/__init__.py +12 -0
- acprof/_bundle/acprof/host/posthoc/backfill.py +415 -0
- acprof/_bundle/acprof/host/posthoc/context.py +400 -0
- acprof/_bundle/acprof/host/posthoc/plans.py +597 -0
- acprof/_bundle/acprof/host/posthoc/service.py +303 -0
- acprof/_bundle/acprof/host/posthoc/storage.py +491 -0
- acprof/_bundle/acprof/host/preflight.py +370 -0
- acprof/_bundle/acprof/host/profiling/__init__.py +1 -0
- acprof/_bundle/acprof/host/profiling/compute.py +436 -0
- acprof/_bundle/acprof/host/profiling/compute_plan.py +261 -0
- acprof/_bundle/acprof/host/profiling/execution.py +547 -0
- acprof/_bundle/acprof/host/profiling/execution_plan.py +576 -0
- acprof/_bundle/acprof/host/profiling/progress.py +83 -0
- acprof/_bundle/acprof/host/profiling/support.py +252 -0
- acprof/_bundle/acprof/host/profiling/tools/__init__.py +1 -0
- acprof/_bundle/acprof/host/profiling/tools/advisor.py +164 -0
- acprof/_bundle/acprof/host/profiling/tools/compute_parsers.py +409 -0
- acprof/_bundle/acprof/host/profiling/tools/execution_environment.py +135 -0
- acprof/_bundle/acprof/host/profiling/tools/execution_parsers.py +364 -0
- acprof/_bundle/acprof/host/profiling/tools/massif.py +418 -0
- acprof/_bundle/acprof/host/profiling/tools/ncu.py +696 -0
- acprof/_bundle/acprof/host/profiling/tools/nsys.py +326 -0
- acprof/_bundle/acprof/host/profiling/tools/tool_discovery.py +229 -0
- acprof/_bundle/acprof/host/profiling/tools/torch.py +158 -0
- acprof/_bundle/acprof/host/result_cleanup.py +65 -0
- acprof/_bundle/acprof/host/run_state.py +639 -0
- acprof/_bundle/acprof/host/runtime_settings.py +10 -0
- acprof/_bundle/acprof/host/runtime_validation.py +302 -0
- acprof/_bundle/acprof/host/source_bundle.py +96 -0
- acprof/_bundle/acprof/host/startup_probe.py +95 -0
- acprof/_bundle/acprof/host/static_metadata.py +936 -0
- acprof/_bundle/acprof/host/task_support.py +121 -0
- acprof/_bundle/acprof/installation.py +26 -0
- acprof/_bundle/acprof/latency_slo.py +62 -0
- acprof/_bundle/acprof/messages.py +26 -0
- acprof/_bundle/acprof/metric_registry.py +315 -0
- acprof/_bundle/acprof/model_candidates.py +297 -0
- acprof/_bundle/acprof/model_contract.py +234 -0
- acprof/_bundle/acprof/model_dependencies.py +93 -0
- acprof/_bundle/acprof/model_dependency_domain.py +45 -0
- acprof/_bundle/acprof/model_dependency_eval.py +438 -0
- acprof/_bundle/acprof/model_dependency_flow.py +200 -0
- acprof/_bundle/acprof/model_evidence.py +115 -0
- acprof/_bundle/acprof/model_metadata_analysis.py +156 -0
- acprof/_bundle/acprof/model_repository.py +149 -0
- acprof/_bundle/acprof/model_resolution.py +129 -0
- acprof/_bundle/acprof/model_review.py +155 -0
- acprof/_bundle/acprof/model_source_analysis.py +299 -0
- acprof/_bundle/acprof/model_spec.py +204 -0
- acprof/_bundle/acprof/model_support.py +105 -0
- acprof/_bundle/acprof/model_transforms.py +81 -0
- acprof/_bundle/acprof/monitors/__init__.py +1 -0
- acprof/_bundle/acprof/monitors/common.py +63 -0
- acprof/_bundle/acprof/monitors/energy_cpu.py +651 -0
- acprof/_bundle/acprof/monitors/energy_nvml.py +381 -0
- acprof/_bundle/acprof/monitors/gpu_metrics.py +123 -0
- acprof/_bundle/acprof/monitors/interfaces.py +74 -0
- acprof/_bundle/acprof/monitors/perf_mips.py +617 -0
- acprof/_bundle/acprof/monitors/rapl_topology.py +100 -0
- acprof/_bundle/acprof/monitors/resource_metrics.py +472 -0
- acprof/_bundle/acprof/monitors/resource_readers.py +435 -0
- acprof/_bundle/acprof/monitors/resource_usage.py +450 -0
- acprof/_bundle/acprof/monitors/sampling.py +79 -0
- acprof/_bundle/acprof/network_policy.py +182 -0
- acprof/_bundle/acprof/notifications.py +279 -0
- acprof/_bundle/acprof/packet/__init__.py +1 -0
- acprof/_bundle/acprof/packet/merge_packet_latency.py +369 -0
- acprof/_bundle/acprof/packet/sniff_parse_pcap.py +240 -0
- acprof/_bundle/acprof/pixel_metrics.py +103 -0
- acprof/_bundle/acprof/platform.py +180 -0
- acprof/_bundle/acprof/plotting/__init__.py +1 -0
- acprof/_bundle/acprof/plotting/config.py +487 -0
- acprof/_bundle/acprof/plotting/data.py +236 -0
- acprof/_bundle/acprof/plotting/diagnostics.py +747 -0
- acprof/_bundle/acprof/plotting/latency.py +638 -0
- acprof/_bundle/acprof/plotting/metrics.py +648 -0
- acprof/_bundle/acprof/plotting/plotly-LICENSE.txt +21 -0
- acprof/_bundle/acprof/plotting/report.py +66 -0
- acprof/_bundle/acprof/plotting/styles.py +111 -0
- acprof/_bundle/acprof/precision.py +42 -0
- acprof/_bundle/acprof/preparation_events.py +78 -0
- acprof/_bundle/acprof/progress_events.py +105 -0
- acprof/_bundle/acprof/quality.py +153 -0
- acprof/_bundle/acprof/resource_budget.py +29 -0
- acprof/_bundle/acprof/result_csv.py +263 -0
- acprof/_bundle/acprof/result_layers.py +365 -0
- acprof/_bundle/acprof/run_args.py +223 -0
- acprof/_bundle/acprof/run_options.py +225 -0
- acprof/_bundle/acprof/runtime_dependencies.py +195 -0
- acprof/_bundle/acprof/runtime_profiles.py +258 -0
- acprof/_bundle/acprof/runtime_settings.py +72 -0
- acprof/_bundle/acprof/source_identity.py +68 -0
- acprof/_bundle/acprof/telemetry.py +225 -0
- acprof/_bundle/acprof/testing/__init__.py +1 -0
- acprof/_bundle/acprof/testing/evidence.py +117 -0
- acprof/_bundle/acprof/testing/plugin.py +126 -0
- acprof/_bundle/acprof/testing/provenance.py +53 -0
- acprof/_bundle/acprof/testing/sharding.py +14 -0
- acprof/_bundle/acprof/tui/__init__.py +1 -0
- acprof/_bundle/acprof/tui/app.py +934 -0
- acprof/_bundle/acprof/tui/app_contracts.py +43 -0
- acprof/_bundle/acprof/tui/catalog_controller.py +120 -0
- acprof/_bundle/acprof/tui/commands.py +209 -0
- acprof/_bundle/acprof/tui/configuration_controller.py +436 -0
- acprof/_bundle/acprof/tui/diagnostics.py +340 -0
- acprof/_bundle/acprof/tui/downloads.py +56 -0
- acprof/_bundle/acprof/tui/environment.py +248 -0
- acprof/_bundle/acprof/tui/experiment_catalog.py +279 -0
- acprof/_bundle/acprof/tui/experiment_controller.py +132 -0
- acprof/_bundle/acprof/tui/experiment_picker.py +273 -0
- acprof/_bundle/acprof/tui/field_validation.py +62 -0
- acprof/_bundle/acprof/tui/i18n.py +57 -0
- acprof/_bundle/acprof/tui/image_controller.py +525 -0
- acprof/_bundle/acprof/tui/images.py +737 -0
- acprof/_bundle/acprof/tui/input.py +191 -0
- acprof/_bundle/acprof/tui/localization_controller.py +110 -0
- acprof/_bundle/acprof/tui/log.py +310 -0
- acprof/_bundle/acprof/tui/model_candidates.py +278 -0
- acprof/_bundle/acprof/tui/model_controller.py +111 -0
- acprof/_bundle/acprof/tui/model_input.py +12 -0
- acprof/_bundle/acprof/tui/model_store.py +166 -0
- acprof/_bundle/acprof/tui/preflight_controller.py +271 -0
- acprof/_bundle/acprof/tui/preparation.py +269 -0
- acprof/_bundle/acprof/tui/presentation.py +46 -0
- acprof/_bundle/acprof/tui/process.py +111 -0
- acprof/_bundle/acprof/tui/process_controller.py +218 -0
- acprof/_bundle/acprof/tui/profile_controller.py +109 -0
- acprof/_bundle/acprof/tui/progress.py +195 -0
- acprof/_bundle/acprof/tui/recovery.py +114 -0
- acprof/_bundle/acprof/tui/recovery_controller.py +169 -0
- acprof/_bundle/acprof/tui/rendering.py +75 -0
- acprof/_bundle/acprof/tui/reports.py +303 -0
- acprof/_bundle/acprof/tui/result_controller.py +279 -0
- acprof/_bundle/acprof/tui/review_inputs.py +54 -0
- acprof/_bundle/acprof/tui/run_form.py +125 -0
- acprof/_bundle/acprof/tui/run_planning.py +97 -0
- acprof/_bundle/acprof/tui/run_results.py +175 -0
- acprof/_bundle/acprof/tui/scrollbar.py +65 -0
- acprof/_bundle/acprof/tui/settings.py +203 -0
- acprof/_bundle/acprof/tui/slash_controller.py +95 -0
- acprof/_bundle/acprof/tui/stages.py +97 -0
- acprof/_bundle/acprof/tui/storage.py +150 -0
- acprof/_bundle/acprof/tui/table.py +213 -0
- acprof/_bundle/acprof/tui/themes.py +112 -0
- acprof/_bundle/acprof/tui/translation_catalog.py +1861 -0
- acprof/_bundle/acprof/tui/tui.tcss +373 -0
- acprof/_bundle/acprof/tui/views.py +706 -0
- acprof/_bundle/acprof/window_records.py +165 -0
- acprof/_bundle/acprof/workloads/__init__.py +222 -0
- acprof/_bundle/acprof/workloads/audio.py +621 -0
- acprof/_bundle/acprof/workloads/contract.py +116 -0
- acprof/_bundle/acprof/workloads/cv.py +240 -0
- acprof/_bundle/acprof/workloads/diffusion.py +410 -0
- acprof/_bundle/acprof/workloads/multimodal.py +329 -0
- acprof/_bundle/acprof/workloads/nlp.py +151 -0
- acprof/_bundle/acprof/workloads/structured.py +151 -0
- acprof/_bundle/acprof/workloads/timeseries.py +69 -0
- acprof/_bundle/assets/audio/librispeech-clean-test-en-30s/audio.wav +0 -0
- acprof/_bundle/assets/audio/librispeech-clean-test-en-30s/source.json +81 -0
- acprof/_bundle/dockerfiles/environment_tools.py +314 -0
- acprof/_bundle/dockerfiles/locks/audio-cpu.artifacts.json +503 -0
- acprof/_bundle/dockerfiles/locks/audio-cpu.txt +143 -0
- acprof/_bundle/dockerfiles/locks/audio-cu124.artifacts.json +600 -0
- acprof/_bundle/dockerfiles/locks/audio-cu124.txt +171 -0
- acprof/_bundle/dockerfiles/locks/audio-cu128.artifacts.json +544 -0
- acprof/_bundle/dockerfiles/locks/audio-cu128.txt +155 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cpu.artifacts.json +510 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cpu.txt +145 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu124.artifacts.json +607 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu124.txt +173 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu128.artifacts.json +642 -0
- acprof/_bundle/dockerfiles/locks/custom-multimodal-cu128.txt +183 -0
- acprof/_bundle/dockerfiles/locks/cv-cpu.artifacts.json +279 -0
- acprof/_bundle/dockerfiles/locks/cv-cpu.txt +79 -0
- acprof/_bundle/dockerfiles/locks/cv-cu124.artifacts.json +376 -0
- acprof/_bundle/dockerfiles/locks/cv-cu124.txt +107 -0
- acprof/_bundle/dockerfiles/locks/cv-cu128.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/cv-cu128.txt +117 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cpu.artifacts.json +335 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cpu.txt +95 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu124.artifacts.json +432 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu124.txt +123 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu128.artifacts.json +467 -0
- acprof/_bundle/dockerfiles/locks/diffusion-cu128.txt +133 -0
- acprof/_bundle/dockerfiles/locks/moss-transformers5104.artifacts.json +621 -0
- acprof/_bundle/dockerfiles/locks/moss-transformers5104.txt +177 -0
- acprof/_bundle/dockerfiles/locks/multimodal-transformers4576.artifacts.json +635 -0
- acprof/_bundle/dockerfiles/locks/multimodal-transformers4576.txt +181 -0
- acprof/_bundle/dockerfiles/locks/nlp-cpu.artifacts.json +363 -0
- acprof/_bundle/dockerfiles/locks/nlp-cpu.txt +103 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu124.artifacts.json +460 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu124.txt +131 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu128.artifacts.json +495 -0
- acprof/_bundle/dockerfiles/locks/nlp-cu128.txt +141 -0
- acprof/_bundle/dockerfiles/locks/onnxruntime-cpu.artifacts.json +261 -0
- acprof/_bundle/dockerfiles/locks/onnxruntime-cpu.txt +73 -0
- acprof/_bundle/dockerfiles/locks/platform-cpu.artifacts.json +99 -0
- acprof/_bundle/dockerfiles/locks/platform-cpu.txt +27 -0
- acprof/_bundle/dockerfiles/locks/platform-cu124.artifacts.json +196 -0
- acprof/_bundle/dockerfiles/locks/platform-cu124.txt +55 -0
- acprof/_bundle/dockerfiles/locks/platform-cu128.artifacts.json +231 -0
- acprof/_bundle/dockerfiles/locks/platform-cu128.txt +65 -0
- acprof/_bundle/dockerfiles/locks/platform-python-cpu.artifacts.json +37 -0
- acprof/_bundle/dockerfiles/locks/platform-python-cpu.txt +9 -0
- acprof/_bundle/dockerfiles/locks/structured-cpu.artifacts.json +279 -0
- acprof/_bundle/dockerfiles/locks/structured-cpu.txt +79 -0
- acprof/_bundle/dockerfiles/locks/structured-cu124.artifacts.json +376 -0
- acprof/_bundle/dockerfiles/locks/structured-cu124.txt +107 -0
- acprof/_bundle/dockerfiles/locks/structured-cu128.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/structured-cu128.txt +117 -0
- acprof/_bundle/dockerfiles/locks/system-trixie-amd64.json +620 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cpu.artifacts.json +314 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cpu.txt +89 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu124.artifacts.json +411 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu124.txt +117 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu128.artifacts.json +446 -0
- acprof/_bundle/dockerfiles/locks/timeseries-cu128.txt +127 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cpu.artifacts.json +594 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cpu.txt +169 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu124.artifacts.json +691 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu124.txt +197 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu128.artifacts.json +726 -0
- acprof/_bundle/dockerfiles/locks/transformers5104-cu128.txt +207 -0
- acprof/_bundle/dockerfiles/platform.Dockerfile +22 -0
- acprof/_bundle/dockerfiles/requirements/audio.in +5 -0
- acprof/_bundle/dockerfiles/requirements/custom-multimodal.in +2 -0
- acprof/_bundle/dockerfiles/requirements/cv.in +4 -0
- acprof/_bundle/dockerfiles/requirements/diffusion.in +6 -0
- acprof/_bundle/dockerfiles/requirements/moss-transformers5104.in +9 -0
- acprof/_bundle/dockerfiles/requirements/multimodal-transformers4576.in +3 -0
- acprof/_bundle/dockerfiles/requirements/nlp.in +7 -0
- acprof/_bundle/dockerfiles/requirements/onnxruntime.in +9 -0
- acprof/_bundle/dockerfiles/requirements/service.in +8 -0
- acprof/_bundle/dockerfiles/requirements/structured.in +4 -0
- acprof/_bundle/dockerfiles/requirements/timeseries.in +2 -0
- acprof/_bundle/dockerfiles/requirements/timm.in +1 -0
- acprof/_bundle/dockerfiles/requirements/transformers5104.in +4 -0
- acprof/_bundle/dockerfiles/runtime-final.Dockerfile +34 -0
- acprof/_bundle/dockerfiles/runtime-model.Dockerfile +19 -0
- acprof/_bundle/dockerfiles/runtime.Dockerfile +23 -0
- acprof/_bundle/examples/coverage/regression.json +17 -0
- acprof/_bundle/examples/hardware-validation.json +19 -0
- acprof/_bundle/examples/multimodal/ultravox.model.json +29 -0
- acprof/_bundle/examples/nlp/smoke.py +111 -0
- acprof/_bundle/examples/onnxruntime/fixtures.py +164 -0
- acprof/_bundle/examples/onnxruntime/iris.json +16 -0
- acprof/_bundle/examples/onnxruntime/iris.model.json +7 -0
- acprof/_bundle/examples/onnxruntime/real_models.py +155 -0
- acprof/_bundle/examples/onnxruntime/smoke.py +68 -0
- acprof/_bundle/examples/structured/chronos_smoke.py +56 -0
- acprof/_bundle/examples/structured/export_models.py +71 -0
- acprof/_bundle/examples/structured/smoke.py +71 -0
- acprof/_bundle/licenses/CC-BY-4.0.txt +156 -0
- acprof/analysis/__init__.py +1 -0
- acprof/analysis/audit.py +276 -0
- acprof/analysis/comparison.py +364 -0
- acprof/analysis/compatibility.py +223 -0
- acprof/analysis/conditions.py +185 -0
- acprof/analysis/independent_comparison.py +191 -0
- acprof/analysis/latency_model.py +1106 -0
- acprof/analysis/latency_report.py +577 -0
- acprof/analysis/model.py +276 -0
- acprof/analysis/precision.py +51 -0
- acprof/analysis/uncertainty.py +144 -0
- acprof/application/__init__.py +1 -0
- acprof/application/download.py +14 -0
- acprof/application/errors.py +5 -0
- acprof/application/notifications.py +302 -0
- acprof/application/preparation.py +333 -0
- acprof/application/resources.py +66 -0
- acprof/application/run.py +462 -0
- acprof/application/terminal_log.py +136 -0
- acprof/artifact_layout.py +261 -0
- acprof/artifacts.py +161 -0
- acprof/capabilities.py +404 -0
- acprof/cli/__init__.py +1 -0
- acprof/cli/audit.py +74 -0
- acprof/cli/auto.py +41 -0
- acprof/cli/backfill_compute.py +498 -0
- acprof/cli/compare.py +34 -0
- acprof/cli/coverage.py +70 -0
- acprof/cli/doctor.py +47 -0
- acprof/cli/inspect.py +101 -0
- acprof/cli/load.py +190 -0
- acprof/cli/main.py +64 -0
- acprof/cli/model_store.py +22 -0
- acprof/cli/plot.py +211 -0
- acprof/cli/posthoc.py +113 -0
- acprof/cli/probe.py +186 -0
- acprof/cli/report.py +35 -0
- acprof/cli/results.py +37 -0
- acprof/cli/run.py +54 -0
- acprof/cli/stats.py +94 -0
- acprof/cli/tui.py +65 -0
- acprof/config.py +177 -0
- acprof/container/__init__.py +1 -0
- acprof/container/compat/__init__.py +1 -0
- acprof/container/compat/transformers_dynamic.py +54 -0
- acprof/container/compat/transformers_model_types.json +1091 -0
- acprof/container/compute_profile_runner.py +392 -0
- acprof/container/download_model.py +165 -0
- acprof/container/execution.py +73 -0
- acprof/container/handlers/__init__.py +298 -0
- acprof/container/handlers/audio.py +743 -0
- acprof/container/handlers/custom_pipeline.py +74 -0
- acprof/container/handlers/cv.py +321 -0
- acprof/container/handlers/diffusion.py +728 -0
- acprof/container/handlers/moss.py +64 -0
- acprof/container/handlers/multimodal.py +609 -0
- acprof/container/handlers/nlp.py +747 -0
- acprof/container/handlers/onnx_tasks.py +231 -0
- acprof/container/handlers/onnxruntime.py +90 -0
- acprof/container/handlers/structured.py +185 -0
- acprof/container/handlers/timeseries.py +178 -0
- acprof/container/load_policy.py +81 -0
- acprof/container/loading_quality.py +48 -0
- acprof/container/local_pipeline.py +31 -0
- acprof/container/model_files.py +280 -0
- acprof/container/model_probe.py +80 -0
- acprof/container/onnx_session.py +150 -0
- acprof/container/runtime_manifest.py +150 -0
- acprof/container/runtime_validate.py +156 -0
- acprof/container/server.py +209 -0
- acprof/container/torch_execution.py +55 -0
- acprof/container/validation.py +172 -0
- acprof/cpu_affinity.py +35 -0
- acprof/dependency_locks.py +129 -0
- acprof/experiment.py +356 -0
- acprof/extensions/__init__.py +294 -0
- acprof/extensions/builtin/manifest.json +3591 -0
- acprof/extensions/onnxruntime/manifest.json +191 -0
- acprof/extensions/schema.py +238 -0
- acprof/extensions/transformers/4.57.6.json +1639 -0
- acprof/extensions/transformers/5.10.4.json +1812 -0
- acprof/failures.py +115 -0
- acprof/hardware_conditions.py +18 -0
- acprof/hf_download.py +143 -0
- acprof/hf_endpoints.py +62 -0
- acprof/hf_transport.py +238 -0
- acprof/host/__init__.py +1 -0
- acprof/host/automation.py +161 -0
- acprof/host/client.py +520 -0
- acprof/host/collection_history.py +77 -0
- acprof/host/collection_workflow.py +285 -0
- acprof/host/command.py +119 -0
- acprof/host/container_lifecycle.py +225 -0
- acprof/host/container_state.py +128 -0
- acprof/host/coverage_state.py +259 -0
- acprof/host/detect.py +669 -0
- acprof/host/docker_runtime.py +359 -0
- acprof/host/doctor.py +158 -0
- acprof/host/env_utils.py +233 -0
- acprof/host/execution_conditions.py +87 -0
- acprof/host/gpu_device.py +66 -0
- acprof/host/hardware_conditions.py +130 -0
- acprof/host/images/__init__.py +1 -0
- acprof/host/images/dependencies.py +169 -0
- acprof/host/images/environment.py +313 -0
- acprof/host/images/graph.py +143 -0
- acprof/host/images/identity.py +6 -0
- acprof/host/images/inventory.py +445 -0
- acprof/host/images/runtime.py +457 -0
- acprof/host/images/scan.py +154 -0
- acprof/host/input_plan.py +1056 -0
- acprof/host/interface_probe.py +141 -0
- acprof/host/largest_scale_probe.py +566 -0
- acprof/host/matrix_plan.py +98 -0
- acprof/host/measurement/__init__.py +1 -0
- acprof/host/measurement/boundary.py +162 -0
- acprof/host/measurement/capture.py +139 -0
- acprof/host/measurement/checkpoint.py +275 -0
- acprof/host/measurement/config.py +212 -0
- acprof/host/measurement/diagnostics.py +247 -0
- acprof/host/measurement/energy_validation.py +172 -0
- acprof/host/measurement/errors.py +25 -0
- acprof/host/measurement/execution.py +396 -0
- acprof/host/measurement/load.py +237 -0
- acprof/host/measurement/metrics.py +975 -0
- acprof/host/measurement/monitors.py +143 -0
- acprof/host/measurement/publication.py +171 -0
- acprof/host/measurement/requests.py +97 -0
- acprof/host/measurement/types.py +82 -0
- acprof/host/model_coverage.py +337 -0
- acprof/host/model_errors.py +116 -0
- acprof/host/model_inspection.py +107 -0
- acprof/host/model_schema.py +35 -0
- acprof/host/model_store.py +733 -0
- acprof/host/network_preflight.py +229 -0
- acprof/host/orchestrator.py +1133 -0
- acprof/host/permissions.py +117 -0
- acprof/host/platform_metadata.py +63 -0
- acprof/host/posthoc/__init__.py +12 -0
- acprof/host/posthoc/backfill.py +415 -0
- acprof/host/posthoc/context.py +400 -0
- acprof/host/posthoc/plans.py +597 -0
- acprof/host/posthoc/service.py +303 -0
- acprof/host/posthoc/storage.py +491 -0
- acprof/host/preflight.py +370 -0
- acprof/host/profiling/__init__.py +1 -0
- acprof/host/profiling/compute.py +436 -0
- acprof/host/profiling/compute_plan.py +261 -0
- acprof/host/profiling/execution.py +547 -0
- acprof/host/profiling/execution_plan.py +576 -0
- acprof/host/profiling/progress.py +83 -0
- acprof/host/profiling/support.py +252 -0
- acprof/host/profiling/tools/__init__.py +1 -0
- acprof/host/profiling/tools/advisor.py +164 -0
- acprof/host/profiling/tools/compute_parsers.py +409 -0
- acprof/host/profiling/tools/execution_environment.py +135 -0
- acprof/host/profiling/tools/execution_parsers.py +364 -0
- acprof/host/profiling/tools/massif.py +418 -0
- acprof/host/profiling/tools/ncu.py +696 -0
- acprof/host/profiling/tools/nsys.py +326 -0
- acprof/host/profiling/tools/tool_discovery.py +229 -0
- acprof/host/profiling/tools/torch.py +158 -0
- acprof/host/result_cleanup.py +65 -0
- acprof/host/run_state.py +639 -0
- acprof/host/runtime_settings.py +10 -0
- acprof/host/runtime_validation.py +302 -0
- acprof/host/source_bundle.py +96 -0
- acprof/host/startup_probe.py +95 -0
- acprof/host/static_metadata.py +936 -0
- acprof/host/task_support.py +121 -0
- acprof/installation.py +26 -0
- acprof/latency_slo.py +62 -0
- acprof/messages.py +26 -0
- acprof/metric_registry.py +315 -0
- acprof/model_candidates.py +297 -0
- acprof/model_contract.py +234 -0
- acprof/model_dependencies.py +93 -0
- acprof/model_dependency_domain.py +45 -0
- acprof/model_dependency_eval.py +438 -0
- acprof/model_dependency_flow.py +200 -0
- acprof/model_evidence.py +115 -0
- acprof/model_metadata_analysis.py +156 -0
- acprof/model_repository.py +149 -0
- acprof/model_resolution.py +129 -0
- acprof/model_review.py +155 -0
- acprof/model_source_analysis.py +299 -0
- acprof/model_spec.py +204 -0
- acprof/model_support.py +105 -0
- acprof/model_transforms.py +81 -0
- acprof/monitors/__init__.py +1 -0
- acprof/monitors/common.py +63 -0
- acprof/monitors/energy_cpu.py +651 -0
- acprof/monitors/energy_nvml.py +381 -0
- acprof/monitors/gpu_metrics.py +123 -0
- acprof/monitors/interfaces.py +74 -0
- acprof/monitors/perf_mips.py +617 -0
- acprof/monitors/rapl_topology.py +100 -0
- acprof/monitors/resource_metrics.py +472 -0
- acprof/monitors/resource_readers.py +435 -0
- acprof/monitors/resource_usage.py +450 -0
- acprof/monitors/sampling.py +79 -0
- acprof/network_policy.py +182 -0
- acprof/notifications.py +279 -0
- acprof/packet/__init__.py +1 -0
- acprof/packet/merge_packet_latency.py +369 -0
- acprof/packet/sniff_parse_pcap.py +240 -0
- acprof/pixel_metrics.py +103 -0
- acprof/platform.py +180 -0
- acprof/plotting/__init__.py +1 -0
- acprof/plotting/config.py +487 -0
- acprof/plotting/data.py +236 -0
- acprof/plotting/diagnostics.py +747 -0
- acprof/plotting/latency.py +638 -0
- acprof/plotting/metrics.py +648 -0
- acprof/plotting/plotly-LICENSE.txt +21 -0
- acprof/plotting/report.css +61 -0
- acprof/plotting/report.html +68 -0
- acprof/plotting/report.js +295 -0
- acprof/plotting/report.py +66 -0
- acprof/plotting/styles.py +111 -0
- acprof/plotting/view_model.js +145 -0
- acprof/precision.py +42 -0
- acprof/preparation_events.py +78 -0
- acprof/progress_events.py +105 -0
- acprof/quality.py +153 -0
- acprof/resource_budget.py +29 -0
- acprof/result_csv.py +263 -0
- acprof/result_layers.py +365 -0
- acprof/run_args.py +223 -0
- acprof/run_options.py +225 -0
- acprof/runtime_dependencies.py +195 -0
- acprof/runtime_profiles.py +258 -0
- acprof/runtime_settings.py +72 -0
- acprof/source_identity.py +68 -0
- acprof/telemetry.py +225 -0
- acprof/testing/__init__.py +1 -0
- acprof/testing/evidence.py +117 -0
- acprof/testing/plugin.py +126 -0
- acprof/testing/provenance.py +53 -0
- acprof/testing/sharding.py +14 -0
- acprof/tui/__init__.py +1 -0
- acprof/tui/app.py +934 -0
- acprof/tui/app_contracts.py +43 -0
- acprof/tui/catalog_controller.py +120 -0
- acprof/tui/commands.py +209 -0
- acprof/tui/configuration_controller.py +436 -0
- acprof/tui/diagnostics.py +340 -0
- acprof/tui/downloads.py +56 -0
- acprof/tui/environment.py +248 -0
- acprof/tui/experiment_catalog.py +279 -0
- acprof/tui/experiment_controller.py +132 -0
- acprof/tui/experiment_picker.py +273 -0
- acprof/tui/field_validation.py +62 -0
- acprof/tui/i18n.py +57 -0
- acprof/tui/image_controller.py +525 -0
- acprof/tui/images.py +737 -0
- acprof/tui/input.py +191 -0
- acprof/tui/localization_controller.py +110 -0
- acprof/tui/log.py +310 -0
- acprof/tui/model_candidates.py +278 -0
- acprof/tui/model_controller.py +111 -0
- acprof/tui/model_input.py +12 -0
- acprof/tui/model_store.py +166 -0
- acprof/tui/preflight_controller.py +271 -0
- acprof/tui/preparation.py +269 -0
- acprof/tui/presentation.py +46 -0
- acprof/tui/process.py +111 -0
- acprof/tui/process_controller.py +218 -0
- acprof/tui/profile_controller.py +109 -0
- acprof/tui/progress.py +195 -0
- acprof/tui/recovery.py +114 -0
- acprof/tui/recovery_controller.py +169 -0
- acprof/tui/rendering.py +75 -0
- acprof/tui/reports.py +303 -0
- acprof/tui/result_controller.py +279 -0
- acprof/tui/review_inputs.py +54 -0
- acprof/tui/run_form.py +125 -0
- acprof/tui/run_planning.py +97 -0
- acprof/tui/run_results.py +175 -0
- acprof/tui/scrollbar.py +65 -0
- acprof/tui/settings.py +203 -0
- acprof/tui/slash_controller.py +95 -0
- acprof/tui/stages.py +97 -0
- acprof/tui/storage.py +150 -0
- acprof/tui/table.py +213 -0
- acprof/tui/themes.py +112 -0
- acprof/tui/translation_catalog.py +1861 -0
- acprof/tui/tui.tcss +373 -0
- acprof/tui/views.py +706 -0
- acprof/window_records.py +165 -0
- acprof/workloads/__init__.py +222 -0
- acprof/workloads/audio.py +621 -0
- acprof/workloads/contract.py +116 -0
- acprof/workloads/cv.py +240 -0
- acprof/workloads/diffusion.py +410 -0
- acprof/workloads/multimodal.py +329 -0
- acprof/workloads/nlp.py +151 -0
- acprof/workloads/structured.py +151 -0
- acprof/workloads/timeseries.py +69 -0
- acprof-0.3.0.dist-info/METADATA +117 -0
- acprof-0.3.0.dist-info/RECORD +704 -0
- acprof-0.3.0.dist-info/WHEEL +4 -0
- acprof-0.3.0.dist-info/entry_points.txt +2 -0
- acprof-0.3.0.dist-info/licenses/LICENSE +202 -0
- acprof-0.3.0.dist-info/licenses/NOTICE +43 -0
- acprof-0.3.0.dist-info/licenses/licenses/CC-BY-4.0.txt +156 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
"""延迟模型报告和残差 CSV 产物写出。"""
|
|
2
|
+
|
|
3
|
+
import csv
|
|
4
|
+
import json
|
|
5
|
+
import math
|
|
6
|
+
import os
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
import pandas as pd
|
|
12
|
+
|
|
13
|
+
from acprof.analysis.latency_model import (
|
|
14
|
+
LATENCY_MODEL_FEATURES,
|
|
15
|
+
LATENCY_MODEL_FORMULAS,
|
|
16
|
+
LATENCY_MODEL_GPU_UPPER_TAIL_ACTIVATION_MAPE,
|
|
17
|
+
LATENCY_MODEL_GPU_UPPER_TAIL_MIN_SCALE_SPAN_RATIO,
|
|
18
|
+
LATENCY_MODEL_MAX_CONFIGURATION_FOLD_MAPE,
|
|
19
|
+
LATENCY_MODEL_MAX_CONFIGURATION_FOLD_RELATIVE_MAE,
|
|
20
|
+
LATENCY_MODEL_MAX_VALIDATION_CASE_RELATIVE_ERROR,
|
|
21
|
+
LATENCY_MODEL_MAX_VALIDATION_MAPE,
|
|
22
|
+
LATENCY_MODEL_MAX_VALIDATION_RELATIVE_MAE,
|
|
23
|
+
LATENCY_MODEL_MIN_VALIDATION_POINTS,
|
|
24
|
+
LATENCY_MODEL_MIN_VALIDATION_R2,
|
|
25
|
+
_aggregate_latency_model_points,
|
|
26
|
+
_fit_log_latency_model,
|
|
27
|
+
_input_scale_validation,
|
|
28
|
+
_latency_model_frame,
|
|
29
|
+
_point_key,
|
|
30
|
+
_predict_latency,
|
|
31
|
+
_regression_metrics,
|
|
32
|
+
_resource_configuration_validation,
|
|
33
|
+
_training_range,
|
|
34
|
+
_validation_is_evaluable,
|
|
35
|
+
_validation_quality_failures,
|
|
36
|
+
)
|
|
37
|
+
from acprof.artifacts import atomic_write
|
|
38
|
+
from acprof.platform import recorded_identity
|
|
39
|
+
|
|
40
|
+
LATENCY_MODEL_DIR = "latency_model"
|
|
41
|
+
LATENCY_MODEL_REPORT = "latency_model_report.json"
|
|
42
|
+
LATENCY_MODEL_RESIDUALS = "latency_model_residuals.csv"
|
|
43
|
+
LATENCY_MODEL_RESIDUAL_FIELDS = [
|
|
44
|
+
"report_schema_version",
|
|
45
|
+
"environment_class",
|
|
46
|
+
"case_id",
|
|
47
|
+
"split",
|
|
48
|
+
"hardware_model",
|
|
49
|
+
"cpu_cores",
|
|
50
|
+
"mem_cap_gb",
|
|
51
|
+
"gpu_mode",
|
|
52
|
+
"input_scale",
|
|
53
|
+
"repeat_count",
|
|
54
|
+
"latency_s",
|
|
55
|
+
"latency_mean_s",
|
|
56
|
+
"latency_std_s",
|
|
57
|
+
"fitted_predicted_latency_s",
|
|
58
|
+
"fitted_residual_s",
|
|
59
|
+
"resource_config_oof_predicted_latency_s",
|
|
60
|
+
"resource_config_oof_residual_s",
|
|
61
|
+
"max_scale_holdout_predicted_latency_s",
|
|
62
|
+
"max_scale_holdout_residual_s",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _clean_json_value(value):
|
|
67
|
+
if isinstance(value, np.generic):
|
|
68
|
+
value = value.item()
|
|
69
|
+
if isinstance(value, float):
|
|
70
|
+
if not math.isfinite(value):
|
|
71
|
+
return None
|
|
72
|
+
return value
|
|
73
|
+
if isinstance(value, dict):
|
|
74
|
+
return {key: _clean_json_value(item) for key, item in value.items()}
|
|
75
|
+
if isinstance(value, (list, tuple)):
|
|
76
|
+
return [_clean_json_value(item) for item in value]
|
|
77
|
+
return value
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _format_optional_float(value: float | None) -> str:
|
|
81
|
+
if value is None or not math.isfinite(float(value)):
|
|
82
|
+
return ""
|
|
83
|
+
return f"{float(value):.9f}"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass(frozen=True)
|
|
87
|
+
class LatencyModelReport:
|
|
88
|
+
"""Calculated report and formatted residual rows, without filesystem ownership."""
|
|
89
|
+
|
|
90
|
+
report: dict[str, Any]
|
|
91
|
+
residuals: tuple[dict[str, object], ...]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _skipped_latency_model_report(static_meta: dict[str, object], reason: str) -> LatencyModelReport:
|
|
95
|
+
report = {
|
|
96
|
+
"report_schema_version": 2,
|
|
97
|
+
**recorded_identity(static_meta),
|
|
98
|
+
"status": "skipped",
|
|
99
|
+
"prediction_ready": False,
|
|
100
|
+
"reason": reason,
|
|
101
|
+
"target_metric": "latency_s",
|
|
102
|
+
"model_name": static_meta.get("model_name", ""),
|
|
103
|
+
"task_family": static_meta.get("task_family", ""),
|
|
104
|
+
"residuals_csv": LATENCY_MODEL_RESIDUALS,
|
|
105
|
+
"residuals_granularity": "header only because model generation was skipped",
|
|
106
|
+
}
|
|
107
|
+
return LatencyModelReport(report, ())
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _input_scale_basis(hardware_model: str, fitted_model: dict) -> dict:
|
|
111
|
+
if hardware_model == "gpu":
|
|
112
|
+
upper_tail_model = fitted_model.get("gpu_upper_tail", {})
|
|
113
|
+
upper_tail_feature_names = upper_tail_model.get(
|
|
114
|
+
"feature_names",
|
|
115
|
+
[],
|
|
116
|
+
)
|
|
117
|
+
upper_tail_coefficients = upper_tail_model.get(
|
|
118
|
+
"coefficients",
|
|
119
|
+
[],
|
|
120
|
+
)
|
|
121
|
+
upper_tail_report = {
|
|
122
|
+
"type": "continuous_affine_latency_tail",
|
|
123
|
+
"enabled": bool(upper_tail_model.get("enabled")),
|
|
124
|
+
"activation_rule": (
|
|
125
|
+
"enable when nested one-step-forward spline MAPE exceeds "
|
|
126
|
+
f"{LATENCY_MODEL_GPU_UPPER_TAIL_ACTIVATION_MAPE}, the "
|
|
127
|
+
"training scale span is at least "
|
|
128
|
+
f"{LATENCY_MODEL_GPU_UPPER_TAIL_MIN_SCALE_SPAN_RATIO}x, "
|
|
129
|
+
"and all fitted training-configuration slopes are positive"
|
|
130
|
+
),
|
|
131
|
+
"continuity_rule": (
|
|
132
|
+
"spline prediction at the upper training boundary plus "
|
|
133
|
+
"the affine tail's change beyond that boundary"
|
|
134
|
+
),
|
|
135
|
+
"feature_columns": upper_tail_feature_names,
|
|
136
|
+
"selected_feature_columns": upper_tail_model.get(
|
|
137
|
+
"selected_feature_names",
|
|
138
|
+
[],
|
|
139
|
+
),
|
|
140
|
+
"dropped_feature_columns": upper_tail_model.get(
|
|
141
|
+
"dropped_feature_names",
|
|
142
|
+
[],
|
|
143
|
+
),
|
|
144
|
+
"coefficients": dict(zip(
|
|
145
|
+
upper_tail_feature_names,
|
|
146
|
+
upper_tail_coefficients,
|
|
147
|
+
strict=True,
|
|
148
|
+
)),
|
|
149
|
+
"minimum_fitted_slope_s_per_scale": upper_tail_model.get(
|
|
150
|
+
"minimum_fitted_slope_s_per_scale"
|
|
151
|
+
),
|
|
152
|
+
"training_input_scale_span_ratio": upper_tail_model.get(
|
|
153
|
+
"training_input_scale_span_ratio"
|
|
154
|
+
),
|
|
155
|
+
"calibration": upper_tail_model.get("calibration", {}),
|
|
156
|
+
}
|
|
157
|
+
if upper_tail_model.get("reason"):
|
|
158
|
+
upper_tail_report["reason"] = upper_tail_model["reason"]
|
|
159
|
+
input_scale_basis = {
|
|
160
|
+
"type": "continuous_piecewise_linear_spline_in_log_space",
|
|
161
|
+
"knots": fitted_model["input_scale_spline_knots"],
|
|
162
|
+
"knot_rule": "all interior observed training input scales",
|
|
163
|
+
"interpolation": (
|
|
164
|
+
"piecewise linear in log(input_scale) and log(latency_s)"
|
|
165
|
+
),
|
|
166
|
+
"lower_extrapolation": (
|
|
167
|
+
"continue the nearest boundary segment in log-log space"
|
|
168
|
+
),
|
|
169
|
+
"upper_extrapolation": upper_tail_report,
|
|
170
|
+
}
|
|
171
|
+
else:
|
|
172
|
+
input_scale_basis = {
|
|
173
|
+
"type": "quadratic_response_surface_in_log_space",
|
|
174
|
+
"knots": [],
|
|
175
|
+
"interactions": [
|
|
176
|
+
"log_input_scale_x_log_cpu_cores",
|
|
177
|
+
"log_input_scale_x_log_mem_cap_gb",
|
|
178
|
+
"log_cpu_cores_x_log_mem_cap_gb",
|
|
179
|
+
],
|
|
180
|
+
}
|
|
181
|
+
return input_scale_basis
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _fit_hardware_reports(points: list) -> tuple[dict, dict, dict, dict, list[str]]:
|
|
185
|
+
model_reports = {}
|
|
186
|
+
fit_predictions: dict[tuple[str, float, float, float], float] = {}
|
|
187
|
+
configuration_predictions: dict[
|
|
188
|
+
tuple[str, float, float, float],
|
|
189
|
+
float,
|
|
190
|
+
] = {}
|
|
191
|
+
scale_predictions: dict[tuple[str, float, float, float], float] = {}
|
|
192
|
+
top_level_failures = []
|
|
193
|
+
|
|
194
|
+
for hardware_model in ("cpu", "gpu"):
|
|
195
|
+
hardware_rows = [
|
|
196
|
+
row for row in points if str(row.hardware_model) == hardware_model
|
|
197
|
+
]
|
|
198
|
+
if not hardware_rows:
|
|
199
|
+
continue
|
|
200
|
+
|
|
201
|
+
try:
|
|
202
|
+
fitted_model = _fit_log_latency_model(hardware_rows, hardware_model)
|
|
203
|
+
except ValueError as exc:
|
|
204
|
+
reason = str(exc)
|
|
205
|
+
model_reports[hardware_model] = {
|
|
206
|
+
"status": "skipped",
|
|
207
|
+
"prediction_ready": False,
|
|
208
|
+
"reason": reason,
|
|
209
|
+
"raw_rows": sum(int(row.repeat_count) for row in hardware_rows),
|
|
210
|
+
"case_rows": len(hardware_rows),
|
|
211
|
+
}
|
|
212
|
+
top_level_failures.append(f"{hardware_model}: fit failed: {reason}")
|
|
213
|
+
continue
|
|
214
|
+
|
|
215
|
+
hardware_fit_predictions = {
|
|
216
|
+
_point_key(row): _predict_latency(row, fitted_model)
|
|
217
|
+
for row in hardware_rows
|
|
218
|
+
}
|
|
219
|
+
fit_predictions.update(hardware_fit_predictions)
|
|
220
|
+
fit_metrics = _regression_metrics(
|
|
221
|
+
[float(row.latency_s) for row in hardware_rows],
|
|
222
|
+
[hardware_fit_predictions[_point_key(row)] for row in hardware_rows],
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
configuration_validation, hardware_configuration_predictions = (
|
|
226
|
+
_resource_configuration_validation(hardware_rows, hardware_model)
|
|
227
|
+
)
|
|
228
|
+
input_scale_validation, hardware_scale_predictions = (
|
|
229
|
+
_input_scale_validation(hardware_rows, hardware_model)
|
|
230
|
+
)
|
|
231
|
+
configuration_predictions.update(hardware_configuration_predictions)
|
|
232
|
+
scale_predictions.update(hardware_scale_predictions)
|
|
233
|
+
|
|
234
|
+
quality_failures = []
|
|
235
|
+
quality_failures.extend(_validation_quality_failures(
|
|
236
|
+
"resource_configuration_holdout",
|
|
237
|
+
configuration_validation,
|
|
238
|
+
))
|
|
239
|
+
quality_failures.extend(_validation_quality_failures(
|
|
240
|
+
"input_scale_holdout",
|
|
241
|
+
input_scale_validation,
|
|
242
|
+
))
|
|
243
|
+
if int(fit_metrics["nonfinite_prediction_count"] or 0) > 0:
|
|
244
|
+
quality_failures.append("full fit contains non-finite predictions")
|
|
245
|
+
if int(fit_metrics["nonpositive_prediction_count"] or 0) > 0:
|
|
246
|
+
quality_failures.append("full fit contains non-positive predictions")
|
|
247
|
+
|
|
248
|
+
validation_evaluable = bool(
|
|
249
|
+
_validation_is_evaluable(configuration_validation)
|
|
250
|
+
and _validation_is_evaluable(input_scale_validation)
|
|
251
|
+
)
|
|
252
|
+
if quality_failures:
|
|
253
|
+
model_status = "poor_fit" if validation_evaluable else "unvalidated"
|
|
254
|
+
else:
|
|
255
|
+
model_status = "ok"
|
|
256
|
+
|
|
257
|
+
coefficients = {
|
|
258
|
+
name: value
|
|
259
|
+
for name, value in zip(
|
|
260
|
+
fitted_model["feature_names"],
|
|
261
|
+
fitted_model["coefficients"],
|
|
262
|
+
strict=True,
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
input_scale_basis = _input_scale_basis(hardware_model, fitted_model)
|
|
266
|
+
model_reports[hardware_model] = {
|
|
267
|
+
"status": model_status,
|
|
268
|
+
"prediction_ready": model_status == "ok",
|
|
269
|
+
"formula": LATENCY_MODEL_FORMULAS[hardware_model],
|
|
270
|
+
"feature_columns": fitted_model["feature_names"],
|
|
271
|
+
"selected_feature_columns": fitted_model["selected_feature_names"],
|
|
272
|
+
"dropped_feature_columns": fitted_model["dropped_feature_names"],
|
|
273
|
+
"coefficients": coefficients,
|
|
274
|
+
"input_scale_basis": input_scale_basis,
|
|
275
|
+
"prediction_estimand": (
|
|
276
|
+
"positive latency prediction for the median-aggregated case"
|
|
277
|
+
),
|
|
278
|
+
"smearing_correction_applied": False,
|
|
279
|
+
"raw_rows": sum(int(row.repeat_count) for row in hardware_rows),
|
|
280
|
+
"case_rows": len(hardware_rows),
|
|
281
|
+
"training_range": _training_range(hardware_rows),
|
|
282
|
+
"numerical_diagnostics": {
|
|
283
|
+
"solver": "numpy.linalg.lstsq",
|
|
284
|
+
"standardized_before_solve": True,
|
|
285
|
+
"rank": fitted_model["rank"],
|
|
286
|
+
"condition_number": fitted_model["condition_number"],
|
|
287
|
+
**(
|
|
288
|
+
{
|
|
289
|
+
"upper_tail_rank": fitted_model.get(
|
|
290
|
+
"gpu_upper_tail",
|
|
291
|
+
{},
|
|
292
|
+
).get("rank"),
|
|
293
|
+
"upper_tail_condition_number": fitted_model.get(
|
|
294
|
+
"gpu_upper_tail",
|
|
295
|
+
{},
|
|
296
|
+
).get("condition_number"),
|
|
297
|
+
}
|
|
298
|
+
if hardware_model == "gpu"
|
|
299
|
+
else {}
|
|
300
|
+
),
|
|
301
|
+
},
|
|
302
|
+
"metrics": {
|
|
303
|
+
"fit": fit_metrics,
|
|
304
|
+
"resource_configuration_holdout": configuration_validation["metrics"],
|
|
305
|
+
"input_scale_holdout": input_scale_validation["metrics"],
|
|
306
|
+
},
|
|
307
|
+
"validation": {
|
|
308
|
+
"resource_configuration_holdout": configuration_validation,
|
|
309
|
+
"input_scale_holdout": input_scale_validation,
|
|
310
|
+
},
|
|
311
|
+
"quality_gate": {
|
|
312
|
+
"passed": not quality_failures,
|
|
313
|
+
"failures": quality_failures,
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
top_level_failures.extend(
|
|
317
|
+
f"{hardware_model}: {failure}" for failure in quality_failures
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
return model_reports, fit_predictions, configuration_predictions, scale_predictions, top_level_failures
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def _residual_rows(points: list, environment_class: str, fit_predictions: dict,
|
|
324
|
+
configuration_predictions: dict, scale_predictions: dict) -> tuple[dict[str, object], ...]:
|
|
325
|
+
rows: list[dict[str, object]] = []
|
|
326
|
+
for case_id, row in enumerate(points):
|
|
327
|
+
key = _point_key(row)
|
|
328
|
+
actual = float(row.latency_s)
|
|
329
|
+
fitted_prediction = fit_predictions.get(key)
|
|
330
|
+
configuration_prediction = configuration_predictions.get(key)
|
|
331
|
+
scale_prediction = scale_predictions.get(key)
|
|
332
|
+
rows.append({
|
|
333
|
+
"report_schema_version": 2,
|
|
334
|
+
"environment_class": environment_class,
|
|
335
|
+
"case_id": case_id,
|
|
336
|
+
"split": (
|
|
337
|
+
"out_of_fold_test"
|
|
338
|
+
if configuration_prediction is not None
|
|
339
|
+
else "validation_unavailable"
|
|
340
|
+
),
|
|
341
|
+
"hardware_model": row.hardware_model,
|
|
342
|
+
"cpu_cores": int(row.cpu_cores),
|
|
343
|
+
"mem_cap_gb": int(row.mem_cap_gb),
|
|
344
|
+
"gpu_mode": "on" if row.hardware_model == "gpu" else "off",
|
|
345
|
+
"input_scale": f"{float(row.input_scale):.6f}",
|
|
346
|
+
"repeat_count": int(row.repeat_count),
|
|
347
|
+
"latency_s": f"{actual:.9f}",
|
|
348
|
+
"latency_mean_s": f"{float(row.latency_mean_s):.9f}",
|
|
349
|
+
"latency_std_s": f"{float(row.latency_std_s):.9f}",
|
|
350
|
+
"fitted_predicted_latency_s": _format_optional_float(
|
|
351
|
+
fitted_prediction
|
|
352
|
+
),
|
|
353
|
+
"fitted_residual_s": _format_optional_float(
|
|
354
|
+
None
|
|
355
|
+
if fitted_prediction is None
|
|
356
|
+
else actual - fitted_prediction
|
|
357
|
+
),
|
|
358
|
+
"resource_config_oof_predicted_latency_s": _format_optional_float(
|
|
359
|
+
configuration_prediction
|
|
360
|
+
),
|
|
361
|
+
"resource_config_oof_residual_s": _format_optional_float(
|
|
362
|
+
None
|
|
363
|
+
if configuration_prediction is None
|
|
364
|
+
else actual - configuration_prediction
|
|
365
|
+
),
|
|
366
|
+
"max_scale_holdout_predicted_latency_s": _format_optional_float(
|
|
367
|
+
scale_prediction
|
|
368
|
+
),
|
|
369
|
+
"max_scale_holdout_residual_s": _format_optional_float(
|
|
370
|
+
None if scale_prediction is None else actual - scale_prediction
|
|
371
|
+
),
|
|
372
|
+
})
|
|
373
|
+
|
|
374
|
+
return tuple(rows)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def build_latency_model_report(
|
|
378
|
+
df: pd.DataFrame,
|
|
379
|
+
static_meta: dict[str, object],
|
|
380
|
+
) -> LatencyModelReport:
|
|
381
|
+
"""Fit and validate models without creating directories or publishing artifacts."""
|
|
382
|
+
identity = recorded_identity(static_meta)
|
|
383
|
+
if "environment_class" in df:
|
|
384
|
+
environments = set(df["environment_class"].fillna("unknown"))
|
|
385
|
+
if len(environments) > 1 or not environments <= {"unknown", identity["environment_class"]}:
|
|
386
|
+
raise ValueError("cannot fit a latency model from mixed or inconsistent environments")
|
|
387
|
+
|
|
388
|
+
if "latency_s" not in df.columns:
|
|
389
|
+
return _skipped_latency_model_report(
|
|
390
|
+
static_meta,
|
|
391
|
+
"latency_s column missing",
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
try:
|
|
395
|
+
model_df = _latency_model_frame(df)
|
|
396
|
+
except ValueError as exc:
|
|
397
|
+
return _skipped_latency_model_report(
|
|
398
|
+
static_meta,
|
|
399
|
+
str(exc),
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
if len(model_df) < 3:
|
|
403
|
+
return _skipped_latency_model_report(
|
|
404
|
+
static_meta,
|
|
405
|
+
f"need at least 3 valid raw rows, got {len(model_df)}",
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
points = _aggregate_latency_model_points(model_df)
|
|
409
|
+
if len(points) < 3:
|
|
410
|
+
return _skipped_latency_model_report(
|
|
411
|
+
static_meta,
|
|
412
|
+
f"need at least 3 unique configuration-scale cases, got {len(points)}",
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
(model_reports, fit_predictions, configuration_predictions,
|
|
416
|
+
scale_predictions, top_level_failures) = _fit_hardware_reports(points)
|
|
417
|
+
|
|
418
|
+
if not fit_predictions:
|
|
419
|
+
status = "skipped"
|
|
420
|
+
elif any(
|
|
421
|
+
model_report.get("status") == "poor_fit"
|
|
422
|
+
for model_report in model_reports.values()
|
|
423
|
+
):
|
|
424
|
+
status = "poor_fit"
|
|
425
|
+
elif any(
|
|
426
|
+
model_report.get("status") != "ok"
|
|
427
|
+
for model_report in model_reports.values()
|
|
428
|
+
):
|
|
429
|
+
status = "unvalidated"
|
|
430
|
+
else:
|
|
431
|
+
status = "ok"
|
|
432
|
+
|
|
433
|
+
def metrics_for_predictions(predictions: dict) -> dict:
|
|
434
|
+
predicted_rows = [row for row in points if _point_key(row) in predictions]
|
|
435
|
+
return _regression_metrics(
|
|
436
|
+
[float(row.latency_s) for row in predicted_rows],
|
|
437
|
+
[predictions[_point_key(row)] for row in predicted_rows],
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
residuals = _residual_rows(points, identity["environment_class"], fit_predictions,
|
|
441
|
+
configuration_predictions, scale_predictions)
|
|
442
|
+
|
|
443
|
+
fit_metrics = metrics_for_predictions(fit_predictions)
|
|
444
|
+
configuration_metrics = metrics_for_predictions(configuration_predictions)
|
|
445
|
+
input_scale_metrics = metrics_for_predictions(scale_predictions)
|
|
446
|
+
report = {
|
|
447
|
+
"report_schema_version": 2,
|
|
448
|
+
**identity,
|
|
449
|
+
"status": status,
|
|
450
|
+
"prediction_ready": status == "ok",
|
|
451
|
+
"target_metric": "latency_s",
|
|
452
|
+
"model_name": static_meta.get("model_name", ""),
|
|
453
|
+
"task_family": static_meta.get("task_family", ""),
|
|
454
|
+
"input_scale_type": static_meta.get("input_scale_type", "input_scale"),
|
|
455
|
+
"model_type": (
|
|
456
|
+
"separate_cpu_log_response_surface_gpu_log_spline_affine_tail"
|
|
457
|
+
),
|
|
458
|
+
"positive_prediction_form": True,
|
|
459
|
+
"formula": LATENCY_MODEL_FORMULAS,
|
|
460
|
+
"feature_columns": {
|
|
461
|
+
hardware_model: model_reports.get(hardware_model, {}).get(
|
|
462
|
+
"feature_columns",
|
|
463
|
+
LATENCY_MODEL_FEATURES[hardware_model],
|
|
464
|
+
)
|
|
465
|
+
for hardware_model in ("cpu", "gpu")
|
|
466
|
+
},
|
|
467
|
+
"separation_note": (
|
|
468
|
+
"CPU-off and GPU-on use independent coefficients. Their separate "
|
|
469
|
+
"input-scale/CPU interaction terms are the split-model equivalent "
|
|
470
|
+
"of input_scale x CPU x GPU interactions in one joint model."
|
|
471
|
+
),
|
|
472
|
+
"aggregation": {
|
|
473
|
+
"group_columns": [
|
|
474
|
+
"hardware_model",
|
|
475
|
+
"cpu_cores",
|
|
476
|
+
"mem_cap_gb",
|
|
477
|
+
"input_scale",
|
|
478
|
+
],
|
|
479
|
+
"target_statistic": "median",
|
|
480
|
+
"repetitions_split_across_train_and_test": False,
|
|
481
|
+
},
|
|
482
|
+
"rows": len(model_df),
|
|
483
|
+
"raw_rows": len(model_df),
|
|
484
|
+
"case_rows": len(points),
|
|
485
|
+
"fit_case_rows": len(fit_predictions),
|
|
486
|
+
"resource_configuration_oof_test_case_rows": len(
|
|
487
|
+
configuration_predictions
|
|
488
|
+
),
|
|
489
|
+
"input_scale_holdout_test_case_rows": len(scale_predictions),
|
|
490
|
+
"split_rule": (
|
|
491
|
+
"resource configuration: leave one complete (cpu_cores,mem_cap_gb) "
|
|
492
|
+
"out per fold; input scale: train below maximum and hold out maximum"
|
|
493
|
+
),
|
|
494
|
+
"metrics": {
|
|
495
|
+
"fit": fit_metrics,
|
|
496
|
+
"resource_configuration_holdout": configuration_metrics,
|
|
497
|
+
"input_scale_holdout": input_scale_metrics,
|
|
498
|
+
},
|
|
499
|
+
"models": model_reports,
|
|
500
|
+
"quality_gate": {
|
|
501
|
+
"passed": status == "ok",
|
|
502
|
+
"thresholds": {
|
|
503
|
+
"minimum_resource_configuration_validation_r2": (
|
|
504
|
+
LATENCY_MODEL_MIN_VALIDATION_R2
|
|
505
|
+
),
|
|
506
|
+
"r2_quality_gate_scope": (
|
|
507
|
+
"resource_configuration_holdout only"
|
|
508
|
+
),
|
|
509
|
+
"maximum_validation_relative_mae": (
|
|
510
|
+
LATENCY_MODEL_MAX_VALIDATION_RELATIVE_MAE
|
|
511
|
+
),
|
|
512
|
+
"maximum_validation_mean_absolute_percentage_error": (
|
|
513
|
+
LATENCY_MODEL_MAX_VALIDATION_MAPE
|
|
514
|
+
),
|
|
515
|
+
"maximum_single_configuration_fold_relative_mae": (
|
|
516
|
+
LATENCY_MODEL_MAX_CONFIGURATION_FOLD_RELATIVE_MAE
|
|
517
|
+
),
|
|
518
|
+
"maximum_single_configuration_fold_mean_absolute_percentage_error": (
|
|
519
|
+
LATENCY_MODEL_MAX_CONFIGURATION_FOLD_MAPE
|
|
520
|
+
),
|
|
521
|
+
"maximum_single_validation_case_relative_error": (
|
|
522
|
+
LATENCY_MODEL_MAX_VALIDATION_CASE_RELATIVE_ERROR
|
|
523
|
+
),
|
|
524
|
+
"maximum_single_scale_holdout_case_relative_error": (
|
|
525
|
+
LATENCY_MODEL_MAX_VALIDATION_CASE_RELATIVE_ERROR
|
|
526
|
+
),
|
|
527
|
+
"minimum_validation_predictions": (
|
|
528
|
+
LATENCY_MODEL_MIN_VALIDATION_POINTS
|
|
529
|
+
),
|
|
530
|
+
"require_finite_positive_predictions": True,
|
|
531
|
+
},
|
|
532
|
+
"failures": top_level_failures,
|
|
533
|
+
},
|
|
534
|
+
"prediction_scope": {
|
|
535
|
+
"supported": (
|
|
536
|
+
"interpolation within each hardware model's training_range; "
|
|
537
|
+
"GPU input-scale interpolation uses a continuous log-log spline; "
|
|
538
|
+
"GPU upper extrapolation can use a calibrated continuous affine "
|
|
539
|
+
"latency tail; the maximum observed input scale is separately "
|
|
540
|
+
"forward-validated"
|
|
541
|
+
),
|
|
542
|
+
"warning": (
|
|
543
|
+
"Predictions outside profiled CPU, memory, or input-scale ranges "
|
|
544
|
+
"are unvalidated extrapolations."
|
|
545
|
+
),
|
|
546
|
+
},
|
|
547
|
+
"residuals_csv": LATENCY_MODEL_RESIDUALS,
|
|
548
|
+
"residuals_granularity": (
|
|
549
|
+
"one median-aggregated hardware/cpu/memory/input-scale case per row"
|
|
550
|
+
),
|
|
551
|
+
}
|
|
552
|
+
return LatencyModelReport(_clean_json_value(report), residuals)
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
def write_latency_model_report(df: pd.DataFrame, static_meta: dict[str, object], output_dir: str) -> None:
|
|
556
|
+
"""Publish the existing JSON/CSV protocol after all calculation has completed."""
|
|
557
|
+
result = build_latency_model_report(df, static_meta)
|
|
558
|
+
model_output_dir = os.path.join(output_dir, LATENCY_MODEL_DIR)
|
|
559
|
+
os.makedirs(model_output_dir, exist_ok=True)
|
|
560
|
+
residuals_path = os.path.join(model_output_dir, LATENCY_MODEL_RESIDUALS)
|
|
561
|
+
# A skipped calculation still replaces stale residuals with a header-only CSV.
|
|
562
|
+
def write_residuals(stream) -> None:
|
|
563
|
+
writer = csv.DictWriter(stream, fieldnames=LATENCY_MODEL_RESIDUAL_FIELDS)
|
|
564
|
+
writer.writeheader()
|
|
565
|
+
writer.writerows(result.residuals)
|
|
566
|
+
|
|
567
|
+
atomic_write(residuals_path, write_residuals)
|
|
568
|
+
report_path = os.path.join(model_output_dir, LATENCY_MODEL_REPORT)
|
|
569
|
+
|
|
570
|
+
def write_report(stream) -> None:
|
|
571
|
+
json.dump(result.report, stream, ensure_ascii=True, indent=2)
|
|
572
|
+
stream.write("\n")
|
|
573
|
+
|
|
574
|
+
atomic_write(report_path, write_report)
|
|
575
|
+
print(f"[saved] {report_path}")
|
|
576
|
+
if result.residuals:
|
|
577
|
+
print(f"[saved] {residuals_path}")
|