aws / aws/amazon-sagemaker-examples

Error for Training job sagemaker-scikit-learn-2020-10-15-19-50-56-061: Failed. Reason: AlgorithmError: ExecuteUserScriptError: Command "/miniconda3/bin/python -m train"

Open
#1,627 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

This is my training file. The same model is running fine on my local jupyter notebook, but I am getting algorithm error when running on AWS sagemaker, where can I be going wrong ?

%%writefile train.py

import os

import pandas as pd
#from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
#from sklearn.pipeline import Pipeline
#from sklearn.linear_model import SGDClassifier
#from sklearn.naive_bayes import MultinomialNB
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier

from sklearn.externals import joblib

if __name__=="__main__":
training_data_directory = '/opt/ml/input/data/train' #check this
train_features_data = os.path.join(training_data_directory, 'train_features.csv')
train_labels_data = os.path.join(training_data_directory, 'train_labels.csv')
print('Reading input data')
X_train = pd.read_csv(train_features_data, header=None)
y_train = pd.read_csv(train_labels_data, header=None)

svmClassifier = OneVsRestClassifier(LinearSVC(), n_jobs=-1)
svmClassifier.fit(X_train, y_train)

print('Saving model to {}'.format(model_output_directory))
joblib.dump(model, model_output_directory)

Contributor guide

Open the contributing guide

Research direction

Start with the train.py script and its __main__ entry point, then review the SageMaker training job's ExecuteUserScript output and the /opt/ml/input/data/train paths. Reproduce the training run in SageMaker and compare it with the local notebook; done means the job completes and the model is saved successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, pandas, python, scikit-learn
Domain
cloud, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.