improving warning message and adding further tips for installation (#204)

This commit is contained in:
Ronghang Hu
2024-08-12 11:37:41 -07:00
committed by GitHub
parent 1034ee2a1a
commit dce7b5446f
5 changed files with 84 additions and 40 deletions

View File

@@ -105,8 +105,9 @@ class SAM2Transforms(nn.Module):
except Exception as e:
# Skip the post-processing step if the CUDA kernel fails
warnings.warn(
f"{e}\n\nSkipping the post-processing step due to the error above. "
"Consider building SAM 2 with CUDA extension to enable post-processing (see "
f"{e}\n\nSkipping the post-processing step due to the error above. You can "
"still use SAM 2 and it's OK to ignore the error above, although some post-processing "
"functionality may be limited (which doesn't affect the results in most cases; see "
"https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md).",
category=UserWarning,
stacklevel=2,