Can I use this model for my own purposes with the hardware?

#2
by Alex18d - opened

Can I use this model for my own purposes if my Core i7-6700 computer has 16 GB RAM and integrated video. Maybe I'm not making the right settings or I don't have the right hardware, so I get the error "RuntimeError: [enforce failed at ..\c10\core\impl\alloc_cpu.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 67108864 bytes."
Can you tell me if this model or another one will work for me to generate text by promts?

my main.py:

import torch
from transformers import AutoTokenizer, pipeline, logging
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig

model_name_or_path = "GPT/LLongMA-2-7B-GPTQ"
model_basename = "gptq_model-4bit-32g"

use_triton = False
device = "cuda:0" if torch.cuda.is_available() else "cpu" # use CPU if CUDA is not available

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)

model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
device=device,
use_triton=False,
use_safetensors=True,
torch_dtype=torch.float32,
trust_remote_code=True)

prompt = "Tell me about AI"
prompt_template=f'''{prompt}
'''

print("\n\n*** Generate:")

input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
print(tokenizer.decode(output[0]))

Inference can also be done using transformers' pipeline

Prevent printing spurious transformers error when using pipeline with AutoGPTQ

logging.set_verbosity(logging.CRITICAL)

print("*** Pipeline:")
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=512,
temperature=0.7,
top_p=0.95,
repetition_penalty=1.15
)

print(pipe(prompt_template)[0]['generated_text'])

I don't think an integrated GPU is going to provide enough VRAM

I suggest to try the GGML models instead.

Sign up or log in to comment