Przeglądaj źródła

Update safetensors.js

Lutz Roeder 2 lat temu
rodzic
commit
a3cfb0c7e4
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      source/safetensors.js

+ 5 - 1
source/safetensors.js

@@ -142,7 +142,11 @@ safetensors.Tensor = class {
         const size = obj.data_offsets[1] - obj.data_offsets[0];
         position += obj.data_offsets[0];
         stream.seek(position);
-        this.values = stream.read(size);
+        this._data = stream.stream(size);
+    }
+
+    get values() {
+        return this._data instanceof Uint8Array ? this._data : this._data.peek();
     }
 };