Skip to content

Can not compile an XGBoost 1.0 model #1616

Closed

Description

@NukaCody

Is your feature request related to a problem? Please describe.
Can not compile an XGBoost model with version 1.0. I've been able to do it with previous versions but it breaks once you updgrade to a stable 1.0 branch

Describe the solution you'd like

compiled_model = xgb_estimator.compile_model(
    target_instance_family = "ml_m5",
    role = sage_exec,
    input_shape = {'data': [1, 64]},
    output_path = xgb_estimator.output_path,
    framework = "xgboost",
    framework_version = "1.0"
)

Should compile a 1.0 XGboost model when the model was trained with

container = get_image_uri(region, 'xgboost', repo_version='1.0-1')

xgb_estimator = Estimator(
    container,
    role = sage_exec,
    sagemaker_session = session,
    input_mode = 'File',
    output_path = f"s3://{bucket}{prefix}/output",
    
    train_instance_count = 2,
    train_instance_type = 'ml.m5.2xlarge',
    
    train_use_spot_instances = True,
    train_max_run = 300,
    train_max_wait = 600,
)

xgb_estimator.fit(s3_data)

Describe alternatives you've considered
None

Additional context
Trying to compile with what's above returns:

ClientError: InputConfiguration: Invalid XGBoost model. Please make sure the framework you select is correct. local variable 'model_objects' referenced before assignment

Activity

  1. ajaykarpur commented on Jun 23, 2020

    @ajaykarpur
    Contributor

    Hi @codypenta, thanks for bringing this to our attention. Can you please provide the following information?

    • The version of the SageMaker Python SDK you're using. (You can check this using sagemaker.__version__.)
    • The previous version of XGBoost that you used to successfully compile a model.
    • Any other information from the bug report issue template that you think may be relevant.
  2. NukaCody commented on Jun 23, 2020

    @NukaCody
    Author

    Hope this helps:
    Sagemaker Version: 1.60.0
    Python Version: 3

    What's worked previously

    container = get_image_uri(region, 'xgboost', repo_version='0.90-2')
    compiled_model = xgb.compile_model(
        target_instance_family = "ml_m5",
        role = sagemaker.get_execution_role(),
        input_shape = {'data': [1, 64]},
        output_path = f"{xgb.output_path}/compiled",
        framework = "xgboost",
        framework_version = "0.90-2"
    )

    I've tried 1.0 and 1.0-1 for framework version but they both returned the same error

  3. NukaCody commented on Jul 8, 2020

    @NukaCody
    Author

    Update:

    I tried taking the model artifiact produced from:

    container = get_image_uri(region, 'xgboost', repo_version='1.0-1')
    
    xgb_estimator = Estimator(
        container,
        role = sage_exec,
        sagemaker_session = session,
        input_mode = 'File',
        output_path = f"s3://{bucket}{prefix}/output",
        
        train_instance_count = 2,
        train_instance_type = 'ml.m5.2xlarge',
        
        train_use_spot_instances = True,
        train_max_run = 300,
        train_max_wait = 600,
    )
    
    xgb_estimator.fit(s3_data)

    And manually compiling it through the console. The same error exist. ClientError: InputConfiguration: Invalid XGBoost model. Please make sure the framework you select is correct. local variable 'model_objects' referenced before assignment

  4. akozd commented on Oct 28, 2020

    @akozd
    Contributor

    Same issue for me here. Error I'm seeing for 1.0-1:

    ClientError: InputConfiguration: Treelite failed to convert XGBoost model. Please make sure the framework you select is correct. std::bad_alloc

    boto3 call:

    response = sm.create_compilation_job(
        CompilationJobName=job_name,
        RoleArn=get_execution_role(),
        InputConfig={
            'S3Uri': model_path,
            'DataInputConfig': '{"data":[1,10]}',
            'Framework': 'XGBOOST'
        },
        OutputConfig={
            'S3OutputLocation': output_path,
            'TargetDevice': 'ml_m5'
        },
        StoppingCondition={
            'MaxRuntimeInSeconds':3600,
            'MaxWaitTimeInSeconds': 3600
        }
    )
  5. coverton-usgs commented on Feb 27, 2021

    @coverton-usgs

    I'm not sure if this relates but,...

    I'm encountered the same error with sagemaker 2.26.0 when I accidentally loaded:
    retrieve(framework="xgboost", region=region, version='latest')
    which is discouraged according to the AWS documentation

    when loading a specific container:
    retrieve(framework="xgboost", region=region, version='1.2-1')

    it worked just fine

  6. locked and limited conversation to collaborators on May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions