BookmarkSubscribeRSS Feed
Obsidian | Level 7

I'm trying to fit an image classification model that I created in Python. I made the model using the SAS-DLPY package in Python. All the steps leading up to the fit is going well (loading images, shuffling the data, creating patches, and creating a simple CNN model). 


Yet, the moment I try to fit the model, I run into 2 situations:


Situation 1: = train,
mini_batch_size = 32,
max_epochs = 5,
lr = 0.001,
log_level = 2)


Using the fit above, everything works fine. I get a fitted model that I can check the performance for (e.g., misclassification rate and loss). 


Situation 2: = train,
mini_batch_size = 32,
max_epochs = 7,
lr = 0.001,
log_level = 2)


However, using the fit in situation 2 (with the only difference being max epochs = 7 instead of 5), I get the error below:


Traceback (most recent call last):
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\swat\cas\rest\", line 434, in invoke
self._results = json.loads(a2u(res, 'utf-8'), strict=False)
File "C:\Python\lib\json\", line 367, in loads
return cls(**kw).decode(s)
File "C:\Python\lib\json\", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python\lib\json\", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\IPython\core\", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-11-9003bd2a9e43>", line 5, in <module>
log_level = 2)
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\dlpy\", line 281, in fit
model_weights=dict(replace=True, **self.model_weights.to_table_params()))
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\dlpy\", line 421, in train
rt = self._retrieve_('deeplearn.dltrain', message_level='note', **parameters)
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\dlpy\", line 247, in _retrieve_
return self.conn.retrieve(_name_, _messagelevel=message_level, **kwargs)
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\swat\cas\", line 1692, in retrieve
signature = self._invoke_with_signature(a2n(_name_), **kwargs)
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\swat\cas\", line 1171, in _invoke_with_signature
self._invoke_without_signature(_name_, **kwargs)
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\swat\cas\", line 945, in _invoke_without_signature
errorcheck(self._sw_connection.invoke(a2n(_name_), kwargs),
File "C:\Users\WenkuoChen\PycharmProjects\NVWA Pilot\venv\lib\site-packages\swat\cas\rest\", line 441, in invoke
raise SWATError(str(exc))
swat.exceptions.SWATError: Expecting value: line 1 column 1 (char 0)


I have no idea what's causing this, since it only seems to occur when I increase the model complexity/demands on system resources. For example,if I increase the amount of training images by increasing the amount of patches created, I get the same error.


The SAS Viya environment that I'm using has no GPU's, and a low amount of CPU's (8 I've been told). I was wondering if it's possible that the lack of GPU's (and low amount of CPU's) might be the cause? Or is there something else that I'm missing?


I've included my full script. The images that I'm using are JPG images, with names like dog.1.jpg. The Python interface that I use is Pycharm (version 2018.3.1), with SAS-DLPY version 1.0.2 and Python version 3.6.


Hopefuly, someone can enlighten me on this error!


Community Manager

Hi @JianShen,

I ran you error past a couple of engineers. They don't believe it's an issue with DLPy, but an issue with connection loss and not returning anything. They are still looking into it. In the meantime, can you try a couple of other parameter changes?


What occurs when you set mini_batch_size = 8 (mini_batch_size is important as it sets the required memory independent of how many images in a table)? What occurs when you set max_epochs = 6?




Join us for SAS Community Trivia
SAS Bowl XXXVI, Data Simulation
Wednesday, December 13, 2023, at 10 a.m. ET | #SASBowl

Obsidian | Level 7

Hi @joeFurbee,


Thank you for the quick reply!


Based on your suggestions, I've tested the following fit-settings: = train,
mini_batch_size = 32,
max_epochs = 6,
lr = 0.001,
log_level = 2)

Using max_epochs = 6 and mini_batch_size = 32, the fit runs without any errors. = train,
mini_batch_size = 8,
max_epochs = 6,
lr = 0.001,
log_level = 2)

The fit also runs without any errors using max_epochs = 6 and mini_batch_size = 8.


So far, everything seems to point towards the possibility that the SAS Viya-environment I'm using is unable to handle things beyond a certain load, thereby resulting in the error (that's the feeling I'm getting at least).


Thank you,







Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2 in conversation