Views
No views yet
What are the main differences between Type 1 and Type 2 diabetes, and how do their treatment approaches differ?"
Medicine
apply_chat_template to show you how to load the tokenizer and model and how to generate contents.1import torch
2from transformers import DebertaV2Tokenizer,DebertaV2ForSequenceClassification, Trainer, TrainingArguments
3
4model = DebertaV2ForSequenceClassification.from_pretrained('deberta_cls', num_labels=33).cuda()
5tokenizer = DebertaV2Tokenizer.from_pretrained('alibaba-pai/Instruction-Tagger')
6
7labels={14: 'Writting',
8 0: 'Common-Sense',
9 28: 'Ecology',
10 22: 'Medicine',
11 17: 'Grammar',
12 3: 'Code Generation',
13 31: 'Others',
14 20: 'Paraphrase',
15 19: 'Economy',
16 6: 'Code Debug',
17 21: 'Reasoning',
18 18: 'Computer Science',
19 4: 'Technology',
20 13: 'Math',
21 32: 'Literature',
22 26: 'Chemistry',
23 15: 'Complex Format',
24 25: 'Ethics',
25 27: 'Multilingual',
26 29: 'Roleplay',
27 30: 'Entertainment',
28 23: 'Biology',
29 16: 'Art',
30 10: 'Academic Writing',
31 24: 'Health',
32 11: 'Philosophy',
33 5: 'Sport',
34 1: 'History',
35 12: 'Music',
36 7: 'Toxicity',
37 2: 'Law',
38 9: 'Physics',
39 8: 'Counterfactual'}
40
41def task_cls(pp):
42 inputs = tokenizer(pp, return_tensors="pt",padding=True).to("cuda")
43
44 with torch.no_grad():
45 logits = model(**inputs).logits
46
47 predicted_class_id = logits.argmax().item()
48
49 return labels[predicted_class_id]
50
51instruct="""
52What are the main differences between Type 1 and Type 2 diabetes, and how do their treatment approaches differ?"
53"""
54
55tag=task_cls(instruct)@misc{TAPIR,
title={Distilling Instruction-following Abilities of Large Language Models with Task-aware Curriculum Planning},
author={Yuanhao Yue and Chengyu Wang and Jun Huang and Peng Wang},
year={2024},
eprint={2405.13448},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2405.13448},
}