Warnings when executing tensorflow sample code `mnist_with_summaries.py` - tensorflow

I'm trying to execute the examples given by TensorFlow. More specifically, the minist example. When I'm executing
tensorflow/examples/tutorials/mnist/mnist_with_summaries.py, line 163, which is :
summary, _ = sess.run([merged, train_step],
feed_dict=feed_dict(True),
options=run_options,
run_metadata=run_metadata)
The warning below comes out:
W tensorflow/core/common_runtime/gpu/gpu_tracer.cc:513] Unhandled API Callback for 2 41
W tensorflow/core/common_runtime/gpu/gpu_tracer.cc:513] Unhandled API Callback for 2 41
W tensorflow/core/common_runtime/gpu/gpu_tracer.cc:513] Unhandled API Callback for 2 41
W tensorflow/core/common_runtime/gpu/gpu_tracer.cc:513] Unhandled API Callback for 2 41
Any ideas on why this warning happen?
The full code is avaliable at here over which I changed nothing.
Thanks

This is a warning message and should be harmless. A fix is also in progress: https://github.com/tensorflow/tensorflow/issues/2959

Related

How to fix __init__() got an unexpected keyword argument 'location' error in scanpy.pl.umap?

I am trying to run single-cell analysis on scanpy 1.9.1. When I try to run scanpy.pl.umap(adata, color=["PDGFRB","RGS5"], s = 30), I get the following error:
TypeError Traceback (most recent call last)
in
----> 1 sc.pl.umap(adata, color=["PDGFRB","RGS5"], s = 30)
5 frames
/usr/local/lib/python3.8/dist-packages/matplotlib/colorbar.py in init(self, ax, mappable, **kw)
1228 """
1229 Return colorbar data coordinates for the boundaries of
-> 1230 a proportional colorbar, plus extension lengths if required:
1231 """
1232 if (isinstance(self.norm, colors.BoundaryNorm) or
TypeError: init() got an unexpected keyword argument 'location'
And I get a blank color heat legend.
blank_color_heat_legend
I saw someone suggested using an older version of matplotlib for a similar problem. This error occurred in matplotlib 3.6.3, so I tried installing matplotlib 3.1.3 but it did not work either.
Any help will be appreciated!

When trying to create html report the program throws error in

When executing the below
profile = ProfileReport(df,title="Data Profile Report")
profile.to_file("data_profile_report.html")
Here is the exception thrown
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
c:\Projections 2022-08-16\Projections.py in <cell line: 4>()
102 # %%
103 #Creating EDA of data
104 profile = ProfileReport(df_cdap,title="CDAP Data Profile Report")
----> 105 profile.to_file("cdap_data_profile_report.html")
File c:\Users\fengq\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas_profiling\profile_report.py:257, in ProfileReport.to_file(self, output_file, silent)
254 self.config.html.assets_prefix = str(output_file.stem) + "_assets"
255 create_html_assets(self.config, output_file)
--> 257 data = self.to_html()
259 if output_file.suffix != ".html":
260 suffix = output_file.suffix
File c:\Users\fengq\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas_profiling\profile_report.py:368, in ProfileReport.to_html(self)
360 def to_html(self) -> str:
361 """Generate and return complete template as lengthy string
362 for using with frameworks.
363
(...)
366
367 """
--> 368 return self.html
...
--> 810 fig = manager.canvas.figure
811 if fig_label:
812 fig.set_label(fig_label)
AttributeError: 'NoneType' object has no attribute 'canvas'
I've tried to re-install python and reinstalling the dependencies for pandas-profiling but nothing seems to work so far. I've also tried downgrading python to python 3.9 and the matplotlib to an older version as well. It has not changed this error.
I notice that the error seems to be attributed to "manager.canvas.figure" but I'm not sure how to resolve it from that point onwards. Any help is greatly appreciated!
The problem resolved as I set the matplotlib to inline as per some comments that I was able to find on another forum. I'm still really interested to learn what causes this! Please feel free to answer and suggest other solutions! I would love to try them!

cuda runtime error (48) : unrecognized error code

I can run mmdetection code on T4 GPU, but it doesn't work on K80 and P100 GPU.When I execute the test code(), I get the following error:
# This is the test code
from mmdet.apis import init_detector, inference_detector, show_result
config_file = 'configs/my_faster_rcnn_r50_fpn_1x.py'
checkpoint_file = './work_dirs/faster_rcnn_r50_fpn_1x/epoch_9.pth'
model = init_detector(config_file, checkpoint_file, device='cuda:0')
img = 'demo.jpg'
result = inference_detector(model, img)
show_result(img, result, model.CLASSES)
This is the error output:
# errpr log
/content/drive/My Drive/model_train/10_酒瓶检测/mmdetection/mmdet/ops/roi_align/roi_align.py in forward(ctx, features, rois, out_size, spatial_scale, sample_num)
25 # print('进入')
26 roi_align_cuda.forward(features, rois, out_h, out_w, spatial_scale,
---> 27 sample_num, output)
28 else:
29 print('出错')
RuntimeError: cuda runtime error (48) : unrecognized error code at mmdet/ops/roi_align/src/roi_align_kernel.cu:140
Has anyone encountered this problem? Can you help me solve it?
I faced the same issue and on analyzing the issue it seems this error is due to incompatibility of Pytorch with CUDA version.
So the code worked for me.
You can refer the below link for versions:
https://pytorch.org/get-started/previous-versions/

Getting a EOF error when calling pd.read_pickle

Had a quick question regarding a pandas DataFrame and the pd.read_pickle() function. Basically, I have a large but simple Dataframe (333 mb). When I run pd.read_pickle on the dataframe, I am getting and EOFError.
Is there any way around this issue? What might be causing this?
I saw the same EOFError when I created a pickle using:
pandas.DataFrame.to_pickle('path.pkl', compression='bz2')
and then tried to read with:
pandas.read_pickle('path.pkl')
I fixed the issue by supplying the compression on read:
pandas.read_pickle('path.pkl', compression='bz2')
According to the Pandas docs:
compression : {‘infer’, ‘gzip’, ‘bz2’, ‘zip’, ‘xz’, None}, default ‘infer’
string representing the compression to use in the output file. By default,
infers from the file extension in specified path.
Thus, simply changing the path from 'path.pkl' to 'path.bz2' also fixed the problem.
I can confirm the valuable comment of greg_data:
When I encountered this error I worked out that it was due to the
initial pickling not having completed correctly. The pickle file was
created, but not finished correctly. Seems to me this is the only
possible source of the EOFError in pickle, that the pickle is
malformed, i.e. not finished.
My error during pickling was:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-40-263240bbee7e> in <module>()
----> 1 main()
<ipython-input-38-9b3c6d782a2a> in main()
43 with open("/content/drive/MyDrive/{}.file".format(tm.id), "wb") as f:
---> 44 pickle.dump(tm, f, pickle.HIGHEST_PROTOCOL)
45
46 print('Coherence:', get_coherence(tm, token_lists, 'c_v'))
TypeError: can't pickle weakref objects
And when reading that pickle file that was obviously not finished during pickling, the reported error occured:
pd.read_pickle(r'/content/drive/MyDrive/TEST_2021_06_01_10_23_02.file')
Error:
---------------------------------------------------------------------------
EOFError Traceback (most recent call last)
<ipython-input-41-460bdd0a2779> in <module>()
----> 1 object = pd.read_pickle(r'/content/drive/MyDrive/TEST_2021_06_01_10_23_02.file')
/usr/local/lib/python3.7/dist-packages/pandas/io/pickle.py in read_pickle(filepath_or_buffer, compression)
180 # We want to silence any warnings about, e.g. moved modules.
181 warnings.simplefilter("ignore", Warning)
--> 182 return pickle.load(f)
183 except excs_to_catch:
184 # e.g.
EOFError: Ran out of input

some error/warning messages for running Tensorflow implementation

When running a Tensorflow implementation, I got the following error/warning messages, which does not include the line of python code that causes this issue. At the same time, the result is still generated. I am not sure what do these messages indicate?
Exception ignored in: <bound method Session.__del__ of <tensorflow.python.client.session.Session object at 0x2b48ec89f748>>
Traceback (most recent call last):
File "/data/tfw/lib/python3.4/site- packages/tensorflow/python/client/session.py", line 140, in __del__
File "/data/tfw/lib/python3.4/site-packages/tensorflow/python/client/session.py", line 137, in close
UnboundLocalError: local variable 'status' referenced before assignment
Today I also encountered this exception while running some Multi layer perceptron model on Windows 10 64 Bit with Python 3.5 and TensorFlow 0.12
I have seen this answer for this exception
it induced by different gc sequence, if python collect session first , the program will exit successfully, if python collect swig memory(tf_session) first, the program exit with failure.
Here