Skip to content

Wrong types on MlTrainedModelInferenceStats and MlTrainedModelDeploymentStats #2762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
svalbuena opened this issue Aug 2, 2024 · 0 comments · Fixed by #2763
Closed

Wrong types on MlTrainedModelInferenceStats and MlTrainedModelDeploymentStats #2762

svalbuena opened this issue Aug 2, 2024 · 0 comments · Fixed by #2763

Comments

@svalbuena
Copy link
Contributor

svalbuena commented Aug 2, 2024

🐛 Wrong type

The _ml/trained_models/<model_id>/_stats fails when deserializing the response. In a previous issue I reported and fixed another wrong type in the types of this response, but there are a couple more left. These types cause a deserialization error in the .NET client.

The timestamp field of MlTrainedModelInferenceStats needs to be a long:

export interface MlTrainedModelInferenceStats {
  cache_miss_count: integer
  failure_count: integer
  inference_count: integer
  missing_all_fields_count: integer
- timestamp: DateTime
+ timestamp: EpochTime<UnitMillis>
}

The nodes field of MlTrainedModelDeploymentStatsneeds to be an array:

export interface MlTrainedModelDeploymentStats {
  allocation_status: MlTrainedModelDeploymentAllocationStatus
  cache_size?: ByteSize
  deployment_id: Id
  error_count: integer
  inference_count: integer
  model_id: Id
- nodes: MlTrainedModelDeploymentNodesStats
+ nodes: MlTrainedModelDeploymentNodesStats[]
  number_of_allocations: integer
  queue_capacity: integer
  rejected_execution_count: integer
  reason: string
  start_time: EpochTime<UnitMillis>
  state: MlDeploymentState
  threads_per_allocation: integer
  timeout_count: integer
}

Sample response of GET http://localhost:9200/_ml/trained_models/intfloat__e5-small-v2/_stats

{
    "count": 1,
    "trained_model_stats": [
        {
            "model_id": "intfloat__e5-small-v2",
            "model_size_stats": {
                "model_size_bytes": 132921240,
                "required_native_memory_bytes": 734682164
            },
            "pipeline_count": 1,
            "ingest": {
                "total": {
                    "count": 0,
                    "time_in_millis": 0,
                    "current": 0,
                    "failed": 0
                },
                "pipelines": {
                    "custom_embedding": {
                        "count": 0,
                        "time_in_millis": 0,
                        "current": 0,
                        "failed": 0,
                        "processors": [
                            {
                                "script": {
                                    "type": "script",
                                    "stats": {
                                        "count": 0,
                                        "time_in_millis": 0,
                                        "current": 0,
                                        "failed": 0
                                    }
                                }
                            },
                            {
                                "foreach": {
                                    "type": "foreach",
                                    "stats": {
                                        "count": 0,
                                        "time_in_millis": 0,
                                        "current": 0,
                                        "failed": 0
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            "inference_stats": {
                "failure_count": 0,
                "inference_count": 13,
                "cache_miss_count": 0,
                "missing_all_fields_count": 0,
                "timestamp": 1722591230386
            },
            "deployment_stats": {
                "deployment_id": "intfloat__e5-small-v2",
                "model_id": "intfloat__e5-small-v2",
                "threads_per_allocation": 1,
                "number_of_allocations": 1,
                "queue_capacity": 1024,
                "state": "started",
                "allocation_status": {
                    "allocation_count": 1,
                    "target_allocation_count": 1,
                    "state": "fully_allocated"
                },
                "cache_size": "126.7mb",
                "priority": "normal",
                "start_time": 1722254553506,
                "inference_count": 13,
                "peak_throughput_per_minute": 5,
                "nodes": [
                    {
                        "node": {
                            "u8L8FqPtSb-eBsbz3yroew": {
                                "name": "d2acd1f5a58c",
                                "ephemeral_id": "q6hDvPcpQJaab7lSOE4sZw",
                                "transport_address": "172.18.0.2:9300",
                                "external_id": "d2acd1f5a58c",
                                "attributes": {
                                    "ml.max_jvm_size": "1073741824",
                                    "ml.allocated_processors_double": "16.0",
                                    "ml.allocated_processors": "16",
                                    "ml.machine_memory": "56860405760",
                                    "transform.config_version": "10.0.0",
                                    "xpack.installed": "true",
                                    "ml.config_version": "12.0.0"
                                },
                                "roles": [
                                    "data",
                                    "data_cold",
                                    "data_content",
                                    "data_frozen",
                                    "data_hot",
                                    "data_warm",
                                    "ingest",
                                    "master",
                                    "ml",
                                    "remote_cluster_client",
                                    "transform"
                                ],
                                "version": "8.12.0",
                                "min_index_version": 7000099,
                                "max_index_version": 8500008
                            }
                        },
                        "routing_state": {
                            "routing_state": "started"
                        },
                        "inference_count": 13,
                        "average_inference_time_ms": 14.615384615384615,
                        "average_inference_time_ms_excluding_cache_hits": 95,
                        "inference_cache_hit_count": 11,
                        "last_access": 1722591142606,
                        "number_of_pending_requests": 0,
                        "start_time": 1722588669854,
                        "threads_per_allocation": 1,
                        "number_of_allocations": 1,
                        "peak_throughput_per_minute": 5,
                        "throughput_last_minute": 2,
                        "average_inference_time_ms_last_minute": 0,
                        "inference_cache_hit_count_last_minute": 2
                    }
                ]
            }
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant