Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maifeeulasad/741df3cf99a9970ce7a4897d5583b223 to your computer and use it in GitHub Desktop.

Select an option

Save maifeeulasad/741df3cf99a9970ce7a4897d5583b223 to your computer and use it in GitHub Desktop.
safetensors-benchmarking.ipynb
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[],"dockerImageVersionId":31193,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!git clone https://github.com/maifeeulasad/safetensors.git && cd safetensors && git checkout nvidia-gds-support-maifee","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:24.260597Z","iopub.execute_input":"2025-12-12T09:50:24.260761Z","iopub.status.idle":"2025-12-12T09:50:25.962567Z","shell.execute_reply.started":"2025-12-12T09:50:24.260746Z","shell.execute_reply":"2025-12-12T09:50:25.961875Z"}},"outputs":[{"name":"stdout","text":"Cloning into 'safetensors'...\nremote: Enumerating objects: 6300, done.\u001b[K\nremote: Counting objects: 100% (176/176), done.\u001b[K\nremote: Compressing objects: 100% (91/91), done.\u001b[K\nremote: Total 6300 (delta 103), reused 116 (delta 71), pack-reused 6124 (from 4)\u001b[K\nReceiving objects: 100% (6300/6300), 2.41 MiB | 21.28 MiB/s, done.\nResolving deltas: 100% (3031/3031), done.\nBranch 'nvidia-gds-support-maifee' set up to track remote branch 'nvidia-gds-support-maifee' from 'origin'.\nSwitched to a new branch 'nvidia-gds-support-maifee'\n","output_type":"stream"}],"execution_count":1},{"cell_type":"code","source":"!ldconfig -p | grep -i cufile","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:25.964611Z","iopub.execute_input":"2025-12-12T09:50:25.964838Z","iopub.status.idle":"2025-12-12T09:50:26.097391Z","shell.execute_reply.started":"2025-12-12T09:50:25.964809Z","shell.execute_reply":"2025-12-12T09:50:26.096613Z"}},"outputs":[{"name":"stdout","text":"\tlibcufile_rdma.so.1 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile_rdma.so.1\n\tlibcufile_rdma.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile_rdma.so\n\tlibcufile.so.0 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile.so.0\n\tlibcufile.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile.so\n","output_type":"stream"}],"execution_count":2},{"cell_type":"code","source":"!python3 -m pip show safetensors","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:26.098553Z","iopub.execute_input":"2025-12-12T09:50:26.098840Z","iopub.status.idle":"2025-12-12T09:50:28.883689Z","shell.execute_reply.started":"2025-12-12T09:50:26.098808Z","shell.execute_reply":"2025-12-12T09:50:28.882814Z"}},"outputs":[{"name":"stdout","text":"Name: safetensors\nVersion: 0.5.3\nSummary: \nHome-page: https://github.com/huggingface/safetensors\nAuthor: \nAuthor-email: Nicolas Patry <[email protected]>\nLicense: \nLocation: /usr/local/lib/python3.11/dist-packages\nRequires: \nRequired-by: accelerate, diffusers, peft, timm, torchtune, transformers\n","output_type":"stream"}],"execution_count":3},{"cell_type":"code","source":"!python3 -m pip uninstall -y safetensors --break-system-packages","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:28.884824Z","iopub.execute_input":"2025-12-12T09:50:28.885532Z","iopub.status.idle":"2025-12-12T09:50:30.419071Z","shell.execute_reply.started":"2025-12-12T09:50:28.885495Z","shell.execute_reply":"2025-12-12T09:50:30.418114Z"}},"outputs":[{"name":"stdout","text":"Found existing installation: safetensors 0.5.3\nUninstalling safetensors-0.5.3:\n Successfully uninstalled safetensors-0.5.3\n","output_type":"stream"}],"execution_count":4},{"cell_type":"code","source":"!python3 -m pip show safetensors","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:30.420193Z","iopub.execute_input":"2025-12-12T09:50:30.420508Z","iopub.status.idle":"2025-12-12T09:50:31.272231Z","shell.execute_reply.started":"2025-12-12T09:50:30.420474Z","shell.execute_reply":"2025-12-12T09:50:31.271516Z"}},"outputs":[{"name":"stdout","text":"\u001b[33mWARNING: Package(s) not found: safetensors\u001b[0m\u001b[33m\n\u001b[0m","output_type":"stream"}],"execution_count":5},{"cell_type":"code","source":"!apt install curl -y\n!curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n!bash -lc \"source $HOME/.cargo/env && cargo --version\"\n!python3 -m pip install maturin --break-system-packages","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:50:31.273273Z","iopub.execute_input":"2025-12-12T09:50:31.273521Z","iopub.status.idle":"2025-12-12T09:51:04.297415Z","shell.execute_reply.started":"2025-12-12T09:50:31.273496Z","shell.execute_reply":"2025-12-12T09:51:04.296708Z"}},"outputs":[{"name":"stdout","text":"Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following additional packages will be installed:\n libcurl4 libcurl4-openssl-dev\nSuggested packages:\n libcurl4-doc libidn11-dev libldap2-dev librtmp-dev\nThe following packages will be upgraded:\n curl libcurl4 libcurl4-openssl-dev\n3 upgraded, 0 newly installed, 0 to remove and 162 not upgraded.\nNeed to get 870 kB of archives.\nAfter this operation, 0 B of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4-openssl-dev amd64 7.81.0-1ubuntu1.21 [386 kB]\nGet:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.21 [194 kB]\nGet:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4 amd64 7.81.0-1ubuntu1.21 [290 kB]\nFetched 870 kB in 5s (179 kB/s) \u001b[0m\u001b[33m\n\n(Reading database ... 128639 files and directories currently installed.)\nPreparing to unpack .../libcurl4-openssl-dev_7.81.0-1ubuntu1.21_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 0%]\u001b[49m\u001b[39m [..........................................................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 8%]\u001b[49m\u001b[39m [####......................................................] \u001b8Unpacking libcurl4-openssl-dev:amd64 (7.81.0-1ubuntu1.21) over (7.81.0-1ubuntu1.20) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 15%]\u001b[49m\u001b[39m [########..................................................] \u001b8Preparing to unpack .../curl_7.81.0-1ubuntu1.21_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 23%]\u001b[49m\u001b[39m [#############.............................................] \u001b8Unpacking curl (7.81.0-1ubuntu1.21) over (7.81.0-1ubuntu1.20) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 31%]\u001b[49m\u001b[39m [#################.........................................] \u001b8Preparing to unpack .../libcurl4_7.81.0-1ubuntu1.21_amd64.deb ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 38%]\u001b[49m\u001b[39m [######################....................................] \u001b8Unpacking libcurl4:amd64 (7.81.0-1ubuntu1.21) over (7.81.0-1ubuntu1.20) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 46%]\u001b[49m\u001b[39m [##########################................................] \u001b8Setting up libcurl4:amd64 (7.81.0-1ubuntu1.21) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 54%]\u001b[49m\u001b[39m [###############################...........................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 62%]\u001b[49m\u001b[39m [###################################.......................] \u001b8Setting up curl (7.81.0-1ubuntu1.21) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 69%]\u001b[49m\u001b[39m [########################################..................] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 77%]\u001b[49m\u001b[39m [############################################..............] \u001b8Setting up libcurl4-openssl-dev:amd64 (7.81.0-1ubuntu1.21) ...\n\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 85%]\u001b[49m\u001b[39m [#################################################.........] \u001b8\u001b7\u001b[24;0f\u001b[42m\u001b[30mProgress: [ 92%]\u001b[49m\u001b[39m [#####################################################.....] \u001b8Processing triggers for man-db (2.10.2-1) ...\nProcessing triggers for libc-bin (2.35-0ubuntu3.8) ...\n/sbin/ldconfig.real: /usr/local/lib/libumf.so.0 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtcm_debug.so.1 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtcm.so.1 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libhwloc.so.15 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libur_loader.so.0 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libur_adapter_level_zero.so.0 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libur_adapter_opencl.so.0 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_5.so.3 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbbbind.so.3 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbbbind_2_0.so.3 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbb.so.12 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc_proxy.so.2 is not a symbolic link\n\n/sbin/ldconfig.real: /usr/local/lib/libtbbmalloc.so.2 is not a symbolic link\n\n\n\u001b7\u001b[0;24r\u001b8\u001b[1A\u001b[J\u001b[1minfo:\u001b[0m downloading installer\n\u001b[0m\u001b[1minfo: \u001b[0mprofile set to 'default'\n\u001b[0m\u001b[1minfo: \u001b[0mdefault host triple is x86_64-unknown-linux-gnu\n\u001b[0m\u001b[1minfo: \u001b[0msyncing channel updates for 'stable-x86_64-unknown-linux-gnu'\n\u001b[0m\u001b[1minfo: \u001b[0mlatest update on 2025-12-11, rust version 1.92.0 (ded5c06cf 2025-12-08)\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'cargo'\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'clippy'\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'rust-docs'\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'rust-std'\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'rustc'\n\u001b[0m\u001b[1minfo: \u001b[0mdownloading component 'rustfmt'\n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'cargo'\n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'clippy'\n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'rust-docs'\n 20.5 MiB / 20.5 MiB (100 %) 7.1 MiB/s in 2s \n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'rust-std'\n 28.0 MiB / 28.0 MiB (100 %) 10.7 MiB/s in 2s \n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'rustc'\n 74.3 MiB / 74.3 MiB (100 %) 11.8 MiB/s in 6s \n\u001b[0m\u001b[1minfo: \u001b[0minstalling component 'rustfmt'\n\u001b[0m\u001b[1minfo: \u001b[0mdefault toolchain set to 'stable-x86_64-unknown-linux-gnu'\n\n \u001b[0m\u001b[1m\u001b[0m\u001b[1m\u001b[32mstable-x86_64-unknown-linux-gnu installed\u001b[0m - rustc 1.92.0 (ded5c06cf 2025-12-08)\n\n\u001b[0m\u001b[1m\nRust is installed now. Great!\n\u001b[0m\nTo get started you may need to restart your current shell.\nThis would reload your \u001b[0m\u001b[1mPATH\u001b[0m environment variable to include\nCargo's bin directory ($HOME/.cargo/bin).\n\nTo configure your current shell, you need to source\nthe corresponding \u001b[0m\u001b[1menv\u001b[0m file under $HOME/.cargo.\n\nThis is usually done by running one of the following (note the leading DOT):\n. \"$HOME/.cargo/env\" # For sh/bash/zsh/ash/dash/pdksh\nsource \"$HOME/.cargo/env.fish\" # For fish\nsource $\"($nu.home-path)/.cargo/env.nu\" # For nushell\ncargo 1.92.0 (344c4567c 2025-10-21)\nCollecting maturin\n Downloading maturin-1.10.2-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl.metadata (16 kB)\nDownloading maturin-1.10.2-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl (9.2 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.2/9.2 MB\u001b[0m \u001b[31m120.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[?25hInstalling collected packages: maturin\nSuccessfully installed maturin-1.10.2\n","output_type":"stream"}],"execution_count":6},{"cell_type":"code","source":"!bash -lc \"source $HOME/.cargo/env && cd safetensors/bindings/python/ && cargo build --release && python3 -m pip install -e . --no-build-isolation --break-system-packages\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:51:04.299725Z","iopub.execute_input":"2025-12-12T09:51:04.300011Z","iopub.status.idle":"2025-12-12T09:51:42.979701Z","shell.execute_reply.started":"2025-12-12T09:51:04.299987Z","shell.execute_reply":"2025-12-12T09:51:42.978748Z"}},"outputs":[{"name":"stdout","text":"\u001b[1m\u001b[92m Updating\u001b[0m crates.io index\n\u001b[K\u001b[1m\u001b[92m Locking\u001b[0m 32 packages to latest compatible versionsete; 0 pending \n\u001b[1m\u001b[92m Adding\u001b[0m pyo3 v0.25.1 \u001b[1m\u001b[33m(available: v0.27.2)\u001b[0m\n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m itoa v1.0.15 \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m unicode-ident v1.0.22es: 6.8KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m unindent v0.2.4ng bytes: 935.7KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m ryu v1.0.20aining bytes: 2.0MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m memmap2 v0.9.9ing bytes: 2.5MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m serde_derive v1.0.228es: 2.2MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m serde v1.0.228ing bytes: 2.1MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m pyo3-ffi v0.25.1g bytes: 1.9MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m hashbrown v0.16.1 bytes: 1.8MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m once_cell v1.21.3 bytes: 1.7MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m memchr v2.7.6ning bytes: 1.7MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m rustversion v1.0.22ytes: 1.6MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m quote v1.0.42ning bytes: 1.5MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m memoffset v0.9.1g bytes: 1.4MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m target-lexicon v0.13.3s: 1.3MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m serde_core v1.0.228ytes: 1.2MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m pyo3-macros v0.25.1ytes: 1.1MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m pyo3-build-config v0.25.11.0MiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m proc-macro2 v1.0.103tes: 958.5KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m pyo3-macros-backend v0.25.18.7KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m serde_json v1.0.145ytes: 798.7KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m indoc v2.0.7ning bytes: 720.1KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m foldhash v0.2.0g bytes: 688.1KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m equivalent v1.0.2bytes: 624.1KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m autocfg v1.5.0ng bytes: 544.3KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m heck v0.5.0ining bytes: 496.3KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m libc v0.2.178ing bytes: 444.3KiB \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m syn v2.0.111cting libc ... \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m allocator-api2 v0.2.21 \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m pyo3 v0.25.1 \n\u001b[K\u001b[1m\u001b[92m Downloaded\u001b[0m 30 crates (3.3MiB) in 0.24s (largest was `pyo3` at 1.1MiB) \n\u001b[1m\u001b[92m Compiling\u001b[0m target-lexicon v0.13.3\n\u001b[1m\u001b[92m Compiling\u001b[0m once_cell v1.21.3\n\u001b[1m\u001b[92m Compiling\u001b[0m proc-macro2 v1.0.103\n\u001b[1m\u001b[92m Compiling\u001b[0m quote v1.0.42\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m unicode-ident v1.0.22 ] 0/58: proc-macro2(build.rs), quot…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m serde_core v1.0.228 ] 3/58: proc-macro2(build), quote(b…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m libc v0.2.178 ] 4/58: proc-macro2(build), unicode…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m autocfg v1.5.0 ] 11/58: libc(build), serde_core, pr…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m pyo3-build-config v0.25.1] 12/58: autocfg, serde_core, proc-m…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m memoffset v0.9.1 ] 14/58: serde_core, pyo3-build-conf…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m syn v2.0.111 ] 16/58: libc, serde_core, pyo3-buil…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m serde_json v1.0.145 ] 19/58: libc, serde_core, syn, pyo3…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m heck v0.5.0 ] 20/58: serde_core, syn, pyo3-build…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m pyo3-ffi v0.25.1 ] 21/58: serde_core, heck, syn, pyo3…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m pyo3-macros-backend v0.25.122/58: serde_core, heck, syn, pyo3…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m serde v1.0.228 ] 24/58: serde_core, pyo3-ffi(build)…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m pyo3 v0.25.1 ] 26/58: pyo3-macros-backend(build),…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m allocator-api2 v0.2.21 ] 30/58: serde_core, syn, serde(buil…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m itoa v1.0.15 ] 31/58: serde_core, syn, serde(buil…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m foldhash v0.2.0 ] 32/58: serde_core, itoa, syn, allo…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m ryu v1.0.20=> ] 33/58: serde_core, syn, foldhash, …\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m memchr v2.7.6 ] 34/58: serde_core, syn, foldhash, …\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m equivalent v1.0.2 ] 35/58: serde_core, syn, memchr, ryu\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m hashbrown v0.16.1 ] 36/58: syn, memchr, equivalent, ryu\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m unindent v0.2.4=> ] 41/58: syn, memchr, hashbrown, ser…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m indoc v2.0.7====> ] 42/58: unindent, syn, memchr, serd…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m safetensors-python v0.7.0-dev.0 (/kaggle/working/safetensors/bindings/python)\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m memmap2 v0.9.9====> ] 46/58: safetensors-python(build), …\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m serde_derive v1.0.228 ] 50/58: pyo3-macros-backend, syn \n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m pyo3-macros v0.25.1=> ] 51/58: pyo3-macros-backend, serde_…\n\u001b[K\u001b[1m\u001b[92m Compiling\u001b[0m safetensors v0.7.0-dev.0 (/kaggle/working/safetensors/safetensors)\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `driver::GdsDriver`\u001b[0mtensors-python \n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/mod.rs:18:9\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m18\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub use driver::GdsDriver;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `error::GdsError`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/mod.rs:20:9\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m20\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub use error::GdsError;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `handle::GdsHandle`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/mod.rs:22:9\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m22\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub use handle::GdsHandle;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `result`\u001b[0m/58: safetensors-python \n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/handle.rs:78:21\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m78\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let result = cuFileHandleDeregister(self.handle);\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_result`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: method `is_initialized` is never used\u001b[0msors-python \n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/driver.rs:64:12\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m impl GdsDriver {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------\u001b[0m \u001b[1m\u001b[94mmethod in this implementation\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m64\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn is_initialized(&self) -> bool {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: method `fd` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/handle.rs:62:12\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m21\u001b[0m \u001b[1m\u001b[94m|\u001b[0m impl GdsHandle {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------\u001b[0m \u001b[1m\u001b[94mmethod in this implementation\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m62\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn fd(&self) -> i32 {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `path` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/storage.rs:11:5\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m9\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct GdsStorage {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m----------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m10\u001b[0m \u001b[1m\u001b[94m|\u001b[0m handle: GdsHandle,\n\u001b[1m\u001b[94m11\u001b[0m \u001b[1m\u001b[94m|\u001b[0m path: PathBuf,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: methods `path` and `size` are never used\u001b[0ms-python \n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/storage.rs:36:12\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m15\u001b[0m \u001b[1m\u001b[94m|\u001b[0m impl GdsStorage {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mmethods in this implementation\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m36\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn path(&self) -> &PathBuf {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m41\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn size(&self) -> usize {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: creating a shared reference to mutable static\u001b[0mhon \n \u001b[1m\u001b[94m--> \u001b[0msrc/gds/driver.rs:44:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m44\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m/\u001b[0m DRIVER_INSTANCE\n\u001b[1m\u001b[94m45\u001b[0m \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|\u001b[0m .clone()\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m|________________________^\u001b[0m \u001b[1m\u001b[33mshared reference to mutable static\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default\n\n\u001b[K\u001b[1m\u001b[33mwarning\u001b[0m: `safetensors-python` (lib) generated 9 warnings (run `cargo fix --lib -p safetensors-python` to apply 4 suggestions)\n\u001b[1m\u001b[92m Finished\u001b[0m `release` profile [optimized] target(s) in 22.41s\nObtaining file:///kaggle/working/safetensors/bindings/python\n Checking if build backend supports build_editable ... \u001b[?25l\u001b[?25hdone\n Preparing editable metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\nBuilding wheels for collected packages: safetensors\n Building editable for safetensors (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n Created wheel for safetensors: filename=safetensors-0.7.0.dev0-cp38-abi3-linux_x86_64.whl size=6229 sha256=65bac1816f65e371d16840419d92e2c0ebdb8b98b9087af9e507dd7fd5a3e0be\n Stored in directory: /tmp/pip-ephem-wheel-cache-q0838e51/wheels/7b/a2/0b/4271a442d9467d1746027a203c37e5acb1560b15b23ad36cfa\nSuccessfully built safetensors\nInstalling collected packages: safetensors\nSuccessfully installed safetensors-0.7.0.dev0\n","output_type":"stream"}],"execution_count":7},{"cell_type":"code","source":"!python3 -m pip show safetensors","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:51:42.980772Z","iopub.execute_input":"2025-12-12T09:51:42.981063Z","iopub.status.idle":"2025-12-12T09:51:44.981545Z","shell.execute_reply.started":"2025-12-12T09:51:42.981036Z","shell.execute_reply":"2025-12-12T09:51:44.980834Z"}},"outputs":[{"name":"stdout","text":"Name: safetensors\nVersion: 0.7.0.dev0\nSummary: \nHome-page: https://github.com/huggingface/safetensors\nAuthor: \nAuthor-email: Nicolas Patry <[email protected]>\nLicense: \nLocation: /usr/local/lib/python3.11/dist-packages\nEditable project location: /kaggle/working/safetensors/bindings/python\nRequires: \nRequired-by: accelerate, diffusers, peft, timm, torchtune, transformers\n","output_type":"stream"}],"execution_count":8},{"cell_type":"code","source":"!python3 safetensors/bindings/python/tests/test_gds.py","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:51:44.982535Z","iopub.execute_input":"2025-12-12T09:51:44.983391Z","iopub.status.idle":"2025-12-12T09:51:50.131902Z","shell.execute_reply.started":"2025-12-12T09:51:44.983359Z","shell.execute_reply":"2025-12-12T09:51:50.130942Z"}},"outputs":[{"name":"stdout","text":"test_gds_basic_loading (__main__.TestGDS.test_gds_basic_loading)\nTest basic GDS tensor loading to GPU. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_correctness (__main__.TestGDS.test_gds_correctness)\nTest that GDS loading produces correct results. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_cpu_device_error (__main__.TestGDS.test_gds_cpu_device_error)\nTest that GDS with CPU device raises an error. ... ok\ntest_gds_different_dtypes (__main__.TestGDS.test_gds_different_dtypes)\nTest GDS with different data types. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_large_tensor (__main__.TestGDS.test_gds_large_tensor)\nTest GDS with a large tensor to verify performance benefit. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_multiple_tensors (__main__.TestGDS.test_gds_multiple_tensors)\nTest loading multiple tensors with GDS. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_slicing_not_supported (__main__.TestGDS.test_gds_slicing_not_supported)\nTest that tensor slicing raises an error with GDS. ... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nERROR\ntest_gds_without_cuda (__main__.TestGDS.test_gds_without_cuda)\nTest that GDS without CUDA device fails gracefully. ... ok\n\n======================================================================\nERROR: test_gds_basic_loading (__main__.TestGDS.test_gds_basic_loading)\nTest basic GDS tensor loading to GPU.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 43, in test_gds_basic_loading\n with safe_open(self.test_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n======================================================================\nERROR: test_gds_correctness (__main__.TestGDS.test_gds_correctness)\nTest that GDS loading produces correct results.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 62, in test_gds_correctness\n with safe_open(self.test_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n======================================================================\nERROR: test_gds_different_dtypes (__main__.TestGDS.test_gds_different_dtypes)\nTest GDS with different data types.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 116, in test_gds_different_dtypes\n with safe_open(dtype_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n======================================================================\nERROR: test_gds_large_tensor (__main__.TestGDS.test_gds_large_tensor)\nTest GDS with a large tensor to verify performance benefit.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 137, in test_gds_large_tensor\n with safe_open(large_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n======================================================================\nERROR: test_gds_multiple_tensors (__main__.TestGDS.test_gds_multiple_tensors)\nTest loading multiple tensors with GDS.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 74, in test_gds_multiple_tensors\n with safe_open(self.test_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n======================================================================\nERROR: test_gds_slicing_not_supported (__main__.TestGDS.test_gds_slicing_not_supported)\nTest that tensor slicing raises an error with GDS.\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/tests/test_gds.py\", line 91, in test_gds_slicing_not_supported\n with safe_open(self.test_file.name, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n\n----------------------------------------------------------------------\nRan 8 tests in 0.922s\n\nFAILED (errors=6)\n","output_type":"stream"}],"execution_count":9},{"cell_type":"code","source":"!python3 safetensors/bindings/python/benches/test_gds.py","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-12T09:51:50.132882Z","iopub.execute_input":"2025-12-12T09:51:50.133208Z","iopub.status.idle":"2025-12-12T09:51:52.828043Z","shell.execute_reply.started":"2025-12-12T09:51:50.133171Z","shell.execute_reply":"2025-12-12T09:51:52.826966Z"}},"outputs":[{"name":"stdout","text":"\nBenchmarking 10 MB tensor...\n - Standard (mmap + GPU transfer)... 13.26 ms (754.3 MB/s)\n - GDS (NVMe + GPU)... cuFile operation 'cuFileHandleRegister' failed: err=5030, cu_err=0\nTraceback (most recent call last):\n File \"/kaggle/working/safetensors/bindings/python/benches/test_gds.py\", line 206, in <module>\n run_benchmark_suite()\n File \"/kaggle/working/safetensors/bindings/python/benches/test_gds.py\", line 130, in run_benchmark_suite\n time_gds = benchmark_gds_loading(filename, \"data\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/kaggle/working/safetensors/bindings/python/benches/test_gds.py\", line 94, in benchmark_gds_loading\n with safe_open(filename, framework=\"pt\", device=\"cuda:0\", use_gds=True) as f:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsafetensors_rust.SafetensorError: Failed to initialize GPU Direct Storage: cuFile error: err=5030, cuda_err=0 (check NVIDIA GDS documentation). Make sure libcufile.so is available and you have a supported NVIDIA GPU.\n","output_type":"stream"}],"execution_count":10}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment