Keras 如何解决这个内部错误
我想处理这段代码,但内部错误让我感到麻烦 这些数据被称为泰坦尼克号:从灾难中学习的机器 我感觉这个错误与代码错误无关,但我不知道我必须做什么 如何解决此错误 这是我的代码和错误消息Keras 如何解决这个内部错误,keras,python-3.7,tensorflow2.0,environment,Keras,Python 3.7,Tensorflow2.0,Environment,我想处理这段代码,但内部错误让我感到麻烦 这些数据被称为泰坦尼克号:从灾难中学习的机器 我感觉这个错误与代码错误无关,但我不知道我必须做什么 如何解决此错误 这是我的代码和错误消息 import pandas as pd import numpy as np import tensorflow as tf path = '../1.데이터/' data1 = pd.read_csv(path + "test.csv", index_col = "Passenger
import pandas as pd
import numpy as np
import tensorflow as tf
path = '../1.데이터/'
data1 = pd.read_csv(path + "test.csv", index_col = "PassengerId")
data2 = pd.read_csv(path + "gender_submission.csv", index_col = "PassengerId")
test_data = pd.merge(data1, data2, on = "PassengerId")
test_data["Sex"] = pd.get_dummies(test_data["Sex"])
test_data["Embarked"] = pd.get_dummies(test_data["Embarked"])
inde = test_data[["Pclass", "Sex", "SibSp", "Parch", "Fare", "Embarked"]]
sub = test_data["Survived"]
X = tf.keras.layers.Input(shape=[6])
Y = tf.keras.layers.Dense(1, activation='softmax')(X)
model = tf.keras.models.Model(X, Y)
model.compile(loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(inde, sub, epochs=1000, verbose=0)
model.fit(inde, sub, epochs=10)
---------------------------------------------------------------------------
InternalError Traceback (most recent call last)
<ipython-input-34-0d8442a43d4d> in <module>
----> 1 model.fit(inde, sub, epochs=1000, verbose=0)
2 model.fit(inde, sub, epochs=10)
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
817 max_queue_size=max_queue_size,
818 workers=workers,
--> 819 use_multiprocessing=use_multiprocessing)
820
821 def evaluate(self,
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
340 mode=ModeKeys.TRAIN,
341 training_context=training_context,
--> 342 total_epochs=epochs)
343 cbks.make_logs(model, epoch_logs, training_result, ModeKeys.TRAIN)
344
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in run_one_epoch(model, iterator, execution_function, dataset_size, batch_size, strategy, steps_per_epoch, num_samples, mode, training_context, total_epochs)
126 step=step, mode=mode, size=current_batch_size) as batch_logs:
127 try:
--> 128 batch_outs = execution_function(iterator)
129 except (StopIteration, errors.OutOfRangeError):
130 # TODO(kaftan): File bug about tf function and errors.OutOfRangeError?
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2_utils.py in execution_function(input_fn)
96 # `numpy` translates Tensors to values in Eager mode.
97 return nest.map_structure(_non_none_constant_value,
---> 98 distributed_function(input_fn))
99
100 return execution_function
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\def_function.py in __call__(self, *args, **kwds)
566 xla_context.Exit()
567 else:
--> 568 result = self._call(*args, **kwds)
569
570 if tracing_count == self._get_tracing_count():
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\def_function.py in _call(self, *args, **kwds)
630 # Lifting succeeded, so variables are initialized and we can run the
631 # stateless function.
--> 632 return self._stateless_fn(*args, **kwds)
633 else:
634 canon_args, canon_kwds = \
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in __call__(self, *args, **kwargs)
2361 with self._lock:
2362 graph_function, args, kwargs = self._maybe_define_function(args, kwargs)
-> 2363 return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access
2364
2365 @property
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in _filtered_call(self, args, kwargs)
1609 if isinstance(t, (ops.Tensor,
1610 resource_variable_ops.BaseResourceVariable))),
-> 1611 self.captured_inputs)
1612
1613 def _call_flat(self, args, captured_inputs, cancellation_manager=None):
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1690 # No tape is watching; skip to running the function.
1691 return self._build_call_outputs(self._inference_function.call(
-> 1692 ctx, args, cancellation_manager=cancellation_manager))
1693 forward_backward = self._select_forward_and_backward_functions(
1694 args,
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in call(self, ctx, args, cancellation_manager)
543 inputs=args,
544 attrs=("executor_type", executor_type, "config_proto", config),
--> 545 ctx=ctx)
546 else:
547 outputs = execute.execute_with_cancellation(
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
65 else:
66 message = e.message
---> 67 six.raise_from(core._status_to_exception(e.code, message), None)
68 except TypeError as e:
69 keras_symbolic_tensors = [
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\six.py in raise_from(value, from_value)
InternalError: Blas GEMV launch failed: m=6, n=32
[[node model_7/dense_7/MatMul (defined at <ipython-input-34-0d8442a43d4d>:1) ]] [Op:__inference_distributed_function_1008]
Function call stack:
distributed_function
错误消息
import pandas as pd
import numpy as np
import tensorflow as tf
path = '../1.데이터/'
data1 = pd.read_csv(path + "test.csv", index_col = "PassengerId")
data2 = pd.read_csv(path + "gender_submission.csv", index_col = "PassengerId")
test_data = pd.merge(data1, data2, on = "PassengerId")
test_data["Sex"] = pd.get_dummies(test_data["Sex"])
test_data["Embarked"] = pd.get_dummies(test_data["Embarked"])
inde = test_data[["Pclass", "Sex", "SibSp", "Parch", "Fare", "Embarked"]]
sub = test_data["Survived"]
X = tf.keras.layers.Input(shape=[6])
Y = tf.keras.layers.Dense(1, activation='softmax')(X)
model = tf.keras.models.Model(X, Y)
model.compile(loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(inde, sub, epochs=1000, verbose=0)
model.fit(inde, sub, epochs=10)
---------------------------------------------------------------------------
InternalError Traceback (most recent call last)
<ipython-input-34-0d8442a43d4d> in <module>
----> 1 model.fit(inde, sub, epochs=1000, verbose=0)
2 model.fit(inde, sub, epochs=10)
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
817 max_queue_size=max_queue_size,
818 workers=workers,
--> 819 use_multiprocessing=use_multiprocessing)
820
821 def evaluate(self,
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
340 mode=ModeKeys.TRAIN,
341 training_context=training_context,
--> 342 total_epochs=epochs)
343 cbks.make_logs(model, epoch_logs, training_result, ModeKeys.TRAIN)
344
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in run_one_epoch(model, iterator, execution_function, dataset_size, batch_size, strategy, steps_per_epoch, num_samples, mode, training_context, total_epochs)
126 step=step, mode=mode, size=current_batch_size) as batch_logs:
127 try:
--> 128 batch_outs = execution_function(iterator)
129 except (StopIteration, errors.OutOfRangeError):
130 # TODO(kaftan): File bug about tf function and errors.OutOfRangeError?
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2_utils.py in execution_function(input_fn)
96 # `numpy` translates Tensors to values in Eager mode.
97 return nest.map_structure(_non_none_constant_value,
---> 98 distributed_function(input_fn))
99
100 return execution_function
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\def_function.py in __call__(self, *args, **kwds)
566 xla_context.Exit()
567 else:
--> 568 result = self._call(*args, **kwds)
569
570 if tracing_count == self._get_tracing_count():
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\def_function.py in _call(self, *args, **kwds)
630 # Lifting succeeded, so variables are initialized and we can run the
631 # stateless function.
--> 632 return self._stateless_fn(*args, **kwds)
633 else:
634 canon_args, canon_kwds = \
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in __call__(self, *args, **kwargs)
2361 with self._lock:
2362 graph_function, args, kwargs = self._maybe_define_function(args, kwargs)
-> 2363 return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access
2364
2365 @property
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in _filtered_call(self, args, kwargs)
1609 if isinstance(t, (ops.Tensor,
1610 resource_variable_ops.BaseResourceVariable))),
-> 1611 self.captured_inputs)
1612
1613 def _call_flat(self, args, captured_inputs, cancellation_manager=None):
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1690 # No tape is watching; skip to running the function.
1691 return self._build_call_outputs(self._inference_function.call(
-> 1692 ctx, args, cancellation_manager=cancellation_manager))
1693 forward_backward = self._select_forward_and_backward_functions(
1694 args,
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\function.py in call(self, ctx, args, cancellation_manager)
543 inputs=args,
544 attrs=("executor_type", executor_type, "config_proto", config),
--> 545 ctx=ctx)
546 else:
547 outputs = execute.execute_with_cancellation(
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\tensorflow_core\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
65 else:
66 message = e.message
---> 67 six.raise_from(core._status_to_exception(e.code, message), None)
68 except TypeError as e:
69 keras_symbolic_tensors = [
C:\tools\Anaconda3\envs\tensorflow2_py37\lib\site-packages\six.py in raise_from(value, from_value)
InternalError: Blas GEMV launch failed: m=6, n=32
[[node model_7/dense_7/MatMul (defined at <ipython-input-34-0d8442a43d4d>:1) ]] [Op:__inference_distributed_function_1008]
Function call stack:
distributed_function
我怎么了有人帮帮我吗