Views
No views yet
meta-llama/Meta-Llama-3.1-8B-Instruct using QLoRA for two e-commerce tasks:meta-llama/Meta-Llama-3.1-8B-InstructPRODUCT: [real product title]
CATEGORY: [category]
PRICE: [price]
AVERAGE RATING: [X/5] (N reviews)
DESCRIPTION: [real product description]
FEATURES: [real product features]
CUSTOMER REVIEWS:
[★☆☆☆☆] [real review text]
[★★★★★] [real review text]
→ VERDICT: WINNER/LOSER/RISKY + full analysis1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5BASE_MODEL = "meta-llama/Meta-Llama-3.1-8B-Instruct"
6LORA_MODEL = "PanosAnag/llama-3.1-ecommerce-analyzer"
7
8bnb_config = BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_quant_type="nf4",
11 bnb_4bit_compute_dtype=torch.float16,
12)
13
14tokenizer = AutoTokenizer.from_pretrained(LORA_MODEL)
15model = AutoModelForCausalLM.from_pretrained(BASE_MODEL, quantization_config=bnb_config, device_map="auto")
16model = PeftModel.from_pretrained(model, LORA_MODEL)
17model.eval()