Comments (3)
@lizzzcai as it turns out, it can be! I re-did the code around this in #96 to be more effective, initializing the weights on the intended device from the start rather than copying them there. This should be the most efficient method possible.
from tensorizer.
Thank you for the bug report! I put up a change that should fix this issue here: #91.
This was caused by non-persistent buffers appearing on the CPU device instead of CUDA. Non-persistent buffers on a module are not touched during deserialization via deserializer.load_into_module(model)
, so they were remaining on the CPU while everything else was loaded to CUDA. The change adds an extra model = model.to(device)
so that any remaining non-persistent buffers are moved to a device matching the deserializer's device.
from tensorizer.
Hi @Eta0 thanks for your reply and fix, it is working from my testing.
Just curious and want to check if this model = model.to(device)
can be further avoided as I try to measure the time spent and it takes around 0.14-0.2 sec for a 7b model ("mistralai/Mistral-7B-Instruct-v0.1").
from tensorizer.
Related Issues (19)
- Release 2.9.0? HOT 2
- Jax support
- Support S3 auth via the EC2 Instance Metadata Service / AWS SSO temporary credentials HOT 1
- Is there support for downloading via s5? HOT 3
- Is it possible to serialize LoRA adapter bin / safetensors file? HOT 2
- Eager vs. Lazy Loading in Plaid Mode
- Add encryption and hash verification to tensorizer HOT 1
- missing dependency: serializer HOT 1
- Unintuitive behaviour of `verify_hash` parameter to `load_into_module`
- `mmap` issues with loading models form PVC as of `tensorizer` `v2.4`
- Support self-signed certificates in `CURLStreamFile` HOT 1
- Unexpected results on attention mask (Blip2ForConditionalGeneration) HOT 3
- Deserialisation issue: KeyError: "attribute 'bias' already exists" HOT 1
- Stability example should download all artifacts from S3 rather than HuggingFace Hub HOT 1
- ValueError: Tensor index in the file is empty HOT 3
- Tensorizer Serializer Image
- Tensorizer Support for Large Models( 70B+) that dont fit into a single GPU HOT 11
- support setting S3 region and signature version in stream_io
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorizer.