Views
No views yet
Domain: {domain}\n{key: value, ...}\nOutput:1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model = AutoModelForCausalLM.from_pretrained("asrith05/finetuned_slm_t2_withdomain")
4tokenizer = AutoTokenizer.from_pretrained("asrith05/finetuned_slm_t2_withdomain")
5
6# Example: Sports with domain label
7prompt = '''Domain: sports
8Team1: Lakers, Score1: 108, Team2: Warriors, Score2: 90
9Output:'''
10
11inputs = tokenizer(prompt, return_tensors="pt")
12outputs = model.generate(**inputs, max_new_tokens=50, temperature=0.8)
13result = tokenizer.decode(outputs[0], skip_special_tokens=True)
14print(result)
15# Expected: "Domain: sports\nTeam1: Lakers, Score1: 108, Team2: Warriors, Score2: 90\nOutput: The Lakers defeated the Warriors with a final score of 108 to 90."Domain: sports
Team1: Mumbai Indians, Score1: 185, Team2: Chennai Super Kings, Score2: 180
Output: Mumbai Indians won against Chennai Super Kings with a score of 185 to 180.Domain: weather
City: Hyderabad, Temperature: 32, Condition: sunny, Day: Monday
Output: On Monday, Hyderabad experienced sunny weather with a temperature of 32 degrees.Domain: travel
Person: Priya, City: Bangalore, Transport: flight, Duration: 2
Output: Priya traveled to Bangalore by flight, which took 2 hours.Domain: movies
Movie: RRR, Genre: Action, Rating: 8.2, Year: 2022
Output: RRR is an Action movie from 2022 with a rating of 8.2.Domain: products
Product: OnePlus, Brand: OnePlus, Price: 45000, Rating: 4.3
Output: The OnePlus smartphone by OnePlus is priced at ₹45,000 with a rating of 4.3 stars.| Feature | Standard Model | With Domain Labels |
|---|---|---|
| Domain Context | Implicit | Explicit Labels |
| Generation Accuracy | Good | Enhanced |
| Domain Consistency | Variable | Guaranteed |
| Training Efficiency | Standard | Domain-Guided |
| Output Quality | Good | Domain-Optimized |
1@model{finetuned_slm_t2_withdomain,
2 title={Fine-tuned SLM T2 With Domain Labels: Multi-Domain Structured Data Generation},
3 author={Asrith},
4 year={2024},
5 url={https://huggingface.co/asrith05/finetuned_slm_t2_withdomain}
6}