Coder Social home page Coder Social logo

Comments (3)

Eta0 avatar Eta0 commented on September 6, 2024 1

@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.

Eta0 avatar Eta0 commented on September 6, 2024

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.

lizzzcai avatar lizzzcai commented on September 6, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.