Add fallback for is_compiling (#6663)
Importing `torch.compiler.is_compiling` causes an error with an older
version of PyTorch.
This PR adds a fallback for `is_compiling` to use an equivalent function
of older PyTorch versions.
This will resolve #6656.
Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>