@@ -547,6 +547,42 @@ def print_extra_newline(self):
547
547
return True
548
548
549
549
550
+ class PromptFormat_granite3 (PromptFormat ):
551
+ description = "Granite 3"
552
+
553
+ def __init__ (self ):
554
+ super ().__init__ ()
555
+ pass
556
+
557
+ def default_system_prompt (self ):
558
+ return "You are Granite, developed by IBM. You are a helpful AI assistant."
559
+
560
+ def first_prompt (self , sysprompt ):
561
+ r = ""
562
+ if sysprompt :
563
+ r += """<|start_of_role|>system<|end_of_role|>|system_prompt|><|end_of_text|>"""
564
+ r += """<|start_of_role|>user<|end_of_role|><|user_prompt|><|end_of_text|>"""
565
+ r += """<|start_of_role|>assistant<|end_of_role|>"""
566
+ return r
567
+
568
+ def subs_prompt (self ):
569
+ r = ""
570
+ r += """<|start_of_role|>user<|end_of_role|><|user_prompt|><|end_of_text|>"""
571
+ r += """<|start_of_role|>assistant<|end_of_role|>"""
572
+ return r
573
+
574
+ def stop_conditions (self , tokenizer ):
575
+ return [
576
+ tokenizer .eos_token_id ,
577
+ ]
578
+
579
+ def encoding_options (self ):
580
+ return True , False , True
581
+
582
+ def print_extra_newline (self ):
583
+ return True
584
+
585
+
550
586
class PromptFormat_cohere (PromptFormat ):
551
587
description = "Cohere"
552
588
@@ -610,4 +646,5 @@ def print_extra_newline(self):
610
646
"cohere" : PromptFormat_cohere ,
611
647
"phi3" : PromptFormat_phi3 ,
612
648
"granite" : PromptFormat_granite ,
649
+ "granite3" : PromptFormat_granite3 ,
613
650
}
0 commit comments