Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
2from peft import PeftModel
3
4# Load base model
5base_model = AutoModelForSequenceClassification.from_pretrained(
6 "NousResearch/Llama-2-7b-chat-hf",
7 load_in_4bit=True,
8 device_map="auto"
9)
10
11# Load LoRA adapters
12model = PeftModel.from_pretrained(
13 base_model,
14 "Suramya/Llama-2-7b-CloudLex-Intent-Detection"
15)
16
17tokenizer = AutoTokenizer.from_pretrained(
18 "Suramya/Llama-2-7b-CloudLex-Intent-Detection"
19)
20
21classifier = pipeline(
22 "text-classification",
23 model=model,
24 tokenizer=tokenizer
25)
26
27classifier("I'd like to schedule a demo for our law firm")