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

Error using SASCTL to register a Python model to MM in Viya 4 #136

Open
ggrabow1 opened this issue Nov 10, 2022 · 1 comment
Open

Error using SASCTL to register a Python model to MM in Viya 4 #136

ggrabow1 opened this issue Nov 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ggrabow1
Copy link

Describe the issue
SASCTL 1.7.3 can register a simple Python model to MM in Viya 4, but when trying to execute a Scoring Task it produces an error.

To Reproduce
import pandas as pd
from sasctl import Session, register_model, publish_model
from sklearn.linear_model import LogisticRegression

Load the Iris data set and split into features and target.

df = pd.read_csv('Data/iris.csv')
X = df.drop('species', axis=1)
y = df.species.astype('category')

Fit a sci-kit learn model

model = LogisticRegression()
model.fit(X, y)

with Session('budsprod.viyamtes.com', 'gegrab', 'XXXXX', verify_ssl=False):
model_name = 'Iris Regression2'

# Register the model in Model Manager

register_model(model,
model_name,
input=X, # Use X to determine model inputs
project='Iris2', # Register in "Iris" project
force=True) # Create project if it doesn't exist

Expected behavior
The Scoring Task in MM should execute and score on a sample set of records. The error received in MM:

NOTE: Created package _076796cfb3ca459eb8a285e3cd30c38 in data set "casuser(gegrab)"._076796cfb3ca459eb8a285e3cd30c38.
NOTE: Execution succeeded. No rows affected.
NOTE: Running 'modelPublishing' action set with 0 workers.
NOTE: Execution of model 'TempModel_781437f5-15be-3842-99a0-eea05a45c6ba ' succeeded.
ERROR: There is no session-scope table Test_3_Iris_Regression2_v1_0_2022_11_04_14_42_49_output in caslib gegrab_s of Cloud Analytic Services.
NOTE: Cloud Analytic Services dropped table TempModel_781437f5-15be-3842-99a0-eea05a45c6ba**

Stack Trace
If you're experiencing an exception, include the full stack trace and error message.

Version
What version of sasctl are you using? 1.7.3

@ggrabow1 ggrabow1 added the bug Something isn't working label Nov 10, 2022
@smlindauer smlindauer self-assigned this Nov 10, 2022
@smlindauer
Copy link
Collaborator

Hey @ggrabow1,

I believe that the register_model() function will only work for SAS Viya 3.5 if you are trying to register a Python model (it handles astore and cas generated models as expected in SAS Viya 4). This is caused by a differing set of file requirements between SAS Viya 3.5 and SAS Viya 4. In Viya 4, Model Manager only expects to see Python code and the pickle file, then it automatically generates the DS2 wrapper when you publish or score the model.

As such, I would suggest trying to use the pzmm submodule for importing Python models into SAS Viya 4. I will add a bug to check the Viya version when importing a Python model with register_model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants