Update (base update)

[ghstack-poisoned]
This commit is contained in:
Xuehai Pan 2025-02-06 02:43:15 +08:00
parent 8324795078
commit 063cdcfbf7
2 changed files with 5 additions and 8 deletions

View file

@ -1340,11 +1340,7 @@ def load(
... weights_only=True,
... ) # type: ignore[attr-defined]
# Map tensors from GPU 1 to GPU 0
>>> torch.load(
... "tensors.pt",
... map_location={"cuda:1": "cuda:0"},
... weights_only=True,
... )
>>> torch.load("tensors.pt", map_location={"cuda:1": "cuda:0"}, weights_only=True)
# Load tensor from io.BytesIO object
# Loading from a buffer setting weights_only=False, warning this can be unsafe
>>> with open("tensor.pt", "rb") as f:

View file

@ -39,9 +39,10 @@ def use_const_ref_for_mutable_tensors() -> bool:
def use_ilistref_for_tensor_lists() -> bool:
assert (
_locals.use_ilistref_for_tensor_lists is not None
), "need to initialize local.use_ilistref_for_tensor_lists with local.parametrize"
assert _locals.use_ilistref_for_tensor_lists is not None, (
"need to initialize local.use_ilistref_for_tensor_lists with "
"local.parametrize"
)
return _locals.use_ilistref_for_tensor_lists