Issue
I want to log a created plot to my workspace like this:
from azureml.core import Run
from matplotlib import pyplot as plt
run = Run.get_context()
Foo = [1,2,3,4]
Bar = [4,3,2,1]
plt.title('Foo vs Bar')
plt.plot(Foo, label='Foo')
plt.plot(Bar, '-r', label='Bar')
run.log_image('Plot', plt)
But I'm getting the following error:
"type": "AttributeError",
"message": "module 'matplotlib.pyplot' has no attribute 'tell'",
This happens when it tries to compute this:
File "/usr/lib/python3.6/imghdr.py", line 19, in what
location = file.tell()
I can log variables to azureml. If I run my script locally without azureml I can see the plots correctly. How can I log my plot to my azure experiment?
Solution
I found the answer. In order to save the plt into azureml you have to specify which is the plot and not just send it as a second parameter.
...
run.log_image('Plot', plot=plt)
Answered By - Gonzalo Garcia
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.