DolboNet icon indicating copy to clipboard operation
DolboNet copied to clipboard

ошибочка

Open KlarkCode opened this issue 2 years ago • 1 comments

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().

KlarkCode avatar Apr 05 '24 18:04 KlarkCode

Такая же фигня: 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'>

Mettalix-MTTX avatar Sep 02 '24 19:09 Mettalix-MTTX