Reload nvidia GPU driver

Reload nvidia GPU driver to fix "NVML: Driver/library version mismatch" error without rebooting. Source

The following command will switch the system into text (CLI) mode, reload the graphical driver, and then switch back to GUI mode.

sudo apt purge $DRIVER_TO_DELETE
sudo apt reinstall $DRIVER_OF_CHOICE

sudo systemctl isolate multi-user.target

lsmod | grep nvidia # - to identify the modules needing to be reloaded.
sudo moprobe --remove $ALL_MODULES_IDENTIFIED_ABOVE
sudo insmod $ALL_MODULES_IDENTIFIED_ABOVE

sudo systemctl isolate graphical.target