Views
No views yet
transformers>=4.33.0 and it can run on a consumer GPU, with less than 3GB of GPU RAM. The libraries optimum, auto-gptq, peft and accelerate should also be installed.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "daedalus314/Griffin-3B-GPTQ"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7quant_model = AutoModelForCausalLM.from_pretrained(model_id, device_map='auto')
8
9text = """### HUMAN:
10What is artifical intelligence?
11
12### RESPONSE:
13"""
14inputs = tokenizer(text, return_tensors="pt").to(0)
15
16out = quant_model.generate(
17 **inputs,
18 do_sample=True,
19 top_p=0.9,
20 temperature=0.9,
21 max_length=1024,
22)
23print(tokenizer.decode(out[0], skip_special_tokens=True))### HUMAN:
What is artifical intelligence?
### RESPONSE:
Artificial intelligence, or AI, refers to the ability of computers to perform tasks that typically require human intelligence, such as decision making, problem solving, and language understanding. AI has been used in various fields, including healthcare, manufacturing, and finance, among others.