Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Safetensors File Format

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

mlverse/safetensors

Repository files navigation

R-CMD-check

safetensors is a pure R implementation of thesafetensors file formatfor both reading and writing. It currently supports the {torch} and{pjrt} frameworks.

Installation

safetensors can be installed from CRAN with:

install.packages("safetensors")

The development version of safetensors fromGitHub with:

# install.packages("devtools")devtools::install_github("mlverse/safetensors")

Example

Here’s an example of writing and reading safetensors files incombination with torch:

library(torch)library(safetensors)tensors<-list(x= torch_randn(10,10),y= torch_ones(10,10))str(tensors)#> List of 2#>  $ x:Float [1:10, 1:10]#>  $ y:Float [1:10, 1:10]tmp<- tempfile()safe_save_file(tensors,tmp)tensors<- safe_load_file(tmp,framework="torch")str(tensors)#> List of 2#>  $ x:Float [1:10, 1:10]#>  $ y:Float [1:10, 1:10]#>  - attr(*, "metadata")=List of 2#>   ..$ x:List of 3#>   .. ..$ shape       : int [1:2] 10 10#>   .. ..$ dtype       : chr "F32"#>   .. ..$ data_offsets: int [1:2] 0 400#>   ..$ y:List of 3#>   .. ..$ shape       : int [1:2] 10 10#>   .. ..$ dtype       : chr "F32"#>   .. ..$ data_offsets: int [1:2] 400 800#>  - attr(*, "max_offset")= int 929

About

Safetensors File Format

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp