Alexander Lutsenko

Results 23 comments of Alexander Lutsenko

Closing the issue for now due to inactivity. Please reopen if it's still relevant.

Hi! I'm not sure how to implement that. `tf.name_scope` seems to have [no effect](https://github.com/tensorflow/tensorflow/issues/27298#issuecomment-478140993). ```python with tf.name_scope('block'): dense = tf.keras.layers.Dense(10, input_shape=(2, )) inputs = tf.keras.Input((1, 2)) outputs = dense(inputs) model...

> I managed to hack it out but it's far from ideal: [microblink@8b5a142](https://github.com/microblink/nobuco/commit/8b5a142f63b785d086212dcad3a4e65e0d041b3c) Hey, could you give me an example script? I tried the patch, and I see no effect...

@grasskin Thanks for the clarity! One thing I still don't understand is why it works fine inside a custom layer: ```python class CustomLayer(keras.Layer): def call(self, x): b, l = keras.ops.shape(x)...

Hi! That one seems to be a problem with Tensorflow itself. During conversion, it's usually a good idea to disable the GPU altogether: ```python import os os.environ["CUDA_VISIBLE_DEVICES"] = "" ```

Hi! Imagine these are the outputs of the original Pytorch op/module, and its Keras counterpart: ```python output_pt = [100000.0, 100000.0, 100000.0] output_tf = [100000.0, 100000.0, 100000.1] ``` Then, the max...

> Developers will want to programmatically analyze the result of conversion in a more detailed manner. Therefore, I suggest returning the validation and conversion results as well after conversion. Right....

When Tensorflow performance sucks, these are the usual culprits: 1. In Pytorch, transformers typically call [`scaled_dot_product_attention`](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html) which may leverage highly optimized kernels (e.g. FlashAttention). Sadly, there is no such thing...

@thegodone One important thing I almost forgot about: Tensorflow really hates dynamic tensor shapes. To infer language models with varying context length, you should do [input padding](https://blog.tensorflow.org/2022/11/how-hugging-face-improved-text-generation-performance-with-xla.html) (see this [example](https://github.com/AlexanderLutsenko/nobuco/tree/1d74f02e3e7b32896a01d21624a3929212cb918d/examples/stablelm_zephyr)...