MCPcopy
hub / github.com/huggingface/alignment-handbook / setUp

Method setUp

tests/test_data.py:87–122  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85
86class ApplyChatTemplateTest(unittest.TestCase):
87 def setUp(self):
88 model_args = ModelArguments(model_name_or_path="HuggingFaceH4/zephyr-7b-alpha")
89 data_args = DataArguments()
90 self.tokenizer = get_tokenizer(model_args, data_args)
91 self.dataset = Dataset.from_dict(
92 {
93 "prompt": ["Hello!"],
94 "messages": [
95 [
96 {"role": "system", "content": "You are a happy chatbot"},
97 {"role": "user", "content": "Hello!"},
98 {"role": "assistant", "content": "Bonjour!"},
99 {"role": "user", "content": "How are you?"},
100 {"role": "assistant", "content": "I am doing well, thanks!"},
101 ]
102 ],
103 "chosen": [
104 [
105 {"role": "system", "content": "You are a happy chatbot"},
106 {"role": "user", "content": "Hello!"},
107 {"role": "assistant", "content": "Bonjour!"},
108 {"role": "user", "content": "How are you?"},
109 {"role": "assistant", "content": "I am doing well, thanks!"},
110 ]
111 ],
112 "rejected": [
113 [
114 {"role": "system", "content": "You are a happy chatbot"},
115 {"role": "user", "content": "Hello!"},
116 {"role": "assistant", "content": "Bonjour!"},
117 {"role": "user", "content": "How are you?"},
118 {"role": "assistant", "content": "Not so good tbh"},
119 ]
120 ],
121 }
122 )
123
124 def test_maybe_insert_system_message(self):
125 # Chat template that does not accept system prompt. Use community checkpoint since it has no HF token requirement

Callers

nothing calls this directly

Calls 3

ModelArgumentsClass · 0.90
DataArgumentsClass · 0.90
get_tokenizerFunction · 0.90

Tested by

no test coverage detected