Giter Club home page Giter Club logo

Comments (4)

sampritipanda avatar sampritipanda commented on August 26, 2024

Here's a diff of the telemetry code I used to generate the timings:

diff --git a/vllm/lora/models.py b/vllm/lora/models.py
index 3e828568..ad09ecc3 100644
--- a/vllm/lora/models.py
+++ b/vllm/lora/models.py
@@ -217,6 +217,8 @@ class LoRAModel:
         """Create a LoRAModel from a dictionary of tensors."""
         pin_memory = str(device) == "cpu" and is_pin_memory_available()
         loras: Dict[str, LoRALayerWeights] = {}
+        import time
+        a = time.time()
         for tensor_name, tensor in tensors.items():
             module_name, is_lora_a = parse_fine_tuned_lora_name(tensor_name)
             if module_name not in loras:
@@ -258,8 +260,12 @@ class LoRAModel:
                     loras[module_name].lora_b = loras[
                         module_name].lora_b.pin_memory()

+        b = time.time()
+        print("Loaded lora(s) in ", b - a)
+
         for lora in loras.values():
             lora.optimize()
+        print("Optimized lora(s) in ", time.time() - b)
         return cls(lora_model_id, rank, loras, scaling_factor=scaling_factor)

     @classmethod

from vllm.

youkaichao avatar youkaichao commented on August 26, 2024

is it some general slowdown, or just slowdown when lora is used?

from vllm.

sampritipanda avatar sampritipanda commented on August 26, 2024

I only see this slowdown with lora loading functionality (from_lora_tensors function)

from vllm.

sampritipanda avatar sampritipanda commented on August 26, 2024

@youkaichao Coming back to this issue, do you know why LoRA's are always loaded on CPU:

For example, here:

lora = self._lora_model_cls.from_local_checkpoint(
lora_request.lora_local_path,
expected_lora_modules,
max_position_embeddings=self.max_position_embeddings,
lora_model_id=lora_request.lora_int_id,
device="cpu",
dtype=self.lora_config.lora_dtype,
target_embedding_padding=self.vocab_size +
self.lora_config.lora_extra_vocab_size,
embedding_modules=self.embedding_modules,
embedding_padding_modules=self.embedding_padding_modules,
)

It's hardcoded to use always use CPU even if the main model (self.device) is on cuda.

from vllm.

Related Issues (20)

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.