FileNotFoundError: [Errno 2] No such file or directory: '/home/ec2-user/anaconda3/envs/python3/lib/python3.8/site-packages/sagemaker/image_uri_config/catboost.json'

0

I have an issue while getting Catboost image URI. It is a function for generating ECR image URIs for pre-built SageMaker Docker images. Here is my code catboost_container = sagemaker.image_uris.retrieve("catboost", my_region, "latest")

2 Answers
1
Accepted Answer

As illustrated here in the docs for the algorithm, the parameters for retrieving this URI are a bit different: It's more like using the new JumpStart models (if you're familiar with that) than the old-style pre-built algorithms.

train_model_id, train_model_version, train_scope = "catboost-classification-model", "*", "training"
training_instance_type = "ml.m5.xlarge"

# Retrieve the docker image
train_image_uri = image_uris.retrieve(
    region=None,
    framework=None,
    model_id=train_model_id,
    model_version=train_model_version,
    image_scope=train_scope,
    instance_type=training_instance_type
)

I tested the above snippet from the doc page on SageMaker Studio and it worked OK. If you still see errors, it's likely your SageMaker Python SDK version is outdated (which can happen if for example you don't restart SM Studio apps or SM Notebook Instances regularly). Can check with sagemaker.__version__ and upgrade with !pip install --upgrade sagemaker if needed.

AWS
EXPERT
Alex_T
answered 2 years ago
  • Thank you Alex for the suggestion as you suggest I used image_uris.retrieve and according to the below link : https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/lightgbm_catboost_tabular/Amazon_Tabular_Classification_LightGBM_CatBoost.ipynb now I have a new issue which is categorical feature indices.

    According to the provided link if the prediction includes categorical feature(s), a json-format file have to be used.

    I got confused about the JSON file when I was working on deploying a model in Sagemakerusing your AWS repository. Could you please advise me to create the JSON-format file for the categorical feature indices?
    here is more information of this mentioned JSON file provided there

    " If the predictors include categorical feature(s), a json-format file named 'categorical_index.json' should be included in the input directory to indicate the column index(es) of the categorical features. Within the json-format file, it should have a python directory where the key is a string of 'cat_index_list' and the value is a list of unique integer(s). Each integer in the list indicates the column index of categorical features in the 'data.csv'. The range of each integer should be more than 0 (index 0 indicates the target) and less than the total number of columns."

  • Hmm, reading the content there I thiiiink it means your file would look like e.g. { "cat_index_list": [2, 4] } - if the 3rd and 5th column of your data.csv were categorical (Author just using the word "directory" where they meant "dictionary"?) But afraid I haven't tested that yet so can't be sure - would suggest raising it as a separate question if you still can't get it working, as that'll get more visibility!

  • I used the same formatted JASON file and uploaded it to the same directory of train data ( data.csv), but still not working and raised another issue. I will make a new post and will copy-paste the question link here to pick your advice as well. I appreciate your guidance, Alex_T.

0

Thanks for your guidence, I make the JSON file accordingly however another issue come up : I posted it in https://repost.aws/questions/QUVfbc_AsXRzaxAl69MMFlsQ/error-for-training-job-catboost-classification-model-error-message-type-error-cannot-convert-xxx-to-float

I'm trying to find a solution and I have searched a lot but with no success. Please share your thoughts on this as well! Thanks

M
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions