Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "convaiinnovations/gemma3-sales-coach",
6 torch_dtype=torch.float16,
7 device_map="auto"
8)
9tokenizer = AutoTokenizer.from_pretrained("convaiinnovations/gemma3-sales-coach")
10
11# Format your conversation as instruction
12conversation = '''[Turn 1] Sales Rep: Hi Sarah, this is Mike from CloudTech Solutions. How are you today?
13[Turn 2] Prospect: I'm busy. What's this about?
14[Turn 3] Sales Rep: Great! I wanted to tell you about our amazing cloud platform. It's the best in the market!
15[Turn 4] Prospect: We already have AWS. Why would we switch?
16[Turn 5] Sales Rep: Well, our platform is much better than AWS in every way.
17[Turn 6] Prospect: That's a bold claim. Can you be more specific?
18[Turn 7] Sales Rep: We have better uptime and support. Anyway, pricing starts at $10,000 per month.
19[Turn 8] Prospect: That's expensive. What's included?
20[Turn 9] Sales Rep: Everything you need. Trust me, it's worth it.
21[Turn 10] Prospect: I'd need to see some case studies or ROI data.
22[Turn 11] Sales Rep: I can send those later. So, are you ready to schedule a demo?
23[Turn 12] Prospect: I don't think so. Send me some materials and I'll review when I have time.
24
25Where did I make mistakes and how can I improve?'''
26
27# Apply chat template (instruction format)
28messages = [{"role": "user", "content": conversation}]
29prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
30
31inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
32outputs = model.generate(
33 **inputs,
34 max_new_tokens=512,
35 temperature=0.7,
36 do_sample=True
37)
38print(tokenizer.decode(outputs[0], skip_special_tokens=True))