Lightning-AI / Lightning-AI/lit-llama

ImportError when trying to use 'Linear8bitLt' from 'lit_llama.quantization'

Open
#421 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
517
PR merge metrics
No merged PRs in 30d

Description

I'm encountering an error while trying to use bitsandbytes in lit-llama. Here's the error message:

Loading model ...
bin /home/mostafa/anaconda3/envs/ll/lib/python3.11/site-packages/bitsandbytes/libbitsandbytes_cuda117.so
Traceback (most recent call last):
File "/home/mostafa/programming/lit-llama/generate.py", line 170, in <module>
CLI(main)
File "/home/mostafa/anaconda3/envs/ll/lib/python3.11/site-packages/jsonargparse/_cli.py", line 85, in CLI
return _run_component(component, cfg_init)
File "/home/mostafa/anaconda3/envs/ll/lib/python3.11/site-packages/jsonargparse/_cli.py", line 147, in _run_component
return component(**cfg)
File "/home/mostafa/programming/lit-llama/generate.py", line 129, in main
with fabric.init_module(empty_init=True), quantization(mode=quantize):
File "/home/mostafa/anaconda3/envs/ll/lib/python3.11/contextlib.py", line 137, in enter
return next(self.gen)
File "/home/mostafa/programming/lit-llama/lit_llama/utils.py", line 142, in quantization
from .quantization import Linear8bitLt
ImportError: cannot import name 'Linear8bitLt' from 'lit_llama.quantization' (/home/mostafa/programming/lit-llama/lit_llama/quantization.py)

I receive this error when I run the following command:

python generate.py --quantize llm.int8 --prompt "Hello, my name is"

I'm using Python 3.11, and the error seems to be with importing 'Linear8bitLt' from 'lit_llama.quantization'. Could you please help me with this issue?

Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with python generate.py --quantize llm.int8 --prompt "Hello, my name is", then inspect lit_llama/utils.py around line 142, lit_llama/quantization.py, and the call from generate.py around line 129. Done means the llm.int8 path can import the expected symbol and proceed without this ImportError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.