Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint dependencies error #91

Open
rodrigoheck opened this issue Jan 31, 2021 · 1 comment
Open

Endpoint dependencies error #91

rodrigoheck opened this issue Jan 31, 2021 · 1 comment

Comments

@rodrigoheck
Copy link

Describe the bug
I am using a package called Farm to perform the training and the inference. The training works fine: I pass the requirements.txt and all the packages are correctly installed. When I try to deploy it, there is also no problem. But at the moment of inference, when it is required to import farm, I get an error showing that the package doesn't exist.

To reproduce

estimator = PyTorch(
    base_job_name="imdb",
    max_run= 60*30,
    entry_point="train_aws.py",
    source_dir="source",  
    framework_version="1.5",
    py_version = 'py3',
    instance_count=1,
    role=role, 
    hyperparameters=hyperparameters,
    instance_type= "ml.p3.2xlarge", 
    output_path="s3://<bucket>/opt/ml/model", # the S3 path where model is outputted 
)
estimator.fit(
    {'training': '/'.join(training_input_path.split('/')[:-1])}, 
    wait=True
)
model = estimator.create_model(role=role, entry_point='inference.py')
mdm = multidatamodel.MultiDataModel(name="Models",
                                    model_data_prefix="s3://<bucket>/opt/ml/model/", 
                                    model = model,
                                    sagemaker_session=sess
                                   )
predictor = mdm.deploy(initial_instance_count=1,instance_type='ml.t2.medium', endpoint_name="inference")

Note: when I create the model.tar.gz, I include 'requirements.txt' and 'inference.py' on code folder.

Expected behavior

Inference should be working, but the packages are not being correctly installed. I try to do it using brute force, including these lines on inference.py:

import subprocess
import sys
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'farm'])

But then it says that another package is missing: ImportError: cannot import name 'rng_integers'

Is there a better way to install the packages I want inside the inference container?

@ajaykarpur ajaykarpur transferred this issue from aws/sagemaker-python-sdk Feb 1, 2021
@schenqian
Copy link

Can you try the framework_version="1.6" (TS upgrade), looks like there is no "requirements.txt" install commands in serving.py under 1.6 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants