starcoder icon indicating copy to clipboard operation
starcoder copied to clipboard

how to make it work on 2 11G 2080ti?

Open BEILOP opened this issue 2 years ago • 1 comments

how to change this code to make it work on 2 11G 2080ti?:

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoder")
# for fp16 replace with  `load_in_8bit=True` with   `torch_dtype=torch.float16`
model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder", device_map="auto", load_in_8bit=True)
print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")

BEILOP avatar Jun 09 '23 10:06 BEILOP

You should try to update transformers (>= 4.31.0.dev0) , accelerate (>=0.21.0.dev0) and bitsandbytes. And instead of loading in 8 bit, try to use

model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder", device_map="auto", load_in_4bit=True)

ArmelRandy avatar Jun 28 '23 10:06 ArmelRandy