File size: 859 Bytes
8bbaad9
 
711307f
 
8bbaad9
711307f
 
 
 
 
 
 
 
 
 
 
 
3c61c62
 
 
 
 
711307f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---
license: apache-2.0
tags:
- text-generation-inference
---

This is an upscaled fp16 variant of the original Llama-2-7b base model by Meta after it has been loaded with nf4 4-bit quantization via bitsandbytes.
The main idea here is to upscale the linear4bit layers to fp16 so that the quantization/dequantization cost doesn't have to paid for each forward pass at inference time.

_Note: The quantization operation to nf4 is not lossless, so the model weights for the linear layers are lossy, which means that this model will not work as well as the official base model._

To use this model, you can just load it via `transformers` in fp16:

```python
import torch
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
  "arnavgrg/llama-2-7b-nf4-fp16-upscaled",
  device_map="auto",
  torch_dtype=torch.float16,
)
```