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

ошибочка #27

Open
KlarkCode opened this issue Apr 5, 2024 · 1 comment
Open

ошибочка #27

KlarkCode opened this issue Apr 5, 2024 · 1 comment

Comments

@KlarkCode
Copy link

def call(self, inputs):
    return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]

в этих строках кода пишет что нужно передать числовое значение, что не так?
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: Exception encountered when calling PositionalEncoding.call().

@Mettalix-MTTX
Copy link

Mettalix-MTTX commented Sep 2, 2024

Такая же фигня: Exception has occurred: TypeError
Exception encountered when calling PositionalEncoding.call().

�[1mCould not automatically infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:

Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.�[0m

Arguments received by PositionalEncoding.call():
• args=('<KerasTensor shape=(None, None, 512), dtype=float32, sparse=True, name=keras_tensor_4>',)
• kwargs=<class 'inspect._empty'>
ValueError: SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64))

During handling of the above exception, another exception occurred:

File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.

During handling of the above exception, another exception occurred:

File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: Could not automatica
2024-09-02_22-16-48
lly infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:

Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.

During handling of the above exception, another exception occurred:

File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 150, in encoder
embeddings = PositionalEncoding(vocab_size, d_model)(embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 256, in transformer
enc_outputs = encoder(
^^^^^^^^
File "C:\Users\Admin\Documents\DolboNet\core\predictor.py", line 24, in
model = transformer(
^^^^^^^^^^^^
File "C:\Users\Admin\Documents\DolboNet\core\main_client.py", line 12, in
from core import predictor
File "C:\Users\Admin\Documents\DolboNet\bot.py", line 23, in
from core.main_client import MainClient
TypeError: Exception encountered when calling PositionalEncoding.call().

�[1mCould not automatically infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:

Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.�[0m

Arguments received by PositionalEncoding.call():
• args=('<KerasTensor shape=(None, None, 512), dtype=float32, sparse=True, name=keras_tensor_4>',)
• kwargs=<class 'inspect._empty'>

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

2 participants