Just found that due to deprecated module “preprocessing” the Tokenizer and another usfull funcs haven’t worked already. And developers changed it on TextVetorization layer that can be called just from model.
After I saw this I understood that I don’t completely understand the concept of TensorFlow. Do I understand correct, that developers don’t like when any steps can be used without models? Why is it? It looks really exsessive when I just want to try to check the working of any features/apis but need to create a model for this. Also, any of funcs can be defined by developers of TF as step in model and as potential Layer, isn’t it?
The exam expects you to upload the fit model. So, the system doesn’t care if you use a deprecated API. The recommended APIs use GPU effectively and so have better performance over the deprecated APIs that use CPU.
The staff are aware of usage of deprecated APIs and will update the notebooks.
Performance is one of the main reasons for deprecation of tf.keras.preprocessing layers.
For instance, when using image_dataset_from_directory, augmentations are done in layers within the model which internally uses GPU. ImageDataGenerator uses CPU to perform augmentations prior to feeding data into the model.
I’ve observed a good amount of difference when it comes to training time when using the newer recommended APIs.
In general, you should seek to do data preprocessing as part of your model as much as possible, not via an external data preprocessing pipeline. That’s because external data preprocessing makes your models less portable when it’s time to use them in production. Consider a model that processes text: it uses a specific tokenization algorithm and a specific vocabulary index. When you want to ship your model to a mobile app or a JavaScript app, you will need to recreate the exact same preprocessing setup in the target language. This can get very tricky: any small discrepancy between the original pipeline and the one you recreate has the potential to completely invalidate your model, or at least severely degrade its performance.
It would be much easier to be able to simply export an end-to-end model that already includes preprocessing. The ideal model should expect as input something as close as possible to raw data: an image model should expect RGB pixel values in the [0, 255] range, and a text model should accept strings of utf-8 characters. That way, the consumer of the exported model doesn’t have to know about the preprocessing pipeline.