powered by
Loads an safetensors file from disk.
safe_load_file(path, ..., framework = "torch", device = "cpu")
A list with tensors in the file. The metadata attribute can be used to find metadata the metadata header in the file.
metadata
Path to the file to load
Unused
Framework to load the data into. Currently only torch is supported
Device to copy data once loaded
safetensors, safe_save_file()
safe_save_file()
if (rlang::is_installed("torch") && torch::torch_is_installed()) { tensors <- list(x = torch::torch_randn(10, 10)) temp <- tempfile() safe_save_file(tensors, temp) safe_load_file(temp) }
Run the code above in your browser using DataLab