Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

XGBoost-1.7 container not working with feature attribution "explain" #4374

Open
daniel-furman opened this issue Sep 10, 2024 · 0 comments
Open
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@daniel-furman
Copy link

daniel-furman commented Sep 10, 2024

Environment details

https://cloud.google.com/vertex-ai/docs/predictions/pre-built-containers#xgboost

XGBoost 1.7 not working with .explain. Running the same deployment code with 1.6, however, does work. Since the "End of availability" date for <=1.6 is fast approaching (Nov 2024), I am wondering if this will be patched and/or if the availability date for 1.6 could be extended.

Steps to reproduce

  1. Train an XGBoost classifier
  2. Deploy it with feature explanations turned on to 1.7/1.6
  3. 1.6 will work, 1.7 will err with this message:
InvalidArgument: 400 {"error": "b'{\"detail\":\"Unsupported content type of the request: application/x-www-form-urlencoded.\\\\nCurrently supported content-type in DefaultSerializer: \\\\\"application/json\\\\\".\"}'"}

Code example to reproduce error

from google.cloud import aiplatform
from google.cloud.aiplatform_v1.types import SampledShapleyAttribution
from google.cloud.aiplatform_v1.types.explanation import ExplanationParameters

exp_metadata = aiplatform.explain.ExplanationMetadata(
    inputs={"features": {}},
    outputs={"score": {}},
)

exp_parameters = ExplanationParameters(
    sampled_shapley_attribution=SampledShapleyAttribution(path_count=5)
)

# Register model
model = aiplatform.Model.upload(
    display_name=model_display_name, 
    artifact_uri=f'gs://{bucket_name}/model',
    serving_container_image_uri='us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-7:latest',  # swap 1-7 for 1-6 to test difference
    explanation_metadata=exp_metadata,
    explanation_parameters=exp_parameters,
)

# Deploy model to endpoint
endpoint = aiplatform.Endpoint.create(
    display_name=display_name
)
model.deploy(
    endpoint=endpoint,
    deployed_model_display_name=deployed_model_display_name,
    machine_type='n1-standard-2',
    min_replica_count=1,
    max_replica_count=2,
)
@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

1 participant