wandb 0.21.2__py3-none-macosx_12_0_arm64.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.
- package_readme.md +97 -0
- wandb/__init__.py +248 -0
- wandb/__init__.pyi +1230 -0
- wandb/__main__.py +3 -0
- wandb/_iterutils.py +65 -0
- wandb/_pydantic/__init__.py +30 -0
- wandb/_pydantic/base.py +128 -0
- wandb/_pydantic/utils.py +80 -0
- wandb/_pydantic/v1_compat.py +284 -0
- wandb/agents/__init__.py +0 -0
- wandb/agents/pyagent.py +386 -0
- wandb/analytics/__init__.py +3 -0
- wandb/analytics/sentry.py +267 -0
- wandb/apis/__init__.py +48 -0
- wandb/apis/attrs.py +50 -0
- wandb/apis/importers/__init__.py +1 -0
- wandb/apis/importers/internals/internal.py +382 -0
- wandb/apis/importers/internals/protocols.py +103 -0
- wandb/apis/importers/internals/util.py +78 -0
- wandb/apis/importers/mlflow.py +254 -0
- wandb/apis/importers/validation.py +108 -0
- wandb/apis/importers/wandb.py +1608 -0
- wandb/apis/internal.py +239 -0
- wandb/apis/normalize.py +81 -0
- wandb/apis/paginator.py +138 -0
- wandb/apis/public/__init__.py +35 -0
- wandb/apis/public/api.py +2449 -0
- wandb/apis/public/artifacts.py +1046 -0
- wandb/apis/public/automations.py +85 -0
- wandb/apis/public/const.py +4 -0
- wandb/apis/public/files.py +402 -0
- wandb/apis/public/history.py +201 -0
- wandb/apis/public/integrations.py +203 -0
- wandb/apis/public/jobs.py +742 -0
- wandb/apis/public/projects.py +276 -0
- wandb/apis/public/query_generator.py +176 -0
- wandb/apis/public/registries/__init__.py +0 -0
- wandb/apis/public/registries/_freezable_list.py +179 -0
- wandb/apis/public/registries/_utils.py +138 -0
- wandb/apis/public/registries/registries_search.py +347 -0
- wandb/apis/public/registries/registry.py +358 -0
- wandb/apis/public/reports.py +595 -0
- wandb/apis/public/runs.py +1216 -0
- wandb/apis/public/sweeps.py +440 -0
- wandb/apis/public/teams.py +235 -0
- wandb/apis/public/users.py +177 -0
- wandb/apis/public/utils.py +210 -0
- wandb/apis/reports/__init__.py +1 -0
- wandb/apis/reports/v1/__init__.py +8 -0
- wandb/apis/reports/v2/__init__.py +8 -0
- wandb/apis/workspaces/__init__.py +8 -0
- wandb/automations/__init__.py +73 -0
- wandb/automations/_filters/__init__.py +40 -0
- wandb/automations/_filters/expressions.py +181 -0
- wandb/automations/_filters/operators.py +258 -0
- wandb/automations/_filters/run_metrics.py +330 -0
- wandb/automations/_generated/__init__.py +177 -0
- wandb/automations/_generated/create_automation.py +17 -0
- wandb/automations/_generated/create_generic_webhook_integration.py +43 -0
- wandb/automations/_generated/delete_automation.py +15 -0
- wandb/automations/_generated/enums.py +35 -0
- wandb/automations/_generated/fragments.py +358 -0
- wandb/automations/_generated/generic_webhook_integrations_by_entity.py +22 -0
- wandb/automations/_generated/get_automations.py +24 -0
- wandb/automations/_generated/get_automations_by_entity.py +26 -0
- wandb/automations/_generated/input_types.py +104 -0
- wandb/automations/_generated/integrations_by_entity.py +22 -0
- wandb/automations/_generated/operations.py +647 -0
- wandb/automations/_generated/slack_integrations_by_entity.py +22 -0
- wandb/automations/_generated/update_automation.py +17 -0
- wandb/automations/_utils.py +235 -0
- wandb/automations/_validators.py +165 -0
- wandb/automations/actions.py +218 -0
- wandb/automations/automations.py +85 -0
- wandb/automations/events.py +285 -0
- wandb/automations/integrations.py +45 -0
- wandb/automations/scopes.py +78 -0
- wandb/beta/workflows.py +324 -0
- wandb/bin/gpu_stats +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/__init__.py +0 -0
- wandb/cli/beta.py +175 -0
- wandb/cli/cli.py +2883 -0
- wandb/data_types.py +66 -0
- wandb/docker/__init__.py +290 -0
- wandb/docker/names.py +40 -0
- wandb/docker/wandb-entrypoint.sh +33 -0
- wandb/env.py +535 -0
- wandb/errors/__init__.py +17 -0
- wandb/errors/errors.py +40 -0
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +415 -0
- wandb/errors/util.py +57 -0
- wandb/errors/warnings.py +2 -0
- wandb/filesync/__init__.py +0 -0
- wandb/filesync/dir_watcher.py +404 -0
- wandb/filesync/stats.py +100 -0
- wandb/filesync/step_checksum.py +142 -0
- wandb/filesync/step_prepare.py +179 -0
- wandb/filesync/step_upload.py +287 -0
- wandb/filesync/upload_job.py +142 -0
- wandb/integration/__init__.py +0 -0
- wandb/integration/catboost/__init__.py +5 -0
- wandb/integration/catboost/catboost.py +182 -0
- wandb/integration/cohere/__init__.py +3 -0
- wandb/integration/cohere/cohere.py +21 -0
- wandb/integration/cohere/resolver.py +347 -0
- wandb/integration/diffusers/__init__.py +3 -0
- wandb/integration/diffusers/autologger.py +76 -0
- wandb/integration/diffusers/pipeline_resolver.py +50 -0
- wandb/integration/diffusers/resolvers/__init__.py +9 -0
- wandb/integration/diffusers/resolvers/multimodal.py +881 -0
- wandb/integration/diffusers/resolvers/utils.py +102 -0
- wandb/integration/fastai/__init__.py +243 -0
- wandb/integration/gym/__init__.py +98 -0
- wandb/integration/huggingface/__init__.py +3 -0
- wandb/integration/huggingface/huggingface.py +18 -0
- wandb/integration/huggingface/resolver.py +213 -0
- wandb/integration/keras/__init__.py +11 -0
- wandb/integration/keras/callbacks/__init__.py +5 -0
- wandb/integration/keras/callbacks/metrics_logger.py +129 -0
- wandb/integration/keras/callbacks/model_checkpoint.py +188 -0
- wandb/integration/keras/callbacks/tables_builder.py +228 -0
- wandb/integration/keras/keras.py +1086 -0
- wandb/integration/kfp/__init__.py +6 -0
- wandb/integration/kfp/helpers.py +28 -0
- wandb/integration/kfp/kfp_patch.py +335 -0
- wandb/integration/kfp/wandb_logging.py +182 -0
- wandb/integration/langchain/__init__.py +3 -0
- wandb/integration/langchain/wandb_tracer.py +49 -0
- wandb/integration/lightgbm/__init__.py +239 -0
- wandb/integration/lightning/__init__.py +0 -0
- wandb/integration/lightning/fabric/__init__.py +3 -0
- wandb/integration/lightning/fabric/logger.py +763 -0
- wandb/integration/metaflow/__init__.py +9 -0
- wandb/integration/metaflow/data_pandas.py +74 -0
- wandb/integration/metaflow/data_pytorch.py +75 -0
- wandb/integration/metaflow/data_sklearn.py +76 -0
- wandb/integration/metaflow/errors.py +13 -0
- wandb/integration/metaflow/metaflow.py +327 -0
- wandb/integration/openai/__init__.py +3 -0
- wandb/integration/openai/fine_tuning.py +480 -0
- wandb/integration/openai/openai.py +22 -0
- wandb/integration/openai/resolver.py +240 -0
- wandb/integration/prodigy/__init__.py +3 -0
- wandb/integration/prodigy/prodigy.py +291 -0
- wandb/integration/sacred/__init__.py +117 -0
- wandb/integration/sagemaker/__init__.py +14 -0
- wandb/integration/sagemaker/auth.py +29 -0
- wandb/integration/sagemaker/config.py +58 -0
- wandb/integration/sagemaker/files.py +2 -0
- wandb/integration/sagemaker/resources.py +63 -0
- wandb/integration/sb3/__init__.py +3 -0
- wandb/integration/sb3/sb3.py +147 -0
- wandb/integration/sklearn/__init__.py +37 -0
- wandb/integration/sklearn/calculate/__init__.py +32 -0
- wandb/integration/sklearn/calculate/calibration_curves.py +125 -0
- wandb/integration/sklearn/calculate/class_proportions.py +68 -0
- wandb/integration/sklearn/calculate/confusion_matrix.py +93 -0
- wandb/integration/sklearn/calculate/decision_boundaries.py +40 -0
- wandb/integration/sklearn/calculate/elbow_curve.py +55 -0
- wandb/integration/sklearn/calculate/feature_importances.py +67 -0
- wandb/integration/sklearn/calculate/learning_curve.py +64 -0
- wandb/integration/sklearn/calculate/outlier_candidates.py +69 -0
- wandb/integration/sklearn/calculate/residuals.py +86 -0
- wandb/integration/sklearn/calculate/silhouette.py +118 -0
- wandb/integration/sklearn/calculate/summary_metrics.py +62 -0
- wandb/integration/sklearn/plot/__init__.py +35 -0
- wandb/integration/sklearn/plot/classifier.py +329 -0
- wandb/integration/sklearn/plot/clusterer.py +146 -0
- wandb/integration/sklearn/plot/regressor.py +121 -0
- wandb/integration/sklearn/plot/shared.py +91 -0
- wandb/integration/sklearn/utils.py +184 -0
- wandb/integration/tensorboard/__init__.py +10 -0
- wandb/integration/tensorboard/log.py +351 -0
- wandb/integration/tensorboard/monkeypatch.py +186 -0
- wandb/integration/tensorflow/__init__.py +5 -0
- wandb/integration/tensorflow/estimator_hook.py +54 -0
- wandb/integration/torch/__init__.py +0 -0
- wandb/integration/torch/wandb_torch.py +554 -0
- wandb/integration/ultralytics/__init__.py +11 -0
- wandb/integration/ultralytics/bbox_utils.py +215 -0
- wandb/integration/ultralytics/callback.py +528 -0
- wandb/integration/ultralytics/classification_utils.py +83 -0
- wandb/integration/ultralytics/mask_utils.py +202 -0
- wandb/integration/ultralytics/pose_utils.py +103 -0
- wandb/integration/weave/__init__.py +6 -0
- wandb/integration/weave/interface.py +49 -0
- wandb/integration/weave/weave.py +63 -0
- wandb/integration/xgboost/__init__.py +11 -0
- wandb/integration/xgboost/xgboost.py +189 -0
- wandb/integration/yolov8/__init__.py +0 -0
- wandb/integration/yolov8/yolov8.py +284 -0
- wandb/jupyter.py +538 -0
- wandb/mpmain/__init__.py +0 -0
- wandb/mpmain/__main__.py +1 -0
- wandb/old/__init__.py +0 -0
- wandb/old/core.py +53 -0
- wandb/old/settings.py +176 -0
- wandb/old/summary.py +438 -0
- wandb/plot/__init__.py +30 -0
- wandb/plot/bar.py +71 -0
- wandb/plot/confusion_matrix.py +185 -0
- wandb/plot/custom_chart.py +147 -0
- wandb/plot/histogram.py +66 -0
- wandb/plot/line.py +75 -0
- wandb/plot/line_series.py +173 -0
- wandb/plot/pr_curve.py +186 -0
- wandb/plot/roc_curve.py +163 -0
- wandb/plot/scatter.py +66 -0
- wandb/plot/utils.py +184 -0
- wandb/plot/viz.py +41 -0
- wandb/proto/__init__.py +0 -0
- wandb/proto/v3/__init__.py +0 -0
- wandb/proto/v3/wandb_base_pb2.py +55 -0
- wandb/proto/v3/wandb_internal_pb2.py +1728 -0
- wandb/proto/v3/wandb_server_pb2.py +228 -0
- wandb/proto/v3/wandb_settings_pb2.py +122 -0
- wandb/proto/v3/wandb_telemetry_pb2.py +106 -0
- wandb/proto/v4/__init__.py +0 -0
- wandb/proto/v4/wandb_base_pb2.py +30 -0
- wandb/proto/v4/wandb_internal_pb2.py +382 -0
- wandb/proto/v4/wandb_server_pb2.py +67 -0
- wandb/proto/v4/wandb_settings_pb2.py +47 -0
- wandb/proto/v4/wandb_telemetry_pb2.py +41 -0
- wandb/proto/v5/wandb_base_pb2.py +31 -0
- wandb/proto/v5/wandb_internal_pb2.py +383 -0
- wandb/proto/v5/wandb_server_pb2.py +68 -0
- wandb/proto/v5/wandb_settings_pb2.py +48 -0
- wandb/proto/v5/wandb_telemetry_pb2.py +42 -0
- wandb/proto/v6/wandb_base_pb2.py +41 -0
- wandb/proto/v6/wandb_internal_pb2.py +393 -0
- wandb/proto/v6/wandb_server_pb2.py +78 -0
- wandb/proto/v6/wandb_settings_pb2.py +58 -0
- wandb/proto/v6/wandb_telemetry_pb2.py +52 -0
- wandb/proto/wandb_base_pb2.py +12 -0
- wandb/proto/wandb_deprecated.py +59 -0
- wandb/proto/wandb_generate_deprecated.py +30 -0
- wandb/proto/wandb_generate_proto.py +49 -0
- wandb/proto/wandb_internal_pb2.py +18 -0
- wandb/proto/wandb_server_pb2.py +12 -0
- wandb/proto/wandb_settings_pb2.py +12 -0
- wandb/proto/wandb_telemetry_pb2.py +12 -0
- wandb/py.typed +0 -0
- wandb/sdk/__init__.py +37 -0
- wandb/sdk/artifacts/__init__.py +0 -0
- wandb/sdk/artifacts/_factories.py +17 -0
- wandb/sdk/artifacts/_generated/__init__.py +508 -0
- wandb/sdk/artifacts/_generated/add_aliases.py +21 -0
- wandb/sdk/artifacts/_generated/artifact_by_id.py +17 -0
- wandb/sdk/artifacts/_generated/artifact_by_name.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_collection_membership_file_urls.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_collection_membership_files.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_created_by.py +47 -0
- wandb/sdk/artifacts/_generated/artifact_file_urls.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_type.py +31 -0
- wandb/sdk/artifacts/_generated/artifact_used_by.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_version_files.py +36 -0
- wandb/sdk/artifacts/_generated/artifact_via_membership_by_name.py +26 -0
- wandb/sdk/artifacts/_generated/create_artifact_collection_tag_assignments.py +36 -0
- wandb/sdk/artifacts/_generated/delete_aliases.py +21 -0
- wandb/sdk/artifacts/_generated/delete_artifact.py +28 -0
- wandb/sdk/artifacts/_generated/delete_artifact_collection_tag_assignments.py +25 -0
- wandb/sdk/artifacts/_generated/delete_artifact_portfolio.py +35 -0
- wandb/sdk/artifacts/_generated/delete_artifact_sequence.py +35 -0
- wandb/sdk/artifacts/_generated/enums.py +22 -0
- wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py +38 -0
- wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py +67 -0
- wandb/sdk/artifacts/_generated/fetch_registries.py +32 -0
- wandb/sdk/artifacts/_generated/fragments.py +459 -0
- wandb/sdk/artifacts/_generated/input_types.py +46 -0
- wandb/sdk/artifacts/_generated/link_artifact.py +27 -0
- wandb/sdk/artifacts/_generated/move_artifact_collection.py +35 -0
- wandb/sdk/artifacts/_generated/operations.py +1223 -0
- wandb/sdk/artifacts/_generated/project_artifact_collection.py +101 -0
- wandb/sdk/artifacts/_generated/project_artifact_collections.py +33 -0
- wandb/sdk/artifacts/_generated/project_artifact_type.py +24 -0
- wandb/sdk/artifacts/_generated/project_artifact_types.py +24 -0
- wandb/sdk/artifacts/_generated/project_artifacts.py +42 -0
- wandb/sdk/artifacts/_generated/registry_collections.py +34 -0
- wandb/sdk/artifacts/_generated/registry_versions.py +34 -0
- wandb/sdk/artifacts/_generated/run_input_artifacts.py +51 -0
- wandb/sdk/artifacts/_generated/run_output_artifacts.py +51 -0
- wandb/sdk/artifacts/_generated/unlink_artifact.py +25 -0
- wandb/sdk/artifacts/_generated/update_artifact.py +26 -0
- wandb/sdk/artifacts/_generated/update_artifact_portfolio.py +35 -0
- wandb/sdk/artifacts/_generated/update_artifact_sequence.py +35 -0
- wandb/sdk/artifacts/_graphql_fragments.py +19 -0
- wandb/sdk/artifacts/_internal_artifact.py +54 -0
- wandb/sdk/artifacts/_validators.py +309 -0
- wandb/sdk/artifacts/artifact.py +2702 -0
- wandb/sdk/artifacts/artifact_download_logger.py +45 -0
- wandb/sdk/artifacts/artifact_file_cache.py +251 -0
- wandb/sdk/artifacts/artifact_instance_cache.py +17 -0
- wandb/sdk/artifacts/artifact_manifest.py +76 -0
- wandb/sdk/artifacts/artifact_manifest_entry.py +258 -0
- wandb/sdk/artifacts/artifact_manifests/__init__.py +0 -0
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +94 -0
- wandb/sdk/artifacts/artifact_saver.py +277 -0
- wandb/sdk/artifacts/artifact_state.py +13 -0
- wandb/sdk/artifacts/artifact_ttl.py +9 -0
- wandb/sdk/artifacts/exceptions.py +71 -0
- wandb/sdk/artifacts/staging.py +27 -0
- wandb/sdk/artifacts/storage_handler.py +62 -0
- wandb/sdk/artifacts/storage_handlers/__init__.py +0 -0
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +214 -0
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +224 -0
- wandb/sdk/artifacts/storage_handlers/http_handler.py +114 -0
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +142 -0
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +56 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +339 -0
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +68 -0
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +131 -0
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +74 -0
- wandb/sdk/artifacts/storage_layout.py +8 -0
- wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
- wandb/sdk/artifacts/storage_policies/register.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +580 -0
- wandb/sdk/artifacts/storage_policy.py +75 -0
- wandb/sdk/backend/__init__.py +0 -0
- wandb/sdk/backend/backend.py +57 -0
- wandb/sdk/data_types/__init__.py +0 -0
- wandb/sdk/data_types/_dtypes.py +914 -0
- wandb/sdk/data_types/_private.py +10 -0
- wandb/sdk/data_types/audio.py +208 -0
- wandb/sdk/data_types/base_types/__init__.py +0 -0
- wandb/sdk/data_types/base_types/json_metadata.py +55 -0
- wandb/sdk/data_types/base_types/media.py +339 -0
- wandb/sdk/data_types/base_types/wb_value.py +295 -0
- wandb/sdk/data_types/bokeh.py +87 -0
- wandb/sdk/data_types/graph.py +439 -0
- wandb/sdk/data_types/helper_types/__init__.py +0 -0
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +327 -0
- wandb/sdk/data_types/helper_types/classes.py +159 -0
- wandb/sdk/data_types/helper_types/image_mask.py +251 -0
- wandb/sdk/data_types/histogram.py +107 -0
- wandb/sdk/data_types/html.py +165 -0
- wandb/sdk/data_types/image.py +974 -0
- wandb/sdk/data_types/molecule.py +250 -0
- wandb/sdk/data_types/object_3d.py +495 -0
- wandb/sdk/data_types/plotly.py +95 -0
- wandb/sdk/data_types/saved_model.py +435 -0
- wandb/sdk/data_types/table.py +1468 -0
- wandb/sdk/data_types/table_decorators.py +108 -0
- wandb/sdk/data_types/trace_tree.py +440 -0
- wandb/sdk/data_types/utils.py +260 -0
- wandb/sdk/data_types/video.py +303 -0
- wandb/sdk/integration_utils/__init__.py +0 -0
- wandb/sdk/integration_utils/auto_logging.py +232 -0
- wandb/sdk/integration_utils/data_logging.py +475 -0
- wandb/sdk/interface/__init__.py +0 -0
- wandb/sdk/interface/constants.py +4 -0
- wandb/sdk/interface/interface.py +1056 -0
- wandb/sdk/interface/interface_queue.py +40 -0
- wandb/sdk/interface/interface_shared.py +471 -0
- wandb/sdk/interface/interface_sock.py +49 -0
- wandb/sdk/interface/summary_record.py +67 -0
- wandb/sdk/internal/__init__.py +0 -0
- wandb/sdk/internal/_generated/__init__.py +15 -0
- wandb/sdk/internal/_generated/enums.py +4 -0
- wandb/sdk/internal/_generated/input_types.py +4 -0
- wandb/sdk/internal/_generated/operations.py +15 -0
- wandb/sdk/internal/_generated/server_features_query.py +27 -0
- wandb/sdk/internal/context.py +89 -0
- wandb/sdk/internal/datastore.py +293 -0
- wandb/sdk/internal/file_pusher.py +177 -0
- wandb/sdk/internal/file_stream.py +686 -0
- wandb/sdk/internal/handler.py +854 -0
- wandb/sdk/internal/incremental_table_util.py +53 -0
- wandb/sdk/internal/internal_api.py +4723 -0
- wandb/sdk/internal/job_builder.py +639 -0
- wandb/sdk/internal/profiler.py +79 -0
- wandb/sdk/internal/progress.py +77 -0
- wandb/sdk/internal/run.py +27 -0
- wandb/sdk/internal/sample.py +70 -0
- wandb/sdk/internal/sender.py +1692 -0
- wandb/sdk/internal/sender_config.py +203 -0
- wandb/sdk/internal/settings_static.py +120 -0
- wandb/sdk/internal/tb_watcher.py +519 -0
- wandb/sdk/internal/thread_local_settings.py +18 -0
- wandb/sdk/launch/__init__.py +15 -0
- wandb/sdk/launch/_launch.py +331 -0
- wandb/sdk/launch/_launch_add.py +255 -0
- wandb/sdk/launch/_project_spec.py +565 -0
- wandb/sdk/launch/agent/__init__.py +5 -0
- wandb/sdk/launch/agent/agent.py +931 -0
- wandb/sdk/launch/agent/config.py +296 -0
- wandb/sdk/launch/agent/job_status_tracker.py +55 -0
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +39 -0
- wandb/sdk/launch/builder/__init__.py +0 -0
- wandb/sdk/launch/builder/abstract.py +156 -0
- wandb/sdk/launch/builder/build.py +296 -0
- wandb/sdk/launch/builder/context_manager.py +235 -0
- wandb/sdk/launch/builder/docker_builder.py +177 -0
- wandb/sdk/launch/builder/kaniko_builder.py +595 -0
- wandb/sdk/launch/builder/noop.py +58 -0
- wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +188 -0
- wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
- wandb/sdk/launch/create_job.py +541 -0
- wandb/sdk/launch/environment/abstract.py +29 -0
- wandb/sdk/launch/environment/aws_environment.py +322 -0
- wandb/sdk/launch/environment/azure_environment.py +105 -0
- wandb/sdk/launch/environment/gcp_environment.py +334 -0
- wandb/sdk/launch/environment/local_environment.py +65 -0
- wandb/sdk/launch/errors.py +13 -0
- wandb/sdk/launch/git_reference.py +109 -0
- wandb/sdk/launch/inputs/files.py +148 -0
- wandb/sdk/launch/inputs/internal.py +314 -0
- wandb/sdk/launch/inputs/manage.py +113 -0
- wandb/sdk/launch/inputs/schema.py +40 -0
- wandb/sdk/launch/loader.py +249 -0
- wandb/sdk/launch/registry/abstract.py +48 -0
- wandb/sdk/launch/registry/anon.py +29 -0
- wandb/sdk/launch/registry/azure_container_registry.py +124 -0
- wandb/sdk/launch/registry/elastic_container_registry.py +192 -0
- wandb/sdk/launch/registry/google_artifact_registry.py +219 -0
- wandb/sdk/launch/registry/local_registry.py +65 -0
- wandb/sdk/launch/runner/__init__.py +0 -0
- wandb/sdk/launch/runner/abstract.py +185 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +473 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +1285 -0
- wandb/sdk/launch/runner/local_container.py +301 -0
- wandb/sdk/launch/runner/local_process.py +78 -0
- wandb/sdk/launch/runner/sagemaker_runner.py +424 -0
- wandb/sdk/launch/runner/vertex_runner.py +225 -0
- wandb/sdk/launch/sweeps/__init__.py +37 -0
- wandb/sdk/launch/sweeps/scheduler.py +739 -0
- wandb/sdk/launch/sweeps/scheduler_sweep.py +90 -0
- wandb/sdk/launch/sweeps/utils.py +324 -0
- wandb/sdk/launch/utils.py +746 -0
- wandb/sdk/launch/wandb_reference.py +138 -0
- wandb/sdk/lib/__init__.py +5 -0
- wandb/sdk/lib/apikey.py +334 -0
- wandb/sdk/lib/asyncio_compat.py +213 -0
- wandb/sdk/lib/asyncio_manager.py +252 -0
- wandb/sdk/lib/capped_dict.py +26 -0
- wandb/sdk/lib/config_util.py +101 -0
- wandb/sdk/lib/console_capture.py +219 -0
- wandb/sdk/lib/credentials.py +141 -0
- wandb/sdk/lib/deprecate.py +27 -0
- wandb/sdk/lib/disabled.py +30 -0
- wandb/sdk/lib/exit_hooks.py +54 -0
- wandb/sdk/lib/file_stream_utils.py +118 -0
- wandb/sdk/lib/filenames.py +64 -0
- wandb/sdk/lib/filesystem.py +372 -0
- wandb/sdk/lib/fsm.py +165 -0
- wandb/sdk/lib/gitlib.py +240 -0
- wandb/sdk/lib/gql_request.py +65 -0
- wandb/sdk/lib/handler_util.py +21 -0
- wandb/sdk/lib/hashutil.py +106 -0
- wandb/sdk/lib/import_hooks.py +275 -0
- wandb/sdk/lib/interrupt.py +37 -0
- wandb/sdk/lib/ipython.py +126 -0
- wandb/sdk/lib/json_util.py +75 -0
- wandb/sdk/lib/lazyloader.py +63 -0
- wandb/sdk/lib/module.py +72 -0
- wandb/sdk/lib/paths.py +106 -0
- wandb/sdk/lib/preinit.py +42 -0
- wandb/sdk/lib/printer.py +571 -0
- wandb/sdk/lib/printer_asyncio.py +48 -0
- wandb/sdk/lib/progress.py +320 -0
- wandb/sdk/lib/proto_util.py +90 -0
- wandb/sdk/lib/redirect.py +876 -0
- wandb/sdk/lib/retry.py +395 -0
- wandb/sdk/lib/run_moment.py +82 -0
- wandb/sdk/lib/runid.py +12 -0
- wandb/sdk/lib/server.py +58 -0
- wandb/sdk/lib/service/ipc_support.py +13 -0
- wandb/sdk/lib/service/service_client.py +106 -0
- wandb/sdk/lib/service/service_connection.py +192 -0
- wandb/sdk/lib/service/service_port_file.py +105 -0
- wandb/sdk/lib/service/service_process.py +111 -0
- wandb/sdk/lib/service/service_token.py +181 -0
- wandb/sdk/lib/sparkline.py +44 -0
- wandb/sdk/lib/telemetry.py +100 -0
- wandb/sdk/lib/timed_input.py +133 -0
- wandb/sdk/lib/timer.py +19 -0
- wandb/sdk/lib/wb_logging.py +161 -0
- wandb/sdk/mailbox/__init__.py +23 -0
- wandb/sdk/mailbox/mailbox.py +143 -0
- wandb/sdk/mailbox/mailbox_handle.py +132 -0
- wandb/sdk/mailbox/response_handle.py +99 -0
- wandb/sdk/mailbox/wait_with_progress.py +100 -0
- wandb/sdk/projects/_generated/__init__.py +47 -0
- wandb/sdk/projects/_generated/delete_project.py +22 -0
- wandb/sdk/projects/_generated/enums.py +4 -0
- wandb/sdk/projects/_generated/fetch_registry.py +22 -0
- wandb/sdk/projects/_generated/fragments.py +41 -0
- wandb/sdk/projects/_generated/input_types.py +13 -0
- wandb/sdk/projects/_generated/operations.py +88 -0
- wandb/sdk/projects/_generated/rename_project.py +27 -0
- wandb/sdk/projects/_generated/upsert_registry_project.py +27 -0
- wandb/sdk/verify/__init__.py +0 -0
- wandb/sdk/verify/verify.py +555 -0
- wandb/sdk/wandb_alerts.py +12 -0
- wandb/sdk/wandb_config.py +323 -0
- wandb/sdk/wandb_helper.py +54 -0
- wandb/sdk/wandb_init.py +1581 -0
- wandb/sdk/wandb_login.py +332 -0
- wandb/sdk/wandb_metric.py +112 -0
- wandb/sdk/wandb_require.py +88 -0
- wandb/sdk/wandb_require_helpers.py +44 -0
- wandb/sdk/wandb_run.py +4088 -0
- wandb/sdk/wandb_settings.py +2105 -0
- wandb/sdk/wandb_setup.py +560 -0
- wandb/sdk/wandb_summary.py +150 -0
- wandb/sdk/wandb_sweep.py +120 -0
- wandb/sdk/wandb_sync.py +71 -0
- wandb/sdk/wandb_watch.py +146 -0
- wandb/sklearn.py +35 -0
- wandb/sync/__init__.py +3 -0
- wandb/sync/sync.py +452 -0
- wandb/trigger.py +29 -0
- wandb/util.py +2040 -0
- wandb/vendor/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/setup.py +40 -0
- wandb/vendor/gql-0.2.0/tests/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/tests/starwars/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py +96 -0
- wandb/vendor/gql-0.2.0/tests/starwars/schema.py +146 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py +293 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_query.py +355 -0
- wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py +171 -0
- wandb/vendor/gql-0.2.0/tests/test_client.py +31 -0
- wandb/vendor/gql-0.2.0/tests/test_transport.py +89 -0
- wandb/vendor/gql-0.2.0/wandb_gql/__init__.py +4 -0
- wandb/vendor/gql-0.2.0/wandb_gql/client.py +75 -0
- wandb/vendor/gql-0.2.0/wandb_gql/dsl.py +152 -0
- wandb/vendor/gql-0.2.0/wandb_gql/gql.py +10 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py +0 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py +6 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py +15 -0
- wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py +46 -0
- wandb/vendor/gql-0.2.0/wandb_gql/utils.py +21 -0
- wandb/vendor/graphql-core-1.1/setup.py +86 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/__init__.py +287 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/__init__.py +6 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py +11 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py +29 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py +36 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__init__.py +26 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py +311 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executor.py +398 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/asyncio.py +53 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/gevent.py +22 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/process.py +32 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/sync.py +7 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/thread.py +35 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/utils.py +6 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/executor.py +66 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/fragment.py +252 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/resolver.py +151 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/utils.py +7 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/middleware.py +57 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py +145 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/graphql.py +60 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py +1349 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/base.py +19 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/lexer.py +435 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/location.py +30 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/parser.py +779 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py +193 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py +18 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py +222 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor_meta.py +82 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/cached_property.py +17 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/contain_subset.py +28 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/default_ordered_dict.py +40 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/ordereddict.py +8 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/pair_set.py +43 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/version.py +78 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py +132 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__init__.py +0 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/assert_valid_name.py +9 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_from_value.py +65 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_code.py +49 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_dict.py +24 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/base.py +75 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_ast_schema.py +291 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_client_schema.py +250 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/concat_ast.py +9 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py +357 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_field_def.py +27 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_operation_ast.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/introspection_query.py +90 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_literal_value.py +67 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_value.py +66 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/quoted_or_list.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/schema_printer.py +168 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/suggestion_list.py +56 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_comparators.py +69 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_from_ast.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_info.py +149 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/utils/value_from_ast.py +69 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__init__.py +4 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__init__.py +79 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py +24 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py +8 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py +44 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fields_on_correct_type.py +113 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fragments_on_composite_types.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_argument_names.py +70 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py +97 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py +19 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py +43 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/lone_anonymous_operation.py +23 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py +59 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_undefined_variables.py +36 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py +38 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py +37 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py +529 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/possible_fragment_spreads.py +44 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py +46 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py +32 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py +28 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_input_field_names.py +33 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py +31 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_variable_names.py +27 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_are_input_types.py +21 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_in_allowed_position.py +53 -0
- wandb/vendor/graphql-core-1.1/wandb_graphql/validation/validation.py +158 -0
- wandb/vendor/promise-2.3.0/conftest.py +30 -0
- wandb/vendor/promise-2.3.0/setup.py +64 -0
- wandb/vendor/promise-2.3.0/tests/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/tests/conftest.py +8 -0
- wandb/vendor/promise-2.3.0/tests/test_awaitable.py +32 -0
- wandb/vendor/promise-2.3.0/tests/test_awaitable_35.py +47 -0
- wandb/vendor/promise-2.3.0/tests/test_benchmark.py +116 -0
- wandb/vendor/promise-2.3.0/tests/test_complex_threads.py +23 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader.py +452 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader_awaitable_35.py +99 -0
- wandb/vendor/promise-2.3.0/tests/test_dataloader_extra.py +65 -0
- wandb/vendor/promise-2.3.0/tests/test_extra.py +670 -0
- wandb/vendor/promise-2.3.0/tests/test_issues.py +132 -0
- wandb/vendor/promise-2.3.0/tests/test_promise_list.py +70 -0
- wandb/vendor/promise-2.3.0/tests/test_spec.py +584 -0
- wandb/vendor/promise-2.3.0/tests/test_thread_safety.py +115 -0
- wandb/vendor/promise-2.3.0/tests/utils.py +3 -0
- wandb/vendor/promise-2.3.0/wandb_promise/__init__.py +38 -0
- wandb/vendor/promise-2.3.0/wandb_promise/async_.py +135 -0
- wandb/vendor/promise-2.3.0/wandb_promise/compat.py +32 -0
- wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py +326 -0
- wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py +12 -0
- wandb/vendor/promise-2.3.0/wandb_promise/promise.py +848 -0
- wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py +151 -0
- wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py +83 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__init__.py +0 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py +22 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py +21 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py +27 -0
- wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py +18 -0
- wandb/vendor/promise-2.3.0/wandb_promise/utils.py +56 -0
- wandb/vendor/pygments/__init__.py +90 -0
- wandb/vendor/pygments/cmdline.py +568 -0
- wandb/vendor/pygments/console.py +74 -0
- wandb/vendor/pygments/filter.py +74 -0
- wandb/vendor/pygments/filters/__init__.py +350 -0
- wandb/vendor/pygments/formatter.py +95 -0
- wandb/vendor/pygments/formatters/__init__.py +153 -0
- wandb/vendor/pygments/formatters/_mapping.py +85 -0
- wandb/vendor/pygments/formatters/bbcode.py +109 -0
- wandb/vendor/pygments/formatters/html.py +851 -0
- wandb/vendor/pygments/formatters/img.py +600 -0
- wandb/vendor/pygments/formatters/irc.py +182 -0
- wandb/vendor/pygments/formatters/latex.py +482 -0
- wandb/vendor/pygments/formatters/other.py +160 -0
- wandb/vendor/pygments/formatters/rtf.py +147 -0
- wandb/vendor/pygments/formatters/svg.py +153 -0
- wandb/vendor/pygments/formatters/terminal.py +136 -0
- wandb/vendor/pygments/formatters/terminal256.py +309 -0
- wandb/vendor/pygments/lexer.py +871 -0
- wandb/vendor/pygments/lexers/__init__.py +329 -0
- wandb/vendor/pygments/lexers/_asy_builtins.py +1645 -0
- wandb/vendor/pygments/lexers/_cl_builtins.py +232 -0
- wandb/vendor/pygments/lexers/_cocoa_builtins.py +72 -0
- wandb/vendor/pygments/lexers/_csound_builtins.py +1346 -0
- wandb/vendor/pygments/lexers/_lasso_builtins.py +5327 -0
- wandb/vendor/pygments/lexers/_lua_builtins.py +295 -0
- wandb/vendor/pygments/lexers/_mapping.py +500 -0
- wandb/vendor/pygments/lexers/_mql_builtins.py +1172 -0
- wandb/vendor/pygments/lexers/_openedge_builtins.py +2547 -0
- wandb/vendor/pygments/lexers/_php_builtins.py +4756 -0
- wandb/vendor/pygments/lexers/_postgres_builtins.py +621 -0
- wandb/vendor/pygments/lexers/_scilab_builtins.py +3094 -0
- wandb/vendor/pygments/lexers/_sourcemod_builtins.py +1163 -0
- wandb/vendor/pygments/lexers/_stan_builtins.py +532 -0
- wandb/vendor/pygments/lexers/_stata_builtins.py +419 -0
- wandb/vendor/pygments/lexers/_tsql_builtins.py +1004 -0
- wandb/vendor/pygments/lexers/_vim_builtins.py +1939 -0
- wandb/vendor/pygments/lexers/actionscript.py +240 -0
- wandb/vendor/pygments/lexers/agile.py +24 -0
- wandb/vendor/pygments/lexers/algebra.py +221 -0
- wandb/vendor/pygments/lexers/ambient.py +76 -0
- wandb/vendor/pygments/lexers/ampl.py +87 -0
- wandb/vendor/pygments/lexers/apl.py +101 -0
- wandb/vendor/pygments/lexers/archetype.py +318 -0
- wandb/vendor/pygments/lexers/asm.py +641 -0
- wandb/vendor/pygments/lexers/automation.py +374 -0
- wandb/vendor/pygments/lexers/basic.py +500 -0
- wandb/vendor/pygments/lexers/bibtex.py +160 -0
- wandb/vendor/pygments/lexers/business.py +612 -0
- wandb/vendor/pygments/lexers/c_cpp.py +252 -0
- wandb/vendor/pygments/lexers/c_like.py +541 -0
- wandb/vendor/pygments/lexers/capnproto.py +78 -0
- wandb/vendor/pygments/lexers/chapel.py +102 -0
- wandb/vendor/pygments/lexers/clean.py +288 -0
- wandb/vendor/pygments/lexers/compiled.py +34 -0
- wandb/vendor/pygments/lexers/configs.py +833 -0
- wandb/vendor/pygments/lexers/console.py +114 -0
- wandb/vendor/pygments/lexers/crystal.py +393 -0
- wandb/vendor/pygments/lexers/csound.py +366 -0
- wandb/vendor/pygments/lexers/css.py +689 -0
- wandb/vendor/pygments/lexers/d.py +251 -0
- wandb/vendor/pygments/lexers/dalvik.py +125 -0
- wandb/vendor/pygments/lexers/data.py +555 -0
- wandb/vendor/pygments/lexers/diff.py +165 -0
- wandb/vendor/pygments/lexers/dotnet.py +691 -0
- wandb/vendor/pygments/lexers/dsls.py +878 -0
- wandb/vendor/pygments/lexers/dylan.py +289 -0
- wandb/vendor/pygments/lexers/ecl.py +125 -0
- wandb/vendor/pygments/lexers/eiffel.py +65 -0
- wandb/vendor/pygments/lexers/elm.py +121 -0
- wandb/vendor/pygments/lexers/erlang.py +533 -0
- wandb/vendor/pygments/lexers/esoteric.py +277 -0
- wandb/vendor/pygments/lexers/ezhil.py +69 -0
- wandb/vendor/pygments/lexers/factor.py +344 -0
- wandb/vendor/pygments/lexers/fantom.py +250 -0
- wandb/vendor/pygments/lexers/felix.py +273 -0
- wandb/vendor/pygments/lexers/forth.py +177 -0
- wandb/vendor/pygments/lexers/fortran.py +205 -0
- wandb/vendor/pygments/lexers/foxpro.py +428 -0
- wandb/vendor/pygments/lexers/functional.py +21 -0
- wandb/vendor/pygments/lexers/go.py +101 -0
- wandb/vendor/pygments/lexers/grammar_notation.py +213 -0
- wandb/vendor/pygments/lexers/graph.py +80 -0
- wandb/vendor/pygments/lexers/graphics.py +553 -0
- wandb/vendor/pygments/lexers/haskell.py +843 -0
- wandb/vendor/pygments/lexers/haxe.py +936 -0
- wandb/vendor/pygments/lexers/hdl.py +382 -0
- wandb/vendor/pygments/lexers/hexdump.py +103 -0
- wandb/vendor/pygments/lexers/html.py +602 -0
- wandb/vendor/pygments/lexers/idl.py +270 -0
- wandb/vendor/pygments/lexers/igor.py +288 -0
- wandb/vendor/pygments/lexers/inferno.py +96 -0
- wandb/vendor/pygments/lexers/installers.py +322 -0
- wandb/vendor/pygments/lexers/int_fiction.py +1343 -0
- wandb/vendor/pygments/lexers/iolang.py +63 -0
- wandb/vendor/pygments/lexers/j.py +146 -0
- wandb/vendor/pygments/lexers/javascript.py +1525 -0
- wandb/vendor/pygments/lexers/julia.py +333 -0
- wandb/vendor/pygments/lexers/jvm.py +1573 -0
- wandb/vendor/pygments/lexers/lisp.py +2621 -0
- wandb/vendor/pygments/lexers/make.py +202 -0
- wandb/vendor/pygments/lexers/markup.py +595 -0
- wandb/vendor/pygments/lexers/math.py +21 -0
- wandb/vendor/pygments/lexers/matlab.py +663 -0
- wandb/vendor/pygments/lexers/ml.py +769 -0
- wandb/vendor/pygments/lexers/modeling.py +358 -0
- wandb/vendor/pygments/lexers/modula2.py +1561 -0
- wandb/vendor/pygments/lexers/monte.py +204 -0
- wandb/vendor/pygments/lexers/ncl.py +894 -0
- wandb/vendor/pygments/lexers/nimrod.py +159 -0
- wandb/vendor/pygments/lexers/nit.py +64 -0
- wandb/vendor/pygments/lexers/nix.py +136 -0
- wandb/vendor/pygments/lexers/oberon.py +105 -0
- wandb/vendor/pygments/lexers/objective.py +504 -0
- wandb/vendor/pygments/lexers/ooc.py +85 -0
- wandb/vendor/pygments/lexers/other.py +41 -0
- wandb/vendor/pygments/lexers/parasail.py +79 -0
- wandb/vendor/pygments/lexers/parsers.py +835 -0
- wandb/vendor/pygments/lexers/pascal.py +644 -0
- wandb/vendor/pygments/lexers/pawn.py +199 -0
- wandb/vendor/pygments/lexers/perl.py +620 -0
- wandb/vendor/pygments/lexers/php.py +267 -0
- wandb/vendor/pygments/lexers/praat.py +294 -0
- wandb/vendor/pygments/lexers/prolog.py +306 -0
- wandb/vendor/pygments/lexers/python.py +939 -0
- wandb/vendor/pygments/lexers/qvt.py +152 -0
- wandb/vendor/pygments/lexers/r.py +453 -0
- wandb/vendor/pygments/lexers/rdf.py +270 -0
- wandb/vendor/pygments/lexers/rebol.py +431 -0
- wandb/vendor/pygments/lexers/resource.py +85 -0
- wandb/vendor/pygments/lexers/rnc.py +67 -0
- wandb/vendor/pygments/lexers/roboconf.py +82 -0
- wandb/vendor/pygments/lexers/robotframework.py +560 -0
- wandb/vendor/pygments/lexers/ruby.py +519 -0
- wandb/vendor/pygments/lexers/rust.py +220 -0
- wandb/vendor/pygments/lexers/sas.py +228 -0
- wandb/vendor/pygments/lexers/scripting.py +1222 -0
- wandb/vendor/pygments/lexers/shell.py +794 -0
- wandb/vendor/pygments/lexers/smalltalk.py +195 -0
- wandb/vendor/pygments/lexers/smv.py +79 -0
- wandb/vendor/pygments/lexers/snobol.py +83 -0
- wandb/vendor/pygments/lexers/special.py +103 -0
- wandb/vendor/pygments/lexers/sql.py +681 -0
- wandb/vendor/pygments/lexers/stata.py +108 -0
- wandb/vendor/pygments/lexers/supercollider.py +90 -0
- wandb/vendor/pygments/lexers/tcl.py +145 -0
- wandb/vendor/pygments/lexers/templates.py +2283 -0
- wandb/vendor/pygments/lexers/testing.py +207 -0
- wandb/vendor/pygments/lexers/text.py +25 -0
- wandb/vendor/pygments/lexers/textedit.py +169 -0
- wandb/vendor/pygments/lexers/textfmts.py +297 -0
- wandb/vendor/pygments/lexers/theorem.py +458 -0
- wandb/vendor/pygments/lexers/trafficscript.py +54 -0
- wandb/vendor/pygments/lexers/typoscript.py +226 -0
- wandb/vendor/pygments/lexers/urbi.py +133 -0
- wandb/vendor/pygments/lexers/varnish.py +190 -0
- wandb/vendor/pygments/lexers/verification.py +111 -0
- wandb/vendor/pygments/lexers/web.py +24 -0
- wandb/vendor/pygments/lexers/webmisc.py +988 -0
- wandb/vendor/pygments/lexers/whiley.py +116 -0
- wandb/vendor/pygments/lexers/x10.py +69 -0
- wandb/vendor/pygments/modeline.py +44 -0
- wandb/vendor/pygments/plugin.py +68 -0
- wandb/vendor/pygments/regexopt.py +92 -0
- wandb/vendor/pygments/scanner.py +105 -0
- wandb/vendor/pygments/sphinxext.py +158 -0
- wandb/vendor/pygments/style.py +155 -0
- wandb/vendor/pygments/styles/__init__.py +80 -0
- wandb/vendor/pygments/styles/abap.py +29 -0
- wandb/vendor/pygments/styles/algol.py +63 -0
- wandb/vendor/pygments/styles/algol_nu.py +63 -0
- wandb/vendor/pygments/styles/arduino.py +98 -0
- wandb/vendor/pygments/styles/autumn.py +65 -0
- wandb/vendor/pygments/styles/borland.py +51 -0
- wandb/vendor/pygments/styles/bw.py +49 -0
- wandb/vendor/pygments/styles/colorful.py +81 -0
- wandb/vendor/pygments/styles/default.py +73 -0
- wandb/vendor/pygments/styles/emacs.py +72 -0
- wandb/vendor/pygments/styles/friendly.py +72 -0
- wandb/vendor/pygments/styles/fruity.py +42 -0
- wandb/vendor/pygments/styles/igor.py +29 -0
- wandb/vendor/pygments/styles/lovelace.py +97 -0
- wandb/vendor/pygments/styles/manni.py +75 -0
- wandb/vendor/pygments/styles/monokai.py +106 -0
- wandb/vendor/pygments/styles/murphy.py +80 -0
- wandb/vendor/pygments/styles/native.py +65 -0
- wandb/vendor/pygments/styles/paraiso_dark.py +125 -0
- wandb/vendor/pygments/styles/paraiso_light.py +125 -0
- wandb/vendor/pygments/styles/pastie.py +75 -0
- wandb/vendor/pygments/styles/perldoc.py +69 -0
- wandb/vendor/pygments/styles/rainbow_dash.py +89 -0
- wandb/vendor/pygments/styles/rrt.py +33 -0
- wandb/vendor/pygments/styles/sas.py +44 -0
- wandb/vendor/pygments/styles/stata.py +40 -0
- wandb/vendor/pygments/styles/tango.py +141 -0
- wandb/vendor/pygments/styles/trac.py +63 -0
- wandb/vendor/pygments/styles/vim.py +63 -0
- wandb/vendor/pygments/styles/vs.py +38 -0
- wandb/vendor/pygments/styles/xcode.py +51 -0
- wandb/vendor/pygments/token.py +213 -0
- wandb/vendor/pygments/unistring.py +217 -0
- wandb/vendor/pygments/util.py +388 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py +17 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py +615 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py +98 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py +369 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py +172 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py +239 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py +218 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py +81 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py +575 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py +730 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py +145 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py +133 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py +348 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/patterns.py +265 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py +174 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__init__.py +151 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/bricks.py +249 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/compat.py +29 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py +198 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/delayed_queue.py +88 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/dirsnapshot.py +293 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py +157 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py +41 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py +40 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py +57 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py +64 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py +123 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/version.py +28 -0
- wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py +577 -0
- wandb/wandb_agent.py +580 -0
- wandb/wandb_controller.py +719 -0
- wandb/wandb_run.py +8 -0
- wandb-0.21.2.dist-info/METADATA +223 -0
- wandb-0.21.2.dist-info/RECORD +904 -0
- wandb-0.21.2.dist-info/WHEEL +4 -0
- wandb-0.21.2.dist-info/entry_points.txt +3 -0
- wandb-0.21.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1216 @@
|
|
1
|
+
"""W&B Public API for Runs.
|
2
|
+
|
3
|
+
This module provides classes for interacting with W&B runs and their associated
|
4
|
+
data.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
```python
|
8
|
+
from wandb.apis.public import Api
|
9
|
+
|
10
|
+
# Get runs matching filters
|
11
|
+
runs = Api().runs(
|
12
|
+
path="entity/project", filters={"state": "finished", "config.batch_size": 32}
|
13
|
+
)
|
14
|
+
|
15
|
+
# Access run data
|
16
|
+
for run in runs:
|
17
|
+
print(f"Run: {run.name}")
|
18
|
+
print(f"Config: {run.config}")
|
19
|
+
print(f"Metrics: {run.summary}")
|
20
|
+
|
21
|
+
# Get history with pandas
|
22
|
+
history_df = run.history(keys=["loss", "accuracy"], pandas=True)
|
23
|
+
|
24
|
+
# Work with artifacts
|
25
|
+
for artifact in run.logged_artifacts():
|
26
|
+
print(f"Artifact: {artifact.name}")
|
27
|
+
```
|
28
|
+
|
29
|
+
Note:
|
30
|
+
This module is part of the W&B Public API and provides read/write access
|
31
|
+
to run data. For logging new runs, use the wandb.init() function from
|
32
|
+
the main wandb package.
|
33
|
+
"""
|
34
|
+
|
35
|
+
from __future__ import annotations
|
36
|
+
|
37
|
+
import json
|
38
|
+
import os
|
39
|
+
import tempfile
|
40
|
+
import time
|
41
|
+
import urllib
|
42
|
+
from typing import TYPE_CHECKING, Any, Collection, Literal, Mapping
|
43
|
+
|
44
|
+
from wandb_gql import gql
|
45
|
+
|
46
|
+
import wandb
|
47
|
+
from wandb import env, util
|
48
|
+
from wandb.apis import public
|
49
|
+
from wandb.apis.attrs import Attrs
|
50
|
+
from wandb.apis.internal import Api as InternalApi
|
51
|
+
from wandb.apis.normalize import normalize_exceptions
|
52
|
+
from wandb.apis.paginator import SizedPaginator
|
53
|
+
from wandb.apis.public.const import RETRY_TIMEDELTA
|
54
|
+
from wandb.sdk.lib import ipython, json_util, runid
|
55
|
+
from wandb.sdk.lib.paths import LogicalPath
|
56
|
+
|
57
|
+
if TYPE_CHECKING:
|
58
|
+
from wandb.apis.public import RetryingClient
|
59
|
+
|
60
|
+
WANDB_INTERNAL_KEYS = {"_wandb", "wandb_version"}
|
61
|
+
|
62
|
+
RUN_FRAGMENT = """fragment RunFragment on Run {
|
63
|
+
id
|
64
|
+
tags
|
65
|
+
name
|
66
|
+
displayName
|
67
|
+
sweepName
|
68
|
+
state
|
69
|
+
config
|
70
|
+
group
|
71
|
+
jobType
|
72
|
+
commit
|
73
|
+
readOnly
|
74
|
+
createdAt
|
75
|
+
heartbeatAt
|
76
|
+
description
|
77
|
+
notes
|
78
|
+
systemMetrics
|
79
|
+
summaryMetrics
|
80
|
+
historyLineCount
|
81
|
+
user {
|
82
|
+
name
|
83
|
+
username
|
84
|
+
}
|
85
|
+
historyKeys
|
86
|
+
}"""
|
87
|
+
|
88
|
+
|
89
|
+
@normalize_exceptions
|
90
|
+
def _server_provides_internal_id_for_project(client) -> bool:
|
91
|
+
"""Returns True if the server allows us to query the internalId field for a project.
|
92
|
+
|
93
|
+
This check is done by utilizing GraphQL introspection in the available fields on the Project type.
|
94
|
+
"""
|
95
|
+
query_string = """
|
96
|
+
query ProbeRunInput {
|
97
|
+
RunType: __type(name:"Run") {
|
98
|
+
fields {
|
99
|
+
name
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
"""
|
104
|
+
|
105
|
+
# Only perform the query once to avoid extra network calls
|
106
|
+
query = gql(query_string)
|
107
|
+
res = client.execute(query)
|
108
|
+
return "projectId" in [
|
109
|
+
x["name"] for x in (res.get("RunType", {}).get("fields", [{}]))
|
110
|
+
]
|
111
|
+
|
112
|
+
|
113
|
+
@normalize_exceptions
|
114
|
+
def _convert_to_dict(value: Any) -> dict[str, Any]:
|
115
|
+
"""Converts a value to a dictionary.
|
116
|
+
|
117
|
+
If the value is already a dictionary, the value is returned unchanged.
|
118
|
+
If the value is a string, bytes, or bytearray, it is parsed as JSON.
|
119
|
+
For any other type, a TypeError is raised.
|
120
|
+
"""
|
121
|
+
if value is None:
|
122
|
+
return {}
|
123
|
+
|
124
|
+
if isinstance(value, dict):
|
125
|
+
return value
|
126
|
+
|
127
|
+
if isinstance(value, (str, bytes, bytearray)):
|
128
|
+
try:
|
129
|
+
return json.loads(value)
|
130
|
+
except json.decoder.JSONDecodeError:
|
131
|
+
# ignore invalid utf-8 or control characters
|
132
|
+
return json.loads(value, strict=False)
|
133
|
+
|
134
|
+
raise TypeError(f"Unable to convert {value} to a dict")
|
135
|
+
|
136
|
+
|
137
|
+
class Runs(SizedPaginator["Run"]):
|
138
|
+
"""A lazy iterator of `Run` objects associated with a project and optional filter.
|
139
|
+
|
140
|
+
Runs are retrieved in pages from the W&B server as needed.
|
141
|
+
|
142
|
+
This is generally used indirectly using the `Api.runs` namespace.
|
143
|
+
|
144
|
+
Args:
|
145
|
+
client: (`wandb.apis.public.RetryingClient`) The API client to use
|
146
|
+
for requests.
|
147
|
+
entity: (str) The entity (username or team) that owns the project.
|
148
|
+
project: (str) The name of the project to fetch runs from.
|
149
|
+
filters: (Optional[Dict[str, Any]]) A dictionary of filters to apply
|
150
|
+
to the runs query.
|
151
|
+
order: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`.
|
152
|
+
If you prepend order with a + order is ascending (default).
|
153
|
+
If you prepend order with a - order is descending.
|
154
|
+
The default order is run.created_at from oldest to newest.
|
155
|
+
per_page: (int) The number of runs to fetch per request (default is 50).
|
156
|
+
include_sweeps: (bool) Whether to include sweep information in the
|
157
|
+
runs. Defaults to True.
|
158
|
+
|
159
|
+
Examples:
|
160
|
+
```python
|
161
|
+
from wandb.apis.public.runs import Runs
|
162
|
+
from wandb.apis.public import Api
|
163
|
+
|
164
|
+
# Get all runs from a project that satisfy the filters
|
165
|
+
filters = {"state": "finished", "config.optimizer": "adam"}
|
166
|
+
|
167
|
+
runs = Api().runs(
|
168
|
+
client=api.client,
|
169
|
+
entity="entity",
|
170
|
+
project="project_name",
|
171
|
+
filters=filters,
|
172
|
+
)
|
173
|
+
|
174
|
+
# Iterate over runs and print details
|
175
|
+
for run in runs:
|
176
|
+
print(f"Run name: {run.name}")
|
177
|
+
print(f"Run ID: {run.id}")
|
178
|
+
print(f"Run URL: {run.url}")
|
179
|
+
print(f"Run state: {run.state}")
|
180
|
+
print(f"Run config: {run.config}")
|
181
|
+
print(f"Run summary: {run.summary}")
|
182
|
+
print(f"Run history (samples=5): {run.history(samples=5)}")
|
183
|
+
print("----------")
|
184
|
+
|
185
|
+
# Get histories for all runs with specific metrics
|
186
|
+
histories_df = runs.histories(
|
187
|
+
samples=100, # Number of samples per run
|
188
|
+
keys=["loss", "accuracy"], # Metrics to fetch
|
189
|
+
x_axis="_step", # X-axis metric
|
190
|
+
format="pandas", # Return as pandas DataFrame
|
191
|
+
)
|
192
|
+
```
|
193
|
+
"""
|
194
|
+
|
195
|
+
def __init__(
|
196
|
+
self,
|
197
|
+
client: RetryingClient,
|
198
|
+
entity: str,
|
199
|
+
project: str,
|
200
|
+
filters: dict[str, Any] | None = None,
|
201
|
+
order: str = "+created_at",
|
202
|
+
per_page: int = 50,
|
203
|
+
include_sweeps: bool = True,
|
204
|
+
):
|
205
|
+
if not order:
|
206
|
+
order = "+created_at"
|
207
|
+
|
208
|
+
self.QUERY = gql(
|
209
|
+
f"""#graphql
|
210
|
+
query Runs($project: String!, $entity: String!, $cursor: String, $perPage: Int = 50, $order: String, $filters: JSONString) {{
|
211
|
+
project(name: $project, entityName: $entity) {{
|
212
|
+
internalId
|
213
|
+
runCount(filters: $filters)
|
214
|
+
readOnly
|
215
|
+
runs(filters: $filters, after: $cursor, first: $perPage, order: $order) {{
|
216
|
+
edges {{
|
217
|
+
node {{
|
218
|
+
{"projectId" if _server_provides_internal_id_for_project(client) else ""}
|
219
|
+
...RunFragment
|
220
|
+
}}
|
221
|
+
cursor
|
222
|
+
}}
|
223
|
+
pageInfo {{
|
224
|
+
endCursor
|
225
|
+
hasNextPage
|
226
|
+
}}
|
227
|
+
}}
|
228
|
+
}}
|
229
|
+
}}
|
230
|
+
{RUN_FRAGMENT}
|
231
|
+
"""
|
232
|
+
)
|
233
|
+
|
234
|
+
self.entity = entity
|
235
|
+
self.project = project
|
236
|
+
self._project_internal_id = None
|
237
|
+
self.filters = filters or {}
|
238
|
+
self.order = order
|
239
|
+
self._sweeps = {}
|
240
|
+
self._include_sweeps = include_sweeps
|
241
|
+
variables = {
|
242
|
+
"project": self.project,
|
243
|
+
"entity": self.entity,
|
244
|
+
"order": self.order,
|
245
|
+
"filters": json.dumps(self.filters),
|
246
|
+
}
|
247
|
+
super().__init__(client, variables, per_page)
|
248
|
+
|
249
|
+
@property
|
250
|
+
def _length(self):
|
251
|
+
"""Returns the total number of runs.
|
252
|
+
|
253
|
+
<!-- lazydoc-ignore: internal -->
|
254
|
+
"""
|
255
|
+
if not self.last_response:
|
256
|
+
self._load_page()
|
257
|
+
return self.last_response["project"]["runCount"]
|
258
|
+
|
259
|
+
@property
|
260
|
+
def more(self) -> bool:
|
261
|
+
"""Returns whether there are more runs to fetch.
|
262
|
+
|
263
|
+
<!-- lazydoc-ignore: internal -->
|
264
|
+
"""
|
265
|
+
if self.last_response:
|
266
|
+
return bool(
|
267
|
+
self.last_response["project"]["runs"]["pageInfo"]["hasNextPage"]
|
268
|
+
)
|
269
|
+
else:
|
270
|
+
return True
|
271
|
+
|
272
|
+
@property
|
273
|
+
def cursor(self):
|
274
|
+
"""Returns the cursor position for pagination of runs results.
|
275
|
+
|
276
|
+
<!-- lazydoc-ignore: internal -->
|
277
|
+
"""
|
278
|
+
if self.last_response:
|
279
|
+
return self.last_response["project"]["runs"]["edges"][-1]["cursor"]
|
280
|
+
else:
|
281
|
+
return None
|
282
|
+
|
283
|
+
def convert_objects(self):
|
284
|
+
"""Converts GraphQL edges to Runs objects.
|
285
|
+
|
286
|
+
<!-- lazydoc-ignore: internal -->
|
287
|
+
"""
|
288
|
+
objs = []
|
289
|
+
if self.last_response is None or self.last_response.get("project") is None:
|
290
|
+
raise ValueError("Could not find project {}".format(self.project))
|
291
|
+
for run_response in self.last_response["project"]["runs"]["edges"]:
|
292
|
+
run = Run(
|
293
|
+
self.client,
|
294
|
+
self.entity,
|
295
|
+
self.project,
|
296
|
+
run_response["node"]["name"],
|
297
|
+
run_response["node"],
|
298
|
+
include_sweeps=self._include_sweeps,
|
299
|
+
)
|
300
|
+
objs.append(run)
|
301
|
+
|
302
|
+
if self._include_sweeps and run.sweep_name:
|
303
|
+
if run.sweep_name in self._sweeps:
|
304
|
+
sweep = self._sweeps[run.sweep_name]
|
305
|
+
else:
|
306
|
+
sweep = public.Sweep.get(
|
307
|
+
self.client,
|
308
|
+
self.entity,
|
309
|
+
self.project,
|
310
|
+
run.sweep_name,
|
311
|
+
withRuns=False,
|
312
|
+
)
|
313
|
+
self._sweeps[run.sweep_name] = sweep
|
314
|
+
|
315
|
+
if sweep is None:
|
316
|
+
continue
|
317
|
+
run.sweep = sweep
|
318
|
+
|
319
|
+
return objs
|
320
|
+
|
321
|
+
@normalize_exceptions
|
322
|
+
def histories(
|
323
|
+
self,
|
324
|
+
samples: int = 500,
|
325
|
+
keys: list[str] | None = None,
|
326
|
+
x_axis: str = "_step",
|
327
|
+
format: Literal["default", "pandas", "polars"] = "default",
|
328
|
+
stream: Literal["default", "system"] = "default",
|
329
|
+
):
|
330
|
+
"""Return sampled history metrics for all runs that fit the filters conditions.
|
331
|
+
|
332
|
+
Args:
|
333
|
+
samples: The number of samples to return per run
|
334
|
+
keys: Only return metrics for specific keys
|
335
|
+
x_axis: Use this metric as the xAxis defaults to _step
|
336
|
+
format: Format to return data in, options are "default", "pandas",
|
337
|
+
"polars"
|
338
|
+
stream: "default" for metrics, "system" for machine metrics
|
339
|
+
Returns:
|
340
|
+
pandas.DataFrame: If `format="pandas"`, returns a `pandas.DataFrame`
|
341
|
+
of history metrics.
|
342
|
+
polars.DataFrame: If `format="polars"`, returns a `polars.DataFrame`
|
343
|
+
of history metrics.
|
344
|
+
list of dicts: If `format="default"`, returns a list of dicts
|
345
|
+
containing history metrics with a `run_id` key.
|
346
|
+
"""
|
347
|
+
if format not in ("default", "pandas", "polars"):
|
348
|
+
raise ValueError(
|
349
|
+
f"Invalid format: {format}. Must be one of 'default', 'pandas', 'polars'"
|
350
|
+
)
|
351
|
+
|
352
|
+
histories = []
|
353
|
+
|
354
|
+
if format == "default":
|
355
|
+
for run in self:
|
356
|
+
history_data = run.history(
|
357
|
+
samples=samples,
|
358
|
+
keys=keys,
|
359
|
+
x_axis=x_axis,
|
360
|
+
pandas=False,
|
361
|
+
stream=stream,
|
362
|
+
)
|
363
|
+
if not history_data:
|
364
|
+
continue
|
365
|
+
for entry in history_data:
|
366
|
+
entry["run_id"] = run.id
|
367
|
+
histories.extend(history_data)
|
368
|
+
|
369
|
+
return histories
|
370
|
+
|
371
|
+
if format == "pandas":
|
372
|
+
pd = util.get_module(
|
373
|
+
"pandas", required="Exporting pandas DataFrame requires pandas"
|
374
|
+
)
|
375
|
+
for run in self:
|
376
|
+
history_data = run.history(
|
377
|
+
samples=samples,
|
378
|
+
keys=keys,
|
379
|
+
x_axis=x_axis,
|
380
|
+
pandas=False,
|
381
|
+
stream=stream,
|
382
|
+
)
|
383
|
+
if not history_data:
|
384
|
+
continue
|
385
|
+
df = pd.DataFrame.from_records(history_data)
|
386
|
+
df["run_id"] = run.id
|
387
|
+
histories.append(df)
|
388
|
+
if not histories:
|
389
|
+
return pd.DataFrame()
|
390
|
+
combined_df = pd.concat(histories)
|
391
|
+
combined_df.reset_index(drop=True, inplace=True)
|
392
|
+
# sort columns for consistency
|
393
|
+
combined_df = combined_df[(sorted(combined_df.columns))]
|
394
|
+
|
395
|
+
return combined_df
|
396
|
+
|
397
|
+
if format == "polars":
|
398
|
+
pl = util.get_module(
|
399
|
+
"polars", required="Exporting polars DataFrame requires polars"
|
400
|
+
)
|
401
|
+
for run in self:
|
402
|
+
history_data = run.history(
|
403
|
+
samples=samples,
|
404
|
+
keys=keys,
|
405
|
+
x_axis=x_axis,
|
406
|
+
pandas=False,
|
407
|
+
stream=stream,
|
408
|
+
)
|
409
|
+
if not history_data:
|
410
|
+
continue
|
411
|
+
df = pl.from_records(history_data)
|
412
|
+
df = df.with_columns(pl.lit(run.id).alias("run_id"))
|
413
|
+
histories.append(df)
|
414
|
+
if not histories:
|
415
|
+
return pl.DataFrame()
|
416
|
+
combined_df = pl.concat(histories, how="vertical")
|
417
|
+
# sort columns for consistency
|
418
|
+
combined_df = combined_df.select(sorted(combined_df.columns))
|
419
|
+
|
420
|
+
return combined_df
|
421
|
+
|
422
|
+
def __repr__(self):
|
423
|
+
return f"<Runs {self.entity}/{self.project}>"
|
424
|
+
|
425
|
+
|
426
|
+
class Run(Attrs):
|
427
|
+
"""A single run associated with an entity and project.
|
428
|
+
|
429
|
+
Args:
|
430
|
+
client: The W&B API client.
|
431
|
+
entity: The entity associated with the run.
|
432
|
+
project: The project associated with the run.
|
433
|
+
run_id: The unique identifier for the run.
|
434
|
+
attrs: The attributes of the run.
|
435
|
+
include_sweeps: Whether to include sweeps in the run.
|
436
|
+
|
437
|
+
Attributes:
|
438
|
+
tags ([str]): a list of tags associated with the run
|
439
|
+
url (str): the url of this run
|
440
|
+
id (str): unique identifier for the run (defaults to eight characters)
|
441
|
+
name (str): the name of the run
|
442
|
+
state (str): one of: running, finished, crashed, killed, preempting, preempted
|
443
|
+
config (dict): a dict of hyperparameters associated with the run
|
444
|
+
created_at (str): ISO timestamp when the run was started
|
445
|
+
system_metrics (dict): the latest system metrics recorded for the run
|
446
|
+
summary (dict): A mutable dict-like property that holds the current summary.
|
447
|
+
Calling update will persist any changes.
|
448
|
+
project (str): the project associated with the run
|
449
|
+
entity (str): the name of the entity associated with the run
|
450
|
+
project_internal_id (int): the internal id of the project
|
451
|
+
user (str): the name of the user who created the run
|
452
|
+
path (str): Unique identifier [entity]/[project]/[run_id]
|
453
|
+
notes (str): Notes about the run
|
454
|
+
read_only (boolean): Whether the run is editable
|
455
|
+
history_keys (str): Keys of the history metrics that have been logged
|
456
|
+
with `wandb.log({key: value})`
|
457
|
+
metadata (str): Metadata about the run from wandb-metadata.json
|
458
|
+
"""
|
459
|
+
|
460
|
+
def __init__(
|
461
|
+
self,
|
462
|
+
client: RetryingClient,
|
463
|
+
entity: str,
|
464
|
+
project: str,
|
465
|
+
run_id: str,
|
466
|
+
attrs: Mapping | None = None,
|
467
|
+
include_sweeps: bool = True,
|
468
|
+
):
|
469
|
+
"""Initialize a Run object.
|
470
|
+
|
471
|
+
Run is always initialized by calling api.runs() where api is an instance of
|
472
|
+
wandb.Api.
|
473
|
+
"""
|
474
|
+
_attrs = attrs or {}
|
475
|
+
super().__init__(dict(_attrs))
|
476
|
+
self.client = client
|
477
|
+
self._entity = entity
|
478
|
+
self.project = project
|
479
|
+
self._files = {}
|
480
|
+
self._base_dir = env.get_dir(tempfile.gettempdir())
|
481
|
+
self.id = run_id
|
482
|
+
self.sweep = None
|
483
|
+
self._include_sweeps = include_sweeps
|
484
|
+
self.dir = os.path.join(self._base_dir, *self.path)
|
485
|
+
try:
|
486
|
+
os.makedirs(self.dir)
|
487
|
+
except OSError:
|
488
|
+
pass
|
489
|
+
self._summary = None
|
490
|
+
self._metadata: dict[str, Any] | None = None
|
491
|
+
self._state = _attrs.get("state", "not found")
|
492
|
+
self.server_provides_internal_id_field: bool | None = None
|
493
|
+
self._is_loaded: bool = False
|
494
|
+
|
495
|
+
self.load(force=not _attrs)
|
496
|
+
|
497
|
+
@property
|
498
|
+
def state(self):
|
499
|
+
"""The state of the run. Can be one of: Finished, Failed, Crashed, or Running."""
|
500
|
+
return self._state
|
501
|
+
|
502
|
+
@property
|
503
|
+
def entity(self):
|
504
|
+
"""The entity associated with the run."""
|
505
|
+
return self._entity
|
506
|
+
|
507
|
+
@property
|
508
|
+
def username(self):
|
509
|
+
"""This API is deprecated. Use `entity` instead."""
|
510
|
+
wandb.termwarn("Run.username is deprecated. Please use Run.entity instead.")
|
511
|
+
return self._entity
|
512
|
+
|
513
|
+
@property
|
514
|
+
def storage_id(self):
|
515
|
+
"""The unique storage identifier for the run."""
|
516
|
+
# For compatibility with wandb.Run, which has storage IDs
|
517
|
+
# in self.storage_id and names in self.id.
|
518
|
+
|
519
|
+
return self._attrs.get("id")
|
520
|
+
|
521
|
+
@property
|
522
|
+
def id(self):
|
523
|
+
"""The unique identifier for the run."""
|
524
|
+
return self._attrs.get("name")
|
525
|
+
|
526
|
+
@id.setter
|
527
|
+
def id(self, new_id):
|
528
|
+
"""Set the unique identifier for the run."""
|
529
|
+
attrs = self._attrs
|
530
|
+
attrs["name"] = new_id
|
531
|
+
return new_id
|
532
|
+
|
533
|
+
@property
|
534
|
+
def name(self):
|
535
|
+
"""The name of the run."""
|
536
|
+
return self._attrs.get("displayName")
|
537
|
+
|
538
|
+
@name.setter
|
539
|
+
def name(self, new_name):
|
540
|
+
"""Set the name of the run."""
|
541
|
+
self._attrs["displayName"] = new_name
|
542
|
+
return new_name
|
543
|
+
|
544
|
+
@classmethod
|
545
|
+
def create(
|
546
|
+
cls,
|
547
|
+
api: public.Api,
|
548
|
+
run_id: str | None = None,
|
549
|
+
project: str | None = None,
|
550
|
+
entity: str | None = None,
|
551
|
+
state: Literal["running", "pending"] = "running",
|
552
|
+
):
|
553
|
+
"""Create a run for the given project."""
|
554
|
+
api._sentry.message("Invoking Run.create", level="info")
|
555
|
+
run_id = run_id or runid.generate_id()
|
556
|
+
project = project or api.settings.get("project") or "uncategorized"
|
557
|
+
mutation = gql(
|
558
|
+
"""
|
559
|
+
mutation UpsertBucket($project: String, $entity: String, $name: String!, $state: String) {
|
560
|
+
upsertBucket(input: {modelName: $project, entityName: $entity, name: $name, state: $state}) {
|
561
|
+
bucket {
|
562
|
+
project {
|
563
|
+
name
|
564
|
+
entity { name }
|
565
|
+
}
|
566
|
+
id
|
567
|
+
name
|
568
|
+
}
|
569
|
+
inserted
|
570
|
+
}
|
571
|
+
}
|
572
|
+
"""
|
573
|
+
)
|
574
|
+
variables = {
|
575
|
+
"entity": entity,
|
576
|
+
"project": project,
|
577
|
+
"name": run_id,
|
578
|
+
"state": state,
|
579
|
+
}
|
580
|
+
res = api.client.execute(mutation, variable_values=variables)
|
581
|
+
res = res["upsertBucket"]["bucket"]
|
582
|
+
return Run(
|
583
|
+
api.client,
|
584
|
+
res["project"]["entity"]["name"],
|
585
|
+
res["project"]["name"],
|
586
|
+
res["name"],
|
587
|
+
{
|
588
|
+
"id": res["id"],
|
589
|
+
"config": "{}",
|
590
|
+
"systemMetrics": "{}",
|
591
|
+
"summaryMetrics": "{}",
|
592
|
+
"tags": [],
|
593
|
+
"description": None,
|
594
|
+
"notes": None,
|
595
|
+
"state": state,
|
596
|
+
},
|
597
|
+
)
|
598
|
+
|
599
|
+
def load(self, force=False):
|
600
|
+
if force or not self._attrs:
|
601
|
+
self._is_loaded = False
|
602
|
+
query = gql(f"""#graphql
|
603
|
+
query Run($project: String!, $entity: String!, $name: String!) {{
|
604
|
+
project(name: $project, entityName: $entity) {{
|
605
|
+
run(name: $name) {{
|
606
|
+
{"projectId" if _server_provides_internal_id_for_project(self.client) else ""}
|
607
|
+
...RunFragment
|
608
|
+
}}
|
609
|
+
}}
|
610
|
+
}}
|
611
|
+
{RUN_FRAGMENT}
|
612
|
+
""")
|
613
|
+
|
614
|
+
response = self._exec(query)
|
615
|
+
if (
|
616
|
+
response is None
|
617
|
+
or response.get("project") is None
|
618
|
+
or response["project"].get("run") is None
|
619
|
+
):
|
620
|
+
raise ValueError("Could not find run {}".format(self))
|
621
|
+
self._attrs = response["project"]["run"]
|
622
|
+
|
623
|
+
if self._include_sweeps and self.sweep_name and not self.sweep:
|
624
|
+
# There may be a lot of runs. Don't bother pulling them all
|
625
|
+
# just for the sake of this one.
|
626
|
+
self.sweep = public.Sweep.get(
|
627
|
+
self.client,
|
628
|
+
self.entity,
|
629
|
+
self.project,
|
630
|
+
self.sweep_name,
|
631
|
+
withRuns=False,
|
632
|
+
)
|
633
|
+
|
634
|
+
if not self._is_loaded:
|
635
|
+
self._load_from_attrs()
|
636
|
+
self._is_loaded = True
|
637
|
+
|
638
|
+
return self._attrs
|
639
|
+
|
640
|
+
def _load_from_attrs(self):
|
641
|
+
self._state = self._attrs.get("state", None)
|
642
|
+
self._attrs["config"] = _convert_to_dict(self._attrs.get("config"))
|
643
|
+
self._attrs["summaryMetrics"] = _convert_to_dict(
|
644
|
+
self._attrs.get("summaryMetrics")
|
645
|
+
)
|
646
|
+
self._attrs["systemMetrics"] = _convert_to_dict(
|
647
|
+
self._attrs.get("systemMetrics")
|
648
|
+
)
|
649
|
+
|
650
|
+
if "projectId" in self._attrs:
|
651
|
+
self._project_internal_id = int(self._attrs["projectId"])
|
652
|
+
else:
|
653
|
+
self._project_internal_id = None
|
654
|
+
|
655
|
+
if self._attrs.get("user"):
|
656
|
+
self.user = public.User(self.client, self._attrs["user"])
|
657
|
+
config_user, config_raw = {}, {}
|
658
|
+
for key, value in self._attrs.get("config").items():
|
659
|
+
config = config_raw if key in WANDB_INTERNAL_KEYS else config_user
|
660
|
+
if isinstance(value, dict) and "value" in value:
|
661
|
+
config[key] = value["value"]
|
662
|
+
else:
|
663
|
+
config[key] = value
|
664
|
+
config_raw.update(config_user)
|
665
|
+
self._attrs["config"] = config_user
|
666
|
+
self._attrs["rawconfig"] = config_raw
|
667
|
+
|
668
|
+
@normalize_exceptions
|
669
|
+
def wait_until_finished(self):
|
670
|
+
"""Check the state of the run until it is finished."""
|
671
|
+
query = gql(
|
672
|
+
"""
|
673
|
+
query RunState($project: String!, $entity: String!, $name: String!) {
|
674
|
+
project(name: $project, entityName: $entity) {
|
675
|
+
run(name: $name) {
|
676
|
+
state
|
677
|
+
}
|
678
|
+
}
|
679
|
+
}
|
680
|
+
"""
|
681
|
+
)
|
682
|
+
while True:
|
683
|
+
res = self._exec(query)
|
684
|
+
state = res["project"]["run"]["state"]
|
685
|
+
if state in ["finished", "crashed", "failed"]:
|
686
|
+
self._attrs["state"] = state
|
687
|
+
self._state = state
|
688
|
+
return
|
689
|
+
time.sleep(5)
|
690
|
+
|
691
|
+
@normalize_exceptions
|
692
|
+
def update(self):
|
693
|
+
"""Persist changes to the run object to the wandb backend."""
|
694
|
+
mutation = gql(
|
695
|
+
"""
|
696
|
+
mutation UpsertBucket($id: String!, $description: String, $display_name: String, $notes: String, $tags: [String!], $config: JSONString!, $groupName: String, $jobType: String) {{
|
697
|
+
upsertBucket(input: {{id: $id, description: $description, displayName: $display_name, notes: $notes, tags: $tags, config: $config, groupName: $groupName, jobType: $jobType}}) {{
|
698
|
+
bucket {{
|
699
|
+
...RunFragment
|
700
|
+
}}
|
701
|
+
}}
|
702
|
+
}}
|
703
|
+
{}
|
704
|
+
""".format(RUN_FRAGMENT)
|
705
|
+
)
|
706
|
+
_ = self._exec(
|
707
|
+
mutation,
|
708
|
+
id=self.storage_id,
|
709
|
+
tags=self.tags,
|
710
|
+
description=self.description,
|
711
|
+
notes=self.notes,
|
712
|
+
display_name=self.display_name,
|
713
|
+
config=self.json_config,
|
714
|
+
groupName=self.group,
|
715
|
+
jobType=self.job_type,
|
716
|
+
)
|
717
|
+
self.summary.update()
|
718
|
+
|
719
|
+
@normalize_exceptions
|
720
|
+
def delete(self, delete_artifacts=False):
|
721
|
+
"""Delete the given run from the wandb backend.
|
722
|
+
|
723
|
+
Args:
|
724
|
+
delete_artifacts (bool, optional): Whether to delete the artifacts
|
725
|
+
associated with the run.
|
726
|
+
"""
|
727
|
+
mutation = gql(
|
728
|
+
"""
|
729
|
+
mutation DeleteRun(
|
730
|
+
$id: ID!,
|
731
|
+
{}
|
732
|
+
) {{
|
733
|
+
deleteRun(input: {{
|
734
|
+
id: $id,
|
735
|
+
{}
|
736
|
+
}}) {{
|
737
|
+
clientMutationId
|
738
|
+
}}
|
739
|
+
}}
|
740
|
+
""".format(
|
741
|
+
"$deleteArtifacts: Boolean" if delete_artifacts else "",
|
742
|
+
"deleteArtifacts: $deleteArtifacts" if delete_artifacts else "",
|
743
|
+
)
|
744
|
+
)
|
745
|
+
|
746
|
+
self.client.execute(
|
747
|
+
mutation,
|
748
|
+
variable_values={
|
749
|
+
"id": self.storage_id,
|
750
|
+
"deleteArtifacts": delete_artifacts,
|
751
|
+
},
|
752
|
+
)
|
753
|
+
|
754
|
+
def save(self):
|
755
|
+
"""Persist changes to the run object to the W&B backend."""
|
756
|
+
self.update()
|
757
|
+
|
758
|
+
@property
|
759
|
+
def json_config(self):
|
760
|
+
"""Return the run config as a JSON string.
|
761
|
+
|
762
|
+
<!-- lazydoc-ignore: internal -->
|
763
|
+
"""
|
764
|
+
config = {}
|
765
|
+
if "_wandb" in self.rawconfig:
|
766
|
+
config["_wandb"] = {"value": self.rawconfig["_wandb"], "desc": None}
|
767
|
+
for k, v in self.config.items():
|
768
|
+
config[k] = {"value": v, "desc": None}
|
769
|
+
return json.dumps(config)
|
770
|
+
|
771
|
+
def _exec(self, query, **kwargs):
|
772
|
+
"""Execute a query against the cloud backend."""
|
773
|
+
variables = {"entity": self.entity, "project": self.project, "name": self.id}
|
774
|
+
variables.update(kwargs)
|
775
|
+
return self.client.execute(query, variable_values=variables)
|
776
|
+
|
777
|
+
def _sampled_history(self, keys, x_axis="_step", samples=500):
|
778
|
+
spec = {"keys": [x_axis] + keys, "samples": samples}
|
779
|
+
query = gql(
|
780
|
+
"""
|
781
|
+
query RunSampledHistory($project: String!, $entity: String!, $name: String!, $specs: [JSONString!]!) {
|
782
|
+
project(name: $project, entityName: $entity) {
|
783
|
+
run(name: $name) { sampledHistory(specs: $specs) }
|
784
|
+
}
|
785
|
+
}
|
786
|
+
"""
|
787
|
+
)
|
788
|
+
|
789
|
+
response = self._exec(query, specs=[json.dumps(spec)])
|
790
|
+
# sampledHistory returns one list per spec, we only send one spec
|
791
|
+
return response["project"]["run"]["sampledHistory"][0]
|
792
|
+
|
793
|
+
def _full_history(self, samples=500, stream="default"):
|
794
|
+
node = "history" if stream == "default" else "events"
|
795
|
+
query = gql(
|
796
|
+
"""
|
797
|
+
query RunFullHistory($project: String!, $entity: String!, $name: String!, $samples: Int) {{
|
798
|
+
project(name: $project, entityName: $entity) {{
|
799
|
+
run(name: $name) {{ {}(samples: $samples) }}
|
800
|
+
}}
|
801
|
+
}}
|
802
|
+
""".format(node)
|
803
|
+
)
|
804
|
+
|
805
|
+
response = self._exec(query, samples=samples)
|
806
|
+
return [json.loads(line) for line in response["project"]["run"][node]]
|
807
|
+
|
808
|
+
@normalize_exceptions
|
809
|
+
def files(
|
810
|
+
self,
|
811
|
+
names: list[str] | None = None,
|
812
|
+
pattern: str | None = None,
|
813
|
+
per_page: int = 50,
|
814
|
+
):
|
815
|
+
"""Returns a `Files` object for all files in the run which match the given criteria.
|
816
|
+
|
817
|
+
You can specify a list of exact file names to match, or a pattern to match against.
|
818
|
+
If both are provided, the pattern will be ignored.
|
819
|
+
|
820
|
+
Args:
|
821
|
+
names (list): names of the requested files, if empty returns all files
|
822
|
+
pattern (str, optional): Pattern to match when returning files from W&B.
|
823
|
+
This pattern uses mySQL's LIKE syntax,
|
824
|
+
so matching all files that end with .json would be "%.json".
|
825
|
+
If both names and pattern are provided, a ValueError will be raised.
|
826
|
+
per_page (int): number of results per page.
|
827
|
+
|
828
|
+
Returns:
|
829
|
+
A `Files` object, which is an iterator over `File` objects.
|
830
|
+
"""
|
831
|
+
return public.Files(
|
832
|
+
self.client,
|
833
|
+
self,
|
834
|
+
names or [],
|
835
|
+
pattern=pattern,
|
836
|
+
per_page=per_page,
|
837
|
+
)
|
838
|
+
|
839
|
+
@normalize_exceptions
|
840
|
+
def file(self, name):
|
841
|
+
"""Return the path of a file with a given name in the artifact.
|
842
|
+
|
843
|
+
Args:
|
844
|
+
name (str): name of requested file.
|
845
|
+
|
846
|
+
Returns:
|
847
|
+
A `File` matching the name argument.
|
848
|
+
"""
|
849
|
+
return public.Files(self.client, self, [name])[0]
|
850
|
+
|
851
|
+
@normalize_exceptions
|
852
|
+
def upload_file(self, path, root="."):
|
853
|
+
"""Upload a local file to W&B, associating it with this run.
|
854
|
+
|
855
|
+
Args:
|
856
|
+
path (str): Path to the file to upload. Can be absolute or relative.
|
857
|
+
root (str): The root path to save the file relative to. For example,
|
858
|
+
if you want to have the file saved in the run as "my_dir/file.txt"
|
859
|
+
and you're currently in "my_dir" you would set root to "../".
|
860
|
+
Defaults to current directory (".").
|
861
|
+
|
862
|
+
Returns:
|
863
|
+
A `File` object representing the uploaded file.
|
864
|
+
"""
|
865
|
+
api = InternalApi(
|
866
|
+
default_settings={"entity": self.entity, "project": self.project},
|
867
|
+
retry_timedelta=RETRY_TIMEDELTA,
|
868
|
+
)
|
869
|
+
api.set_current_run_id(self.id)
|
870
|
+
root = os.path.abspath(root)
|
871
|
+
name = os.path.relpath(path, root)
|
872
|
+
upload_path = util.make_file_path_upload_safe(name)
|
873
|
+
with open(os.path.join(root, name), "rb") as f:
|
874
|
+
api.push({LogicalPath(upload_path): f})
|
875
|
+
return public.Files(self.client, self, [name])[0]
|
876
|
+
|
877
|
+
@normalize_exceptions
|
878
|
+
def history(
|
879
|
+
self, samples=500, keys=None, x_axis="_step", pandas=True, stream="default"
|
880
|
+
):
|
881
|
+
"""Return sampled history metrics for a run.
|
882
|
+
|
883
|
+
This is simpler and faster if you are ok with the history records being sampled.
|
884
|
+
|
885
|
+
Args:
|
886
|
+
samples : (int, optional) The number of samples to return
|
887
|
+
pandas : (bool, optional) Return a pandas dataframe
|
888
|
+
keys : (list, optional) Only return metrics for specific keys
|
889
|
+
x_axis : (str, optional) Use this metric as the xAxis defaults to _step
|
890
|
+
stream : (str, optional) "default" for metrics, "system" for machine metrics
|
891
|
+
|
892
|
+
Returns:
|
893
|
+
pandas.DataFrame: If pandas=True returns a `pandas.DataFrame` of history
|
894
|
+
metrics.
|
895
|
+
list of dicts: If pandas=False returns a list of dicts of history metrics.
|
896
|
+
"""
|
897
|
+
if keys is not None and not isinstance(keys, list):
|
898
|
+
wandb.termerror("keys must be specified in a list")
|
899
|
+
return []
|
900
|
+
if keys is not None and len(keys) > 0 and not isinstance(keys[0], str):
|
901
|
+
wandb.termerror("keys argument must be a list of strings")
|
902
|
+
return []
|
903
|
+
|
904
|
+
if keys and stream != "default":
|
905
|
+
wandb.termerror("stream must be default when specifying keys")
|
906
|
+
return []
|
907
|
+
elif keys:
|
908
|
+
lines = self._sampled_history(keys=keys, x_axis=x_axis, samples=samples)
|
909
|
+
else:
|
910
|
+
lines = self._full_history(samples=samples, stream=stream)
|
911
|
+
if pandas:
|
912
|
+
pd = util.get_module("pandas")
|
913
|
+
if pd:
|
914
|
+
lines = pd.DataFrame.from_records(lines)
|
915
|
+
else:
|
916
|
+
wandb.termwarn("Unable to load pandas, call history with pandas=False")
|
917
|
+
return lines
|
918
|
+
|
919
|
+
@normalize_exceptions
|
920
|
+
def scan_history(self, keys=None, page_size=1000, min_step=None, max_step=None):
|
921
|
+
"""Returns an iterable collection of all history records for a run.
|
922
|
+
|
923
|
+
Args:
|
924
|
+
keys ([str], optional): only fetch these keys, and only fetch rows that have all of keys defined.
|
925
|
+
page_size (int, optional): size of pages to fetch from the api.
|
926
|
+
min_step (int, optional): the minimum number of pages to scan at a time.
|
927
|
+
max_step (int, optional): the maximum number of pages to scan at a time.
|
928
|
+
|
929
|
+
Returns:
|
930
|
+
An iterable collection over history records (dict).
|
931
|
+
|
932
|
+
Example:
|
933
|
+
Export all the loss values for an example run
|
934
|
+
|
935
|
+
```python
|
936
|
+
run = api.run("entity/project-name/run-id")
|
937
|
+
history = run.scan_history(keys=["Loss"])
|
938
|
+
losses = [row["Loss"] for row in history]
|
939
|
+
```
|
940
|
+
"""
|
941
|
+
if keys is not None and not isinstance(keys, list):
|
942
|
+
wandb.termerror("keys must be specified in a list")
|
943
|
+
return []
|
944
|
+
if keys is not None and len(keys) > 0 and not isinstance(keys[0], str):
|
945
|
+
wandb.termerror("keys argument must be a list of strings")
|
946
|
+
return []
|
947
|
+
|
948
|
+
last_step = self.lastHistoryStep
|
949
|
+
# set defaults for min/max step
|
950
|
+
if min_step is None:
|
951
|
+
min_step = 0
|
952
|
+
if max_step is None:
|
953
|
+
max_step = last_step + 1
|
954
|
+
# if the max step is past the actual last step, clamp it down
|
955
|
+
if max_step > last_step:
|
956
|
+
max_step = last_step + 1
|
957
|
+
if keys is None:
|
958
|
+
return public.HistoryScan(
|
959
|
+
run=self,
|
960
|
+
client=self.client,
|
961
|
+
page_size=page_size,
|
962
|
+
min_step=min_step,
|
963
|
+
max_step=max_step,
|
964
|
+
)
|
965
|
+
else:
|
966
|
+
return public.SampledHistoryScan(
|
967
|
+
run=self,
|
968
|
+
client=self.client,
|
969
|
+
keys=keys,
|
970
|
+
page_size=page_size,
|
971
|
+
min_step=min_step,
|
972
|
+
max_step=max_step,
|
973
|
+
)
|
974
|
+
|
975
|
+
@normalize_exceptions
|
976
|
+
def logged_artifacts(self, per_page: int = 100) -> public.RunArtifacts:
|
977
|
+
"""Fetches all artifacts logged by this run.
|
978
|
+
|
979
|
+
Retrieves all output artifacts that were logged during the run. Returns a
|
980
|
+
paginated result that can be iterated over or collected into a single list.
|
981
|
+
|
982
|
+
Args:
|
983
|
+
per_page: Number of artifacts to fetch per API request.
|
984
|
+
|
985
|
+
Returns:
|
986
|
+
An iterable collection of all Artifact objects logged as outputs during this run.
|
987
|
+
|
988
|
+
Example:
|
989
|
+
```python
|
990
|
+
import wandb
|
991
|
+
import tempfile
|
992
|
+
|
993
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as tmp:
|
994
|
+
tmp.write("This is a test artifact")
|
995
|
+
tmp_path = tmp.name
|
996
|
+
run = wandb.init(project="artifact-example")
|
997
|
+
artifact = wandb.Artifact("test_artifact", type="dataset")
|
998
|
+
artifact.add_file(tmp_path)
|
999
|
+
run.log_artifact(artifact)
|
1000
|
+
run.finish()
|
1001
|
+
|
1002
|
+
api = wandb.Api()
|
1003
|
+
|
1004
|
+
finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
|
1005
|
+
|
1006
|
+
for logged_artifact in finished_run.logged_artifacts():
|
1007
|
+
print(logged_artifact.name)
|
1008
|
+
```
|
1009
|
+
|
1010
|
+
"""
|
1011
|
+
return public.RunArtifacts(self.client, self, mode="logged", per_page=per_page)
|
1012
|
+
|
1013
|
+
@normalize_exceptions
|
1014
|
+
def used_artifacts(self, per_page: int = 100) -> public.RunArtifacts:
|
1015
|
+
"""Fetches artifacts explicitly used by this run.
|
1016
|
+
|
1017
|
+
Retrieves only the input artifacts that were explicitly declared as used
|
1018
|
+
during the run, typically via `run.use_artifact()`. Returns a paginated
|
1019
|
+
result that can be iterated over or collected into a single list.
|
1020
|
+
|
1021
|
+
Args:
|
1022
|
+
per_page: Number of artifacts to fetch per API request.
|
1023
|
+
|
1024
|
+
Returns:
|
1025
|
+
An iterable collection of Artifact objects explicitly used as inputs in this run.
|
1026
|
+
|
1027
|
+
Example:
|
1028
|
+
```python
|
1029
|
+
import wandb
|
1030
|
+
|
1031
|
+
run = wandb.init(project="artifact-example")
|
1032
|
+
run.use_artifact("test_artifact:latest")
|
1033
|
+
run.finish()
|
1034
|
+
|
1035
|
+
api = wandb.Api()
|
1036
|
+
finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
|
1037
|
+
for used_artifact in finished_run.used_artifacts():
|
1038
|
+
print(used_artifact.name)
|
1039
|
+
test_artifact
|
1040
|
+
```
|
1041
|
+
"""
|
1042
|
+
return public.RunArtifacts(self.client, self, mode="used", per_page=per_page)
|
1043
|
+
|
1044
|
+
@normalize_exceptions
|
1045
|
+
def use_artifact(self, artifact, use_as=None):
|
1046
|
+
"""Declare an artifact as an input to a run.
|
1047
|
+
|
1048
|
+
Args:
|
1049
|
+
artifact (`Artifact`): An artifact returned from
|
1050
|
+
`wandb.Api().artifact(name)`
|
1051
|
+
use_as (string, optional): A string identifying
|
1052
|
+
how the artifact is used in the script. Used
|
1053
|
+
to easily differentiate artifacts used in a
|
1054
|
+
run, when using the beta wandb launch
|
1055
|
+
feature's artifact swapping functionality.
|
1056
|
+
|
1057
|
+
Returns:
|
1058
|
+
An `Artifact` object.
|
1059
|
+
"""
|
1060
|
+
api = InternalApi(
|
1061
|
+
default_settings={"entity": self.entity, "project": self.project},
|
1062
|
+
retry_timedelta=RETRY_TIMEDELTA,
|
1063
|
+
)
|
1064
|
+
api.set_current_run_id(self.id)
|
1065
|
+
|
1066
|
+
if isinstance(artifact, wandb.Artifact) and not artifact.is_draft():
|
1067
|
+
api.use_artifact(
|
1068
|
+
artifact.id,
|
1069
|
+
use_as=use_as or artifact.name,
|
1070
|
+
artifact_entity_name=artifact.entity,
|
1071
|
+
artifact_project_name=artifact.project,
|
1072
|
+
)
|
1073
|
+
return artifact
|
1074
|
+
elif isinstance(artifact, wandb.Artifact) and artifact.is_draft():
|
1075
|
+
raise ValueError(
|
1076
|
+
"Only existing artifacts are accepted by this api. "
|
1077
|
+
"Manually create one with `wandb artifact put`"
|
1078
|
+
)
|
1079
|
+
else:
|
1080
|
+
raise ValueError("You must pass a wandb.Api().artifact() to use_artifact")
|
1081
|
+
|
1082
|
+
@normalize_exceptions
|
1083
|
+
def log_artifact(
|
1084
|
+
self,
|
1085
|
+
artifact: wandb.Artifact,
|
1086
|
+
aliases: Collection[str] | None = None,
|
1087
|
+
tags: Collection[str] | None = None,
|
1088
|
+
):
|
1089
|
+
"""Declare an artifact as output of a run.
|
1090
|
+
|
1091
|
+
Args:
|
1092
|
+
artifact (`Artifact`): An artifact returned from
|
1093
|
+
`wandb.Api().artifact(name)`.
|
1094
|
+
aliases (list, optional): Aliases to apply to this artifact.
|
1095
|
+
tags: (list, optional) Tags to apply to this artifact, if any.
|
1096
|
+
|
1097
|
+
Returns:
|
1098
|
+
A `Artifact` object.
|
1099
|
+
"""
|
1100
|
+
api = InternalApi(
|
1101
|
+
default_settings={"entity": self.entity, "project": self.project},
|
1102
|
+
retry_timedelta=RETRY_TIMEDELTA,
|
1103
|
+
)
|
1104
|
+
api.set_current_run_id(self.id)
|
1105
|
+
|
1106
|
+
if not isinstance(artifact, wandb.Artifact):
|
1107
|
+
raise TypeError("You must pass a wandb.Api().artifact() to use_artifact")
|
1108
|
+
if artifact.is_draft():
|
1109
|
+
raise ValueError(
|
1110
|
+
"Only existing artifacts are accepted by this api. "
|
1111
|
+
"Manually create one with `wandb artifact put`"
|
1112
|
+
)
|
1113
|
+
if (
|
1114
|
+
self.entity != artifact.source_entity
|
1115
|
+
or self.project != artifact.source_project
|
1116
|
+
):
|
1117
|
+
raise ValueError("A run can't log an artifact to a different project.")
|
1118
|
+
|
1119
|
+
artifact_collection_name = artifact.source_name.split(":")[0]
|
1120
|
+
api.create_artifact(
|
1121
|
+
artifact.type,
|
1122
|
+
artifact_collection_name,
|
1123
|
+
artifact.digest,
|
1124
|
+
aliases=aliases,
|
1125
|
+
tags=tags,
|
1126
|
+
)
|
1127
|
+
return artifact
|
1128
|
+
|
1129
|
+
@property
|
1130
|
+
def summary(self):
|
1131
|
+
"""A mutable dict-like property that holds summary values associated with the run."""
|
1132
|
+
if self._summary is None:
|
1133
|
+
from wandb.old.summary import HTTPSummary
|
1134
|
+
|
1135
|
+
# TODO: fix the outdir issue
|
1136
|
+
self._summary = HTTPSummary(self, self.client, summary=self.summary_metrics)
|
1137
|
+
return self._summary
|
1138
|
+
|
1139
|
+
@property
|
1140
|
+
def path(self):
|
1141
|
+
"""The path of the run. The path is a list containing the entity, project, and run_id."""
|
1142
|
+
return [
|
1143
|
+
urllib.parse.quote_plus(str(self.entity)),
|
1144
|
+
urllib.parse.quote_plus(str(self.project)),
|
1145
|
+
urllib.parse.quote_plus(str(self.id)),
|
1146
|
+
]
|
1147
|
+
|
1148
|
+
@property
|
1149
|
+
def url(self):
|
1150
|
+
"""The URL of the run.
|
1151
|
+
|
1152
|
+
The run URL is generated from the entity, project, and run_id. For
|
1153
|
+
SaaS users, it takes the form of `https://wandb.ai/entity/project/run_id`.
|
1154
|
+
"""
|
1155
|
+
path = self.path
|
1156
|
+
path.insert(2, "runs")
|
1157
|
+
return self.client.app_url + "/".join(path)
|
1158
|
+
|
1159
|
+
@property
|
1160
|
+
def metadata(self):
|
1161
|
+
"""Metadata about the run from wandb-metadata.json.
|
1162
|
+
|
1163
|
+
Metadata includes the run's description, tags, start time, memory
|
1164
|
+
usage and more.
|
1165
|
+
"""
|
1166
|
+
if self._metadata is None:
|
1167
|
+
try:
|
1168
|
+
f = self.file("wandb-metadata.json")
|
1169
|
+
session = self.client._client.transport.session
|
1170
|
+
response = session.get(f.url, timeout=5)
|
1171
|
+
response.raise_for_status()
|
1172
|
+
contents = response.content
|
1173
|
+
self._metadata = json_util.loads(contents)
|
1174
|
+
except: # noqa: E722
|
1175
|
+
# file doesn't exist, or can't be downloaded, or can't be parsed
|
1176
|
+
pass
|
1177
|
+
return self._metadata
|
1178
|
+
|
1179
|
+
@property
|
1180
|
+
def lastHistoryStep(self): # noqa: N802
|
1181
|
+
"""Returns the last step logged in the run's history."""
|
1182
|
+
query = gql(
|
1183
|
+
"""
|
1184
|
+
query RunHistoryKeys($project: String!, $entity: String!, $name: String!) {
|
1185
|
+
project(name: $project, entityName: $entity) {
|
1186
|
+
run(name: $name) { historyKeys }
|
1187
|
+
}
|
1188
|
+
}
|
1189
|
+
"""
|
1190
|
+
)
|
1191
|
+
response = self._exec(query)
|
1192
|
+
if (
|
1193
|
+
response is None
|
1194
|
+
or response.get("project") is None
|
1195
|
+
or response["project"].get("run") is None
|
1196
|
+
or response["project"]["run"].get("historyKeys") is None
|
1197
|
+
):
|
1198
|
+
return -1
|
1199
|
+
history_keys = response["project"]["run"]["historyKeys"]
|
1200
|
+
return history_keys["lastStep"] if "lastStep" in history_keys else -1
|
1201
|
+
|
1202
|
+
def to_html(self, height=420, hidden=False):
|
1203
|
+
"""Generate HTML containing an iframe displaying this run."""
|
1204
|
+
url = self.url + "?jupyter=true"
|
1205
|
+
style = f"border:none;width:100%;height:{height}px;"
|
1206
|
+
prefix = ""
|
1207
|
+
if hidden:
|
1208
|
+
style += "display:none;"
|
1209
|
+
prefix = ipython.toggle_button()
|
1210
|
+
return prefix + f"<iframe src={url!r} style={style!r}></iframe>"
|
1211
|
+
|
1212
|
+
def _repr_html_(self) -> str:
|
1213
|
+
return self.to_html()
|
1214
|
+
|
1215
|
+
def __repr__(self):
|
1216
|
+
return "<Run {} ({})>".format("/".join(self.path), self.state)
|