- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试在 Jupyter 笔记本中训练模型时遇到以下错误:
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Error reported to Coordinator: <class 'SystemError'>, <built-in function TF_Run> returned a result with an error set
INFO:tensorflow:Saving checkpoints for 0 into /tmp/tmpodutz9be/model.ckpt.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
TypeError: expected bytes, float found
During handling of the above exception, another exception occurred:
SystemError Traceback (most recent call last)
<ipython-input-12-44daeaf784e5> in <module>()
----> 1 model.train(input_fn=input_func,steps=200)
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in train(self, input_fn, hooks, steps, max_steps)
239 hooks.append(training.StopAtStepHook(steps, max_steps))
240
--> 241 loss = self._train_model(input_fn=input_fn, hooks=hooks)
242 logging.info('Loss for final step: %s.', loss)
243 return self
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in _train_model(self, input_fn, hooks)
684 loss = None
685 while not mon_sess.should_stop():
--> 686 _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
687 return loss
688
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/training/monitored_session.py in __exit__(self, exception_type, exception_value, traceback)
532 if exception_type in [errors.OutOfRangeError, StopIteration]:
533 exception_type = None
--> 534 self._close_internal(exception_type)
535 # __exit__ should return True to suppress an exception.
536 return exception_type is None
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/training/monitored_session.py in _close_internal(self, exception_type)
567 finally:
568 try:
--> 569 self._sess.close()
570 finally:
571 self._sess = None
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/training/monitored_session.py in close(self)
809 if self._sess:
810 try:
--> 811 self._sess.close()
812 except _PREEMPTION_ERRORS:
813 pass
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/training/monitored_session.py in close(self)
906 self._coord.join(
907 stop_grace_period_secs=self._stop_grace_period_secs,
--> 908 ignore_live_threads=True)
909 finally:
910 try:
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/training/coordinator.py in join(self, threads, stop_grace_period_secs, ignore_live_threads)
387 self._registered_threads = set()
388 if self._exc_info_to_raise:
--> 389 six.reraise(*self._exc_info_to_raise)
390 elif stragglers:
391 if ignore_live_threads:
~/.local/lib/python3.5/site-packages/six.py in reraise(tp, value, tb)
691 if value.__traceback__ is not tb:
692 raise value.with_traceback(tb)
--> 693 raise value
694 finally:
695 value = None
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/estimator/inputs/queues/feeding_queue_runner.py in _run(self, sess, enqueue_op, feed_fn, coord)
92 try:
93 feed_dict = None if feed_fn is None else feed_fn()
---> 94 sess.run(enqueue_op, feed_dict=feed_dict)
95 except (errors.OutOfRangeError, errors.CancelledError):
96 # This exception indicates that a queue was closed.
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
893 try:
894 result = self._run(None, fetches, feed_dict, options_ptr,
--> 895 run_metadata_ptr)
896 if run_metadata:
897 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1122 if final_fetches or final_targets or (handle and feed_dict_tensor):
1123 results = self._do_run(handle, final_targets, final_fetches,
-> 1124 feed_dict_tensor, options, run_metadata)
1125 else:
1126 results = []
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
1319 if handle is None:
1320 return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1321 options, run_metadata)
1322 else:
1323 return self._do_call(_prun_fn, self._session, handle, feeds, fetches)
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1325 def _do_call(self, fn, *args):
1326 try:
-> 1327 return fn(*args)
1328 except errors.OpError as e:
1329 message = compat.as_text(e.message)
~/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
1304 return tf_session.TF_Run(session, options,
1305 feed_dict, fetch_list, target_list,
-> 1306 status, run_metadata)
1307
1308 def _prun_fn(session, handle, feed_dict, fetch_list):
SystemError: <built-in function TF_Run> returned a result with an error set
我尝试指定或不指定特征列的数据类型,排除分类列,重新启动内核,更改批量大小和纪元。我可能错过了一些非常愚蠢的东西,但花了几个小时试图找出问题所在:(
这是代码本身,提前感谢您的研究:
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
test.columns
train.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 891 entries, 0 to 890
Data columns (total 12 columns):
PassengerId 891 non-null int64
Survived 891 non-null int64
Pclass 891 non-null int64
Name 891 non-null object
Sex 891 non-null object
Age 714 non-null float64
SibSp 891 non-null int64
Parch 891 non-null int64
Ticket 891 non-null object
Fare 891 non-null float64
Cabin 204 non-null object
Embarked 889 non-null object
dtypes: float64(2), int64(5), object(5)
memory usage: 83.6+ KB
y = train['Survived']
X = train.drop(['Name','Survived','Ticket','PassengerId'],axis=1)
X_test = test
cols_to_norm = [ 'Fare']
X[cols_to_norm] = X[cols_to_norm].apply(lambda x: (x - x.min()) / (x.max() - x.min()))
pclass = tf.feature_column.numeric_column('Pclass', dtype=tf.int64)
sex = tf.feature_column.categorical_column_with_vocabulary_list(key="Sex", vocabulary_list=["male", "female"])
age = tf.feature_column.numeric_column('Age', dtype=tf.float64)
sibsp = tf.feature_column.numeric_column('SibSp', dtype=tf.int64)
fare = tf.feature_column.numeric_column('Fare', dtype=tf.float64)
parch = tf.feature_column.numeric_column('Parch', dtype=tf.int64)
embarked = tf.feature_column.categorical_column_with_hash_bucket('Embarked', hash_bucket_size=10000)
age_buckets = tf.feature_column.bucketized_column(age, boundaries=[0,10,20,30,40,50,60,70,80])
feat_cols = [pclass, age_buckets, sex, sibsp, parch, embarked]
input_func = tf.estimator.inputs.pandas_input_fn(x=X,y=y,batch_size=4,num_epochs=None,shuffle=True)
model = tf.estimator.LinearClassifier(feature_columns=feat_cols)
model.train(input_fn=input_func,steps=200)
顺便说一句,当 TF 崩溃时,我在终端中看到此错误:
I 22:37:15.691 NotebookApp] Saving file at /kaggle/titanic/titanic_nb.ipynb
[2408:2444:0428/225656.234325:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[2408:2444:0428/225656.322176:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[2408:2444:0428/225656.442632:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[2408:2444:0428/225656.831056:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[2408:2408:0428/225656.895872:ERROR:CONSOLE(6)] "Uncaught ReferenceError: gbar is not defined", source: https://clients5.google.com/pagead/drt/dn/ (6)
最佳答案
天哪,解决方案有点太简单了:)
对于包含字节大小范围内的数字的整数列,我手动将 dtype 设置为 int8:
pclass = tf.feature_column.numeric_column('Pclass', dtype=tf.int8)
parch = tf.feature_column.numeric_column('Parch', dtype=tf.int8)
缩小数据大小绝对是合理的,尽管我仍然想知道为什么我之前在其他也只有字节大小的数字列的数据集上没有遇到这个问题。
关于python - 训练 Tensorflow LinearClassifier 时出现类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50080721/
我已经使用 vue-cli 两个星期了,直到今天一切正常。我在本地建立这个项目。 https://drive.google.com/open?id=0BwGw1zyyKjW7S3RYWXRaX24tQ
您好,我正在尝试使用 python 库 pytesseract 从图像中提取文本。请找到代码: from PIL import Image from pytesseract import image_
我的错误 /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference
我已经训练了一个模型,我正在尝试使用 predict函数但它返回以下错误。 Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]])
根据Microsoft DataConnectors的信息我想通过 this ODBC driver 创建一个从 PowerBi 到 PostgreSQL 的连接器使用直接查询。我重用了 Micros
我已经为 SoundManagement 创建了一个包,其中有一个扩展 MediaPlayer 的类。我希望全局控制这个变量。这是我的代码: package soundmanagement; impo
我在Heroku上部署了一个应用程序。我正在使用免费服务。 我经常收到以下错误消息。 PG::Error: ERROR: out of memory 如果刷新浏览器,就可以了。但是随后,它又随机发生
我正在运行 LAMP 服务器,这个 .htaccess 给我一个 500 错误。其作用是过滤关键字并重定向到相应的域名。 Options +FollowSymLinks RewriteEngine
我有两个驱动器 A 和 B。使用 python 脚本,我在“A”驱动器中创建一些文件,并运行 powerscript,该脚本以 1 秒的间隔将驱动器 A 中的所有文件复制到驱动器 B。 我在 powe
下面的函数一直返回这个错误信息。我认为可能是 double_precision 字段类型导致了这种情况,我尝试使用 CAST,但要么不是这样,要么我没有做对...帮助? 这是错误: ERROR: i
这个问题已经有答案了: Syntax error due to using a reserved word as a table or column name in MySQL (1 个回答) 已关闭
我的数据库有这个小问题。 我创建了一个表“articoli”,其中包含商品的品牌、型号和价格。 每篇文章都由一个 id (ID_ARTICOLO)` 定义,它是一个自动递增字段。 好吧,现在当我尝试插
我是新来的。我目前正在 DeVry 在线学习中级 C++ 编程。我们正在使用 C++ Primer Plus 这本书,到目前为止我一直做得很好。我的老师最近向我们扔了一个曲线球。我目前的任务是这样的:
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的网站中有一段代码有问题;此错误仅发生在 Internet Explorer 7 中。 我没有在这里发布我所有的 HTML/CSS 标记,而是发布了网站的一个版本 here . 如您所见,我在列中有
如果尝试在 USB 设备上构建 node.js 应用程序时在我的树莓派上使用 npm 时遇到一些问题。 package.json 看起来像这样: { "name" : "node-todo",
在 Python 中,您有 None单例,在某些情况下表现得很奇怪: >>> a = None >>> type(a) >>> isinstance(a,None) Traceback (most
这是我的 build.gradle (Module:app) 文件: apply plugin: 'com.android.application' android { compileSdkV
我是 android 的新手,我的项目刚才编译和运行正常,但在我尝试实现抽屉导航后,它给了我这个错误 FAILURE: Build failed with an exception. What wen
谁能解释一下?我想我正在做一些非常愚蠢的事情,并且急切地等待着启蒙。 我得到这个输出: phpversion() == 7.2.25-1+0~20191128.32+debian8~1.gbp108
我是一名优秀的程序员,十分优秀!