Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
|
3 |
+
import torch
|
4 |
+
|
5 |
+
model_path = 'efficient-llm/vicuna-13b-v1.3-wanda'
|
6 |
+
config = AutoConfig.from_pretrained(model_path, revision='0.5_2to4', trust_remote_code=True)
|
7 |
+
enc = AutoTokenizer.from_pretrained('lmsys/vicuna-13b-v1.3', trust_remote_code=True)
|
8 |
+
kwargs = {"torch_dtype": torch.float16, "low_cpu_mem_usage": True}
|
9 |
+
model = AutoModelForCausalLM.from_pretrained(
|
10 |
+
model_path, config=config, trust_remote_code=True, device_map='auto', revision='0.5_2to4', **kwargs)
|
11 |
+
|
12 |
+
model.eval()
|
13 |
+
input_ids = enc('How are you today?', return_tensors='pt').input_ids.to('cuda')
|
14 |
+
outputs = model.generate(input_ids=input_ids, max_length=128)
|
15 |
+
print(enc.decode(outputs[0]))
|
16 |
+
```
|