Using latest tensorflow version

Hi,I am currently using tensorflow version 2.10 with windows native, so coudn’t use some other keras and tesnsorflow ass on modules, can anyone suggets how to use the most current tensorflow version?(this old version provides gpu support) but new doesn’t i am using virtual environment to use 2.10

Does this page help you:

1 Like

if you are using virtual environment and the latest version is not supporting gpu, then check the info it provides on why it is not able to use gpu, that can help you to get to resolve the issue.

1 Like

I WILL try but is everyone using latest tensorflow with gpu support on windows native normally?

i tried the windows native from here but i am now trying to setup using WSL2 but some memory issues are throwing up

you need to share screenshot of the error you are getting while you trying to install tf. also let us know the version of python you are using

i am using python 3.10.16 tensorflow 2.10.1
error is i cannot use the augemntations like sharpness,brightness or any other, 2.10.1 only have flipping and cropping and rotaion but i need other augmentations like gaussian noise,blur etc provided in keras documentation

did you not try pip install keras?

import keras
import tensorflow as tf
from keras import layers

data_augmentation = tf.keras.Sequential([
    layers.RandomFlip(
        mode="horizontal_and_vertical",
        seed=None
    ),

    layers.RandomRotation(
        factor=0.2,
        fill_mode="reflect",
        interpolation="bilinear",
        seed=None
    ),
    layers.RandomShear(
        x_factor=0.1,
        y_factor=0.1,
        interpolation="bilinear",
        fill_mode="reflect",
        fill_value=0.0,
        seed=None
    ),

    layers.RandomBrightness(
        factor=0.2,
        value_range=(0, 255),
        seed=None
    ),

    layers.RandomSharpness(
        factor=1.0,
        value_range=(0, 255),
        seed=None
    ),

    layers.RandomColorJitter(
        brightness_factor=0.2,
        contrast_factor=0.2,
        saturation_factor=0.2,
        hue_factor=0.1,
        value_range=(0, 255),
        seed=None
    ),
    layers.GaussianNoise(
        stddev=0.05
    ),
])

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[17], line 16
      1 import tensorflow as tf
      2 from keras import layers
      4 data_augmentation = tf.keras.Sequential([
      5     layers.RandomFlip(
      6         mode="horizontal_and_vertical",
      7         seed=None
      8     ),
      9 
     10     layers.RandomRotation(
     11         factor=0.2,
     12         fill_mode="reflect",
     13         interpolation="bilinear",
     14         seed=None
     15     ),
---> 16     layers.RandomShear(
     17         x_factor=0.1,
     18         y_factor=0.1,
     19         interpolation="bilinear",
     20         fill_mode="reflect",
     21         fill_value=0.0,
     22         seed=None
     23     ),
     24 
     25     layers.RandomBrightness(
     26         factor=0.2,
     27         value_range=(0, 255),
     28         seed=None
     29     ),
     30 
     31     layers.RandomSharpness(
     32         factor=1.0,
     33         value_range=(0, 255),
     34         seed=None
     35     ),
     36 
     37     layers.RandomColorJitter(
     38         brightness_factor=0.2,
     39         contrast_factor=0.2,
     40         saturation_factor=0.2,
     41         hue_factor=0.1,
     42         value_range=(0, 255),
     43         seed=None
     44     ),
     45     layers.GaussianNoise(
     46         stddev=0.05
     47     ),
     48 ])

AttributeError: module 'keras.layers' has no attribute 'RandomShear'

i installed keras separately aslo

not this way, nah

then how?

the below link will provide you the version match of tf with your python version depending on you have windows, Linux or macos.

Then after you do that notice the documentation, for the GPU setup, then cross check with your system configuration if it fulfills the criteria. if not, use pip install method to download the necessary lib based on the error you get.

#pip install keras==3(check the version match between your python version, tf version and keras version compatibility). Usual issue with GPU support come with Jax or torch or cuda library dependencies. you will know if you have this issue, when you try to install them, it will provide you info if error comes out.

Then you can use your import statement

okay i will try this

Hello, @SASWATA_MAITY,

As indicated in DP’s link,

Therefore, because you need TF > 2.10, windows native is a dead end. I think below are some key steps you will need to get through:

  1. Fix whatever memory issue you mentioned. If you don’t know how, you probably want to ask in the Microsoft’s community or the Ubuntu’s.

  2. Study the links in the following section, including the NVIDIA’s.

  3. Study this guide for NVidia GPU + Tensorflow + WSL2

  4. After studying them, I believe you will find the steps most relevant to your case.

Good luck.

Raymond

Btw, I recommend to start clean with a new Ubuntu distro for my 4 steps above instead of any existing one so that you can fall back to any of them easily.

so you are telling to use a ubuntu vm?


at step 4 from your provided link this happened all the previous steps executed properly and after this no other steps is executable. nvdia-smi shows my gpu

I suggest you to look for help in the NVidia’s community. :wink: