Download GPU_test.py from privateboss/Car_Race_AI_V0: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/privateboss/Car_Race_AI_V0/resolve/main/GPU_test.py
- Command line
-
hf download hf://privateboss/Car_Race_AI_V0/GPU_test.py
-
curl -L -o GPU_test.py https://huggingface.co/privateboss/Car_Race_AI_V0/resolve/main/GPU_test.py
611 Bytes
| import tensorflow as tf | |
| print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU'))) | |
| gpus = tf.config.list_physical_devices('GPU') | |
| if gpus: | |
| try: | |
| # | |
| for gpu in gpus: | |
| tf.config.experimental.set_memory_growth(gpu, True) | |
| logical_gpus = tf.config.experimental.list_logical_devices('GPU') | |
| print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs") | |
| except RuntimeError as e: | |
| print(e) | |
| import gymnasium as gym | |
| env = gym.make("CarRacing-v3", render_mode="rgb_array") | |
| print("CarRacing-v3 environment created successfully.") | |
| env.close() |