smlambdaworkshop icon indicating copy to clipboard operation
smlambdaworkshop copied to clipboard

Training Notebook Errors with: AttributeError: 'float' object has no attribute 'split

Open tlelson opened this issue 5 years ago • 0 comments

Running the following cell in sms_spam_classifier_mxnet.ipynb notebook errors:

from sagemaker.mxnet import MXNet

output_path = 's3://{0}/{1}/output'.format(bucket_name, bucket_key_prefix)
code_location = 's3://{0}/{1}/code'.format(bucket_name, bucket_key_prefix)

m = MXNet('sms_spam_classifier_mxnet_script.py',
          role=role,
          train_instance_count=1,
          train_instance_type='ml.c5.2xlarge',
          output_path=output_path,
          base_job_name='sms-spam-classifier-mxnet',
          framework_version=1.2,
          code_location = code_location,
          hyperparameters={'batch_size': 100,
                         'epochs': 20,
                         'learning_rate': 0.01})

inputs = {'train': 's3://{0}/{1}/train/'.format(bucket_name, bucket_key_prefix),
 'val': 's3://{0}/{1}/val/'.format(bucket_name, bucket_key_prefix)}

m.fit(inputs)

StackTrace:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-27-90d8dd94a897> in <module>()
     19  'val': 's3://{0}/{1}/val/'.format(bucket_name, bucket_key_prefix)}
     20 
---> 21 m.fit(inputs)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/estimator.py in fit(self, inputs, wait, logs, job_name)
    327         self._prepare_for_training(job_name=job_name)
    328 
--> 329         self.latest_training_job = _TrainingJob.start_new(self, inputs)
    330         if wait:
    331             self.latest_training_job.wait(logs=logs)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/estimator.py in start_new(cls, estimator, inputs)
    825             train_args["algorithm_arn"] = estimator.algorithm_arn
    826         else:
--> 827             train_args["image"] = estimator.train_image()
    828 
    829         cls._add_spot_checkpoint_args(local_mode, estimator, train_args)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/estimator.py in train_image(self)
   1538             self.train_instance_type,
   1539             self.framework_version,  # pylint: disable=no-member
-> 1540             py_version=self.py_version,  # pylint: disable=no-member
   1541         )
   1542 

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/fw_utils.py in create_image_uri(region, framework, instance_type, framework_version, py_version, account, accelerator_type, optimized_families)
    195         account=account,
    196         accelerator_type=accelerator_type,
--> 197         framework_version=framework_version,
    198     )
    199 

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/fw_utils.py in _registry_id(region, framework, py_version, account, accelerator_type, framework_version)
    146         framework_version:
    147     """
--> 148     if _using_merged_images(region, framework, py_version, accelerator_type, framework_version):
    149         if region in ASIMOV_OPT_IN_ACCOUNTS_BY_REGION:
    150             return ASIMOV_OPT_IN_ACCOUNTS_BY_REGION.get(region)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/fw_utils.py in _using_merged_images(region, framework, py_version, accelerator_type, framework_version)
    113     is_gov_region = region in VALID_ACCOUNTS_BY_REGION
    114     is_py3 = py_version == "py3" or py_version is None
--> 115     is_merged_versions = _is_merged_versions(framework, framework_version)
    116     return (
    117         (not is_gov_region)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/fw_utils.py in _is_merged_versions(framework, framework_version)
     98     lowest_version_list = MERGED_FRAMEWORKS_LOWEST_VERSIONS.get(framework)
     99     if lowest_version_list:
--> 100         return is_version_equal_or_higher(lowest_version_list, framework_version)
    101     return False
    102 

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/sagemaker/fw_utils.py in is_version_equal_or_higher(lowest_version, framework_version)
     86         lowest_version
     87     """
---> 88     version_list = [int(s) for s in framework_version.split(".")]
     89     return version_list >= lowest_version[0 : len(version_list)]
     90 

AttributeError: 'float' object has no attribute 'split'

tlelson avatar Sep 23 '19 03:09 tlelson