Views
No views yet
TinyLlama/TinyLlama-1.1B-Chat-v1.0. It has been specifically instruction-tuned to act as an automated, highly structured parser for e-commerce product catalogs.[Category: X] [Target: Y] [Material/Style: Z].q_proj, v_projadamw_torchpeft and transformers libraries.1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5# 1. Load the base model
6base_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
7tokenizer = AutoTokenizer.from_pretrained(base_model_id)
8model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto", torch_dtype=torch.float16)
9
10# 2. Load the fine-tuned adapter
11repo_id = "ryanfrancis/smart-catalog-bot"
12model = PeftModel.from_pretrained(model, repo_id)
13
14# 3. Test the model
15prompt = "Product Description: A low-profile velvet sofa in emerald green with tapered wooden legs, perfect for a mid-century modern living room.\nTags:"
16inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
17
18# Generate with low temperature for strict formatting
19outputs = model.generate(**inputs, max_new_tokens=40, temperature=0.1)
20print(tokenizer.decode(outputs[0], skip_special_tokens=True))