- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Open
Labels
component: trainingRelates to the SageMaker Training PlatformRelates to the SageMaker Training Platformtype: bug
Description
Describe the bug
The hyperparameters in XGBoost are incorrectly json-dumped with extra quotes which causes the validation to fail.
To reproduce
sample code
from sagemaker.xgboost.estimator import XGBoost
params = {
    "objective": "reg:squarederror",
    "num_round": 100,
    "max_depth": 5,
    "eta": 0.1,
    "subsample": 0.8,
}
xgb = XGBoost(
    entry_point=None,  # using built-in algorithm mode
    hyperparameters=params,
    framework_version="1.7-1",
    instance_type="ml.m5.xlarge",
    instance_count=1,
    role=role,
    output_path=f"s3://{bucket}/{prefix}/output",
)
print(xgb._hyperparameters)
print(xgb.hyperparameters())will print out
{'objective': 'reg:squarederror', 'num_round': 100, 'max_depth': 5, 'eta': 0.1, 'subsample': 0.8}
{'objective': '"reg:squarederror"', 'num_round': '100', 'max_depth': '5', 'eta': '0.1', 'subsample': '0.8'}
Later at the xbg.fit stage, the training failure:
sagemaker_algorithm_toolkit.exceptions.UserError: Hyperparameter objective: "reg:squarederror" is not in ['aft_loss_distribution', 'binary:logistic', 'binary:logitraw', 'binary:hinge', 'count:poisson', 'multi:softmax', 'multi:softprob', 'rank:pairwise', 'rank:ndcg', 'rank:map', 'reg:linear', 'reg:squarederror', 'reg:logistic', 'reg:gamma', 'reg:pseudohubererror', 'reg:squaredlogerror', 'reg:absoluteerror', 'reg:tweedie', 'survival:aft', 'survival:cox']
Expected behavior
xgb.hyperparameters() should not produce the extra-double-quoted '"reg:squarederror"'. Instead, it should be just 'reg:squarederror'
Screenshots or logs
N/A
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 
2.252.0 - Framework name (eg. PyTorch) or algorithm (eg. KMeans): 
XGBoost - Framework version: 
sagemaker-xgboost:1.7-1 
Metadata
Metadata
Assignees
Labels
component: trainingRelates to the SageMaker Training PlatformRelates to the SageMaker Training Platformtype: bug