Preview:
%env PIP_ROOT_USER_ACTION=ignore
import os, time, torch, warnings

try:
    from rich import print
except ModuleNotFoundError:
    !pip install -q rich
    from rich import print

if torch.cuda.is_available():
    print(f"[green bold]\t{torch.cuda.is_available()=}")
else:
    print(f"[red bold]\t{torch.cuda.is_available()=}")

os.environ["TZ"] = "Asia/Shanghai"
try:
  time.tzset()
except AttributeError:
  ...  # Windows
try:
    from python_run_cmd import run_cmd
except ModuleNotFoundError:
    !pip install -q python-run-cmd watermark rich
    from python_run_cmd import run_cmd

%reload_ext watermark
warnings.filterwarnings("ignore")
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter