Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package's version problem #3

Open
szj2ys opened this issue Aug 16, 2021 · 2 comments
Open

package's version problem #3

szj2ys opened this issue Aug 16, 2021 · 2 comments

Comments

@szj2ys
Copy link

szj2ys commented Aug 16, 2021

please tell us which version you are use of keras and tensorflow, thanks.

@vesper1012
Copy link

您好,定义模型都是成功的,就是开始训练就不行了 不知道为什么 我是用的自己的数据 只有几百个 分三类
报错是这样的:
Epoch 1/5
Traceback (most recent call last):
File "/Users/vesperli/PycharmProjects/Han_2/classifi_keyword_to_caseitem.py", line 119, in
history = model.fit(X_train, Y_train, epochs=epochs, batch_size=batch_size,validation_split=0.1,callbacks=[EarlyStopping(monitor='val_loss', patience=3, min_delta=0.0001)])
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 1147, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:

File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/training.py", line 1010, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/training.py", line 1000, in run_step  **
    outputs = model.train_step(data)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/training.py", line 860, in train_step
    loss = self.compute_loss(x, y, y_pred, sample_weight)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/training.py", line 918, in compute_loss
    return self.compiled_loss(
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/engine/compile_utils.py", line 201, in __call__
    loss_value = loss_obj(y_t, y_p, sample_weight=sw)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/losses.py", line 141, in __call__
    losses = call_fn(y_true, y_pred)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/losses.py", line 245, in call  **
    return ag_fn(y_true, y_pred, **self._fn_kwargs)
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/losses.py", line 1789, in categorical_crossentropy
    return backend.categorical_crossentropy(
File "/Users/vesperli/opt/anaconda3/envs/Han_2/lib/python3.8/site-packages/keras/backend.py", line 5083, in categorical_crossentropy
    target.shape.assert_is_compatible_with(output.shape)

ValueError: Shapes (None, 3) and (None, 10) are incompatible

@zy235055
Copy link

zy235055 commented May 7, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants