aws / sagemaker-core

Apache License 2.0
5 stars 3 forks source link

Resource Chaining - AttributeError: 'dict' object has no attribute '__dict__' #16

Closed benieric closed 4 months ago

benieric commented 4 months ago

Description Getting error message like below in resource chaining flow when creating TrainingJob without resource chaining:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/var/folders/2s/7lzvylzj7qn0s37k6q5pyx140000gr/T/ipykernel_5460/2324256432.py](https://file+.vscode-resource.vscode-cdn.net/var/folders/2s/7lzvylzj7qn0s37k6q5pyx140000gr/T/ipykernel_5460/2324256432.py) in ?()
      5     OutputDataConfig, ResourceConfig, StoppingCondition
      6 
      7 job_name_v3 = 'xgboost-iris-' + time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
      8 
----> 9 training_job = TrainingJob.create(
     10     training_job_name=job_name_v3,
     11     hyper_parameters={
     12         'objective': 'multi:softmax',

[/Volumes/workplace/sagemaker-core/end_user_experience/../src/generated/resources.py](https://file+.vscode-resource.vscode-cdn.net/Volumes/workplace/sagemaker-core/src/generated/resources.py) in ?(*args, **kwargs)
   9522               "type": "string"
   9523             }
   9524           }
   9525         }
-> 9526             return create_func(*args, **Base.get_updated_kwargs_with_configured_attributes(config_schema_for_resource, "TrainingJob", **kwargs))

[/Volumes/workplace/sagemaker-core/end_user_experience/../src/generated/resources.py](https://file+.vscode-resource.vscode-cdn.net/Volumes/workplace/sagemaker-core/src/generated/resources.py) in ?(cls, training_job_name, algorithm_specification, role_arn, output_data_config, resource_config, stopping_condition, hyper_parameters, input_data_config, vpc_config, tags, enable_network_isolation, enable_inter_container_traffic_encryption, enable_managed_spot_training, checkpoint_config, debug_hook_config, debug_rule_configurations, tensor_board_output_config, experiment_config, profiler_config, profiler_rule_configurations, environment, retry_strategy, remote_debug_config, infra_check_config, session, region)
   9586             'RemoteDebugConfig': remote_debug_config,
   9587             'InfraCheckConfig': infra_check_config,
   9588         }
   9589 
-> 9590         operation_input_args = Base.populate_chained_attributes(resource_name='TrainingJob', operation_input_args=operation_input_args)
...
--> 105                 obj_dict = {snake_to_pascal(k): v for k, v in value.__dict__.items()}
    106                 updated_args[arg] = Base.populate_chained_attributes(resource_name=type(value).__name__, operation_input_args=obj_dict)
    107         return updated_args

AttributeError: 'dict' object has no attribute '__dict__'

Reproduce Run example notebook until this cell: https://github.com/aws/sagemaker-core/blob/main/end_user_experience/xgboost_training_demo.ipynb?short_path=db07d72#L225

benieric commented 4 months ago

Merged is fixed