Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Sparsity fix (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgshaw2-neuralmagic authored Feb 22, 2024
1 parent 8d935be commit acb8615
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 7 additions & 0 deletions examples/offline_inference_sparse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from vllm import LLM, SamplingParams

model = LLM("nm-testing/TinyLlama-1.1B-Chat-v1.0-pruned2.4", sparsity="sparse_w16a16")

sampling_params = SamplingParams(max_tokens=100, temperature=0)
outputs = model.generate("Hello my name is", sampling_params=sampling_params)
print(outputs[0].outputs[0].text)
4 changes: 2 additions & 2 deletions vllm/engine/arg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def create_engine_configs(
self.download_dir, self.load_format,
self.dtype, self.seed, self.revision,
self.code_revision, self.tokenizer_revision,
self.max_model_len, self.sparsity,
self.quantization, self.enforce_eager,
self.max_model_len, self.quantization,
self.sparsity, self.enforce_eager,
self.max_context_len_to_capture)
cache_config = CacheConfig(self.block_size,
self.gpu_memory_utilization,
Expand Down
5 changes: 1 addition & 4 deletions vllm/model_executor/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ def get_model(model_config: ModelConfig,
f"{supported_dtypes}")
linear_method = quant_config.get_linear_method()
if model_config.sparsity is not None:
sparse_config = get_sparse_config(model_config.sparsity,
model_config.model,
model_config.hf_config,
model_config.download_dir)
sparse_config = get_sparse_config(model_config)
capability = torch.cuda.get_device_capability()
capability = capability[0] * 10 + capability[1]
if capability < sparse_config.get_min_capability():
Expand Down

0 comments on commit acb8615

Please sign in to comment.