-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
prompter.py
2495 lines (2244 loc) · 127 KB
/
prompter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import ast
import copy
import time
import os
import traceback
# also supports imports from this file from other files
from enums import PromptType, gpt_token_mapping, anthropic_mapping, google_mapping, mistralai_mapping, groq_mapping, \
noop_prompt_type, unknown_prompt_type, user_prompt_for_fake_system_prompt0, template_prompt_type, empty_prompt_type, \
extra_stop_token_ids # keep single line
from prompter_utils import get_use_chat_template
from utils import FakeTokenizer
from stopping import update_terminate_responses
non_hf_types = ['gpt4all_llama', 'llama', 'gptj']
prompt_type_to_model_name = {
noop_prompt_type: [
'EleutherAI/gpt-j-6B',
'EleutherAI/pythia-6.9b',
'EleutherAI/pythia-12b',
'EleutherAI/pythia-12b-deduped',
'EleutherAI/gpt-neox-20b',
'openlm-research/open_llama_7b_700bt_preview',
'decapoda-research/llama-7b-hf',
'decapoda-research/llama-13b-hf',
'decapoda-research/llama-30b-hf',
'decapoda-research/llama-65b-hf',
'facebook/mbart-large-50-many-to-many-mmt',
'philschmid/bart-large-cnn-samsum',
'philschmid/flan-t5-base-samsum',
'gpt2',
'distilgpt2',
'mosaicml/mpt-7b-storywriter',
'tiiuae/falcon-7b',
'tiiuae/falcon-40b',
'tiiuae/falcon-180B',
'meta-llama/Llama-2-7b',
'meta-llama/Llama-2-13b',
'meta-llama/Llama-2-70b',
'h2oai/h2ogpt-4096-llama2-7b',
'h2oai/h2ogpt-4096-llama2-13b',
'h2oai/h2ogpt-4096-llama2-70b',
'h2oai/h2ogpt-16k-codellama-7b',
'h2oai/h2ogpt-16k-codellama-13b',
'h2oai/h2ogpt-16k-codellama-34b',
'h2oai/h2ogpt-16k-codellama-7b-python',
'h2oai/h2ogpt-16k-codellama-13b-python',
'h2oai/h2ogpt-16k-codellama-34b-python',
'h2oai/h2ogpt-32k-codellama-34b-python',
'mistralai/Mistral-7B-v0.1',
'mistralai/Mixtral-8x7B-v0.1',
],
'gptj': ['gptj', 'gpt4all_llama'],
'prompt_answer': [
'h2oai/h2ogpt-gm-oasst1-en-1024-20b',
'h2oai/h2ogpt-gm-oasst1-en-1024-12b',
'h2oai/h2ogpt-gm-oasst1-multilang-1024-20b',
'h2oai/h2ogpt-gm-oasst1-multilang-2048-falcon-7b',
'h2oai/h2ogpt-gm-oasst1-multilang-2048-falcon-7b-v2',
'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3',
'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b',
'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v2',
'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-40b-v1',
'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-40b-v2',
'h2oai/h2ogpt-gm-oasst1-en-xgen-7b-8k',
'h2oai/h2ogpt-gm-oasst1-multilang-xgen-7b-8k',
'TheBloke/h2ogpt-gm-oasst1-en-2048-falcon-40b-v2-GPTQ',
],
'prompt_answer_openllama': [
'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-7b-preview-300bt',
'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-7b-preview-300bt-v2',
'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-7b-preview-700bt',
'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-7b',
'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-13b',
],
'instruct': ['TheBloke/llama-30b-supercot-SuperHOT-8K-fp16', 'TheBloke/Nous-Hermes-13B-GPTQ'],
# https://huggingface.co/TheBloke/llama-30b-supercot-SuperHOT-8K-fp16#prompting
'instruct_with_end': ['databricks/dolly-v2-12b'],
'quality': [],
'human_bot': [
'h2oai/h2ogpt-oasst1-512-12b',
'h2oai/h2ogpt-oasst1-512-20b',
'h2oai/h2ogpt-oig-oasst1-256-6_9b',
'h2oai/h2ogpt-oig-oasst1-512-6_9b',
'h2oai/h2ogpt-oig-oasst1-256-6.9b', # legacy
'h2oai/h2ogpt-oig-oasst1-512-6.9b', # legacy
'h2oai/h2ogpt-research-oasst1-512-30b',
'h2oai/h2ogpt-research-oasst1-llama-65b',
'h2oai/h2ogpt-oasst1-falcon-40b',
'h2oai/h2ogpt-oig-oasst1-falcon-40b',
'llmware/dragon-mistral-7b-v0', # https://huggingface.co/llmware/dragon-mistral-7b-v0
],
'dai_faq': [],
'summarize': [],
'simple_instruct': ['t5-small', 't5-large', 'google/flan-t5', 'google/flan-t5-xxl', 'google/flan-ul2'],
'instruct_vicuna': ['AlekseyKorshuk/vicuna-7b', 'TheBloke/stable-vicuna-13B-HF', 'junelee/wizard-vicuna-13b'],
'human_bot_orig': ['togethercomputer/GPT-NeoXT-Chat-Base-20B'],
"open_assistant": ['OpenAssistant/oasst-sft-7-llama-30b-xor', 'oasst-sft-7-llama-30b'],
"wizard_lm": ['ehartford/WizardLM-7B-Uncensored', 'ehartford/WizardLM-13B-Uncensored'],
"wizard_mega": ['openaccess-ai-collective/wizard-mega-13b'],
"instruct_simple": ['JosephusCheung/Guanaco'],
"wizard_vicuna": ['ehartford/Wizard-Vicuna-13B-Uncensored'],
# "wizard2": [],
"mptinstruct": ['mosaicml/mpt-30b-instruct', 'mosaicml/mpt-7b-instruct', 'mosaicml/mpt-30b-instruct'],
"mptchat": ['mosaicml/mpt-7b-chat', 'mosaicml/mpt-30b-chat', 'TheBloke/mpt-30B-chat-GGML',
'TheBloke/Nous-Hermes-2-Mixtral-8x7B-DPO-AWQ',
'TheBloke/dolphin-2.7-mixtral-8x7b-AWQ',
],
"orca2": ['TheBloke/Orca-2-13B-GGUF', 'microsoft/Orca-2-13b'],
"vicuna11": ['lmsys/vicuna-33b-v1.3',
'lmsys/vicuna-7b-v1.5',
'lmsys/vicuna-13b-v1.5', # https://huggingface.co/lmsys/vicuna-13b-v1.5/discussions/6/files
'NousResearch/Nous-Capybara-34B',
],
"vicuna11nosys": ['lmsys/vicuna-13b-v1.5-16k',
# system prompt doesn't work, no evidence was trained with it from model card.
],
"one_shot": ['lmsys/fastchat-t5-3b-v1.0', 'mistral-community/Mixtral-8x22B-v0.1'],
"falcon": ['tiiuae/falcon-40b-instruct', 'tiiuae/falcon-7b-instruct'],
"llama2": [
'meta-llama/Llama-2-7b-chat-hf',
'meta-llama/Llama-2-13b-chat-hf',
'meta-llama/Llama-2-34b-chat-hf',
'meta-llama/Llama-2-70b-chat-hf',
'h2oai/h2ogpt-oasst1-4096-llama2-7b',
'h2oai/h2ogpt-oasst1-4096-llama2-13b',
'h2oai/h2ogpt-oasst1-4096-llama2-70b',
# 'llama', # No longer go to llama2 prompt for any llama model, too many not llama2 and auto-detection is confusing then
'TheBloke/Llama-2-7b-Chat-GPTQ',
'TheBloke/Llama-2-7b-chat-fp16',
'TheBloke/Llama-2-13b-chat-fp16',
'TheBloke/Llama-2-70b-chat-fp16',
'h2oai/h2ogpt-4096-llama2-7b-chat',
'h2oai/h2ogpt-4096-llama2-13b-chat',
'h2oai/h2ogpt-4096-llama2-70b-chat',
'h2oai/h2ogpt-16k-codellama-7b-instruct',
'h2oai/h2ogpt-16k-codellama-13b-instruct',
'h2oai/h2ogpt-16k-codellama-34b-instruct',
'h2oai/h2ogpt-32k-codellama-34b-instruct',
'TheBloke/Llama-2-70B-chat-AWQ',
'h2oai/h2ogpt-4096-llama2-70b-chat-4bit',
'TheBloke/Llama-2-70B-chat-AWQ',
'TheBloke/Llama-2-13B-chat-AWQ',
'Yukang/LongAlpaca-70B', # or can be instruct
'TheBloke/Llama-2-7B-Chat-GGUF',
'namespace-Pt/activation-beacon-llama2-7b-chat',
'abacusai/Smaug-72B-v0.1',
],
"mistral": ['mistralai/Mistral-7B-Instruct-v0.1', 'TheBloke/Mistral-7B-Instruct-v0.1-GGUF',
'mistralai/Mistral-7B-Instruct-v0.2', 'TheBloke/Mistral-7B-Instruct-v0.2-GGUF',
],
"mixtral": ['mistralai/Mixtral-8x7B-Instruct-v0.1', 'TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF',
'TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ', 'TheBloke/Mixtral-8x7B-Instruct-v0.1-AWQ',
'ybelkada/Mixtral-8x7B-Instruct-v0.1-AWQ'],
"mixtralnosys": [],
"zephyr": ['HuggingFaceH4/zephyr-7b-alpha', 'HuggingFaceH4/zephyr-7b-beta', 'TheBloke/zephyr-7B-beta-GGUF',
'TheBloke/zephyr-7B-beta-AWQ', 'zephyr-7b-beta.Q5_K_M.gguf'],
"beluga": ['stabilityai/StableBeluga2', 'psmathur/orca_mini_v3_7b'],
"wizard3nospace": ['WizardLM/WizardLM-13B-V1.2'],
"falcon_chat": ['tiiuae/falcon-180B-chat'],
"xwin": ['Xwin-LM/Xwin-LM-13B-V0.1', 'TheBloke/Xwin-LM-13B-V0.1-GPTQ', 'TheBloke/Xwin-LM-13B-v0.2-GPTQ',
'Xwin-LM/Xwin-LM-70B-V0.1'],
"xwincoder": ['Xwin-LM/XwinCoder-7B', 'Xwin-LM/XwinCoder-13B', 'Xwin-LM/XwinCoder-34B'],
"xwinmath": ["Xwin-LM/Xwin-Math-7B-V1.0", "Xwin-LM/Xwin-Math-70B-V1.0", "Xwin-LM/Xwin-Math-13B-V1.0"],
"mistrallite": ['amazon/MistralLite'],
"aquila": ['h2oai/h2ogpt-16k-aquilachat2-34b', 'BAAI/AquilaChat2-34B-16K', 'BAAI/AquilaChat2-34B-16k',
'BAAI/AquilaChat2-7B-16K'],
"aquila_legacy": ['BAAI/AquilaChat2-34B'],
"aquila_v1": ['BAAI/AquilaChat2-7B'],
"mistralgerman": ['TheBloke/em_german_leo_mistral-GPTQ'],
"deepseek_coder": ['deepseek-ai/deepseek-coder-1.3b-instruct',
'deepseek-ai/deepseek-coder-6.7b-instruct',
'deepseek-ai/deepseek-coder-33b-instruct',
],
"open_chat": ['openchat/openchat_3.5', 'TheBloke/openchat_3.5-GPTQ', 'TheBloke/openchat_3.5-GGUF',
'TheBloke/openchat_3.5-AWQ', 'TheBloke/openchat_3.5-16k-AWQ',
'openchat_3.5.Q5_K_M.gguf', 'NurtureAI/openchat_3.5-16k'],
"open_chat_correct": ['berkeley-nest/Starling-LM-7B-alpha', 'openchat/openchat-3.5-1210',
'openchat/openchat_3.5', 'openchat/openchat_v3.2_super',
'TheBloke/openchat-3.5-1210-AWQ',
], # can be any from open_chat list, by using this prompt
"open_chat_code": [], # can be any from open_chat list, by using this prompt
"open_chat_math": [], # can be any from open_chat list, by using this prompt
"jais": ['core42/jais-30b-chat-v1', 'core42/jais-13b-chat'],
"yi": ['01-ai/Yi-34B-Chat', 'TheBloke/Yi-34B-Chat-AWQ'],
"docsgpt": ['Arc53/docsgpt-7b-mistral'],
"orion": ['OrionStarAI/Orion-14B-Chat', 'OrionStarAI/Orion-14B-LongChat', 'OrionStarAI/Orion-14B-Chat-RAG'],
"sciphi": ['SciPhi/SciPhi-Self-RAG-Mistral-7B-32k'],
# could be plain, but default is correct prompt_type for default TheBloke model ggml-wizardLM-7B.q4_2.bin
"beacon": [],
"beacon2": [],
# endpoint handles prompting, but we need chat history generation in some sensible way
"llava": ['liuhaotian/llava-v1.6-34b',
'liuhaotian/llava-v1.6-mistral-7b',
'liuhaotian/llava-v1.6-vicuna-13b',
'liuhaotian/llava-v1.6-vicuna-7b',
'liuhaotian/llava-v1.5-13b',
'liuhaotian/llava-v1.5-7b',
'liuhaotian/llava-v1.6-34b',
'liuhaotian/llava-v1.6-vicuna-13b',
'liuhaotian/llava-v1.6-vicuna-7b',
'liuhaotian/llava-v1.6-mistral-7b',
'liuhaotian/llava-v1.5-7b',
'liuhaotian/llava-v1.5-13b',
'NousResearch/Nous-Hermes-2-Vision', # different worker, that handles prompting itself too
],
"danube": ['h2oai/h2o-danube-1.8b-chat'],
"gemma": ['gg-hf/gemma-2b-it', 'gg-hf/gemma-7b-it', 'google/gemma-2b-it', 'google/gemma-7b-it'],
"qwen": ['Qwen/Qwen1.5-7B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-7B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-7B-Chat-AWQ',
'Qwen/Qwen1.5-7B-Chat',
'Qwen/Qwen1.5-72B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-72B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-72B-Chat-AWQ',
'Qwen/Qwen1.5-72B-Chat',
'Qwen/Qwen1.5-4B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-4B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-4B-Chat-AWQ',
'Qwen/Qwen1.5-4B-Chat',
'Qwen/Qwen1.5-14B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-14B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-14B-Chat-AWQ',
'Qwen/Qwen1.5-14B-Chat',
'Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-1.8B-Chat-AWQ',
'Qwen/Qwen1.5-1.8B-Chat',
'Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int8',
'Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4',
'Qwen/Qwen1.5-0.5B-Chat-AWQ',
'Qwen/Qwen1.5-0.5B-Chat',
'Qwen/Qwen1.5-72B-Chat-GGUF',
'Qwen/Qwen1.5-14B-Chat-GGUF',
'Qwen/Qwen1.5-7B-Chat-GGUF',
'Qwen/Qwen1.5-4B-Chat-GGUF',
'Qwen/Qwen1.5-1.8B-Chat-GGUF',
'Qwen/Qwen1.5-0.5B-Chat-GGUF',
],
"sealion": ['aisingapore/sea-lion-7b-instruct'],
"aya": ["CohereForAI/aya-101"],
"idefics2": ["HuggingFaceM4/idefics2-8b-chatty", "HuggingFaceM4/idefics2-8b-chat"],
# don't actually add, else use_chat_template wouldn't function right for LLM mode
# 'cohere_grounded': ["CohereForAI/c4ai-command-r-v01", "CohereForAI/c4ai-command-r-plus"],
}
anthropic_gpts = sorted(anthropic_mapping.keys())
prompt_type_to_model_name['anthropic'] = anthropic_gpts
google_gpts = sorted(google_mapping.keys())
prompt_type_to_model_name['google'] = google_gpts
mistralai_gpts = sorted(mistralai_mapping.keys())
prompt_type_to_model_name['mistralai'] = mistralai_gpts
groq_gpts = sorted(groq_mapping.keys())
prompt_type_to_model_name['groq'] = groq_gpts
model_names_curated_big = ['Yukang/LongAlpaca-70B',
'lmsys/vicuna-13b-v1.5-16k',
'h2oai/h2ogpt-32k-codellama-34b-instruct']
model_names_curated = ['TheBloke/Xwin-LM-13B-V0.1-GPTQ',
'TheBloke/Llama-2-7B-Chat-GGUF',
'HuggingFaceH4/zephyr-7b-beta',
'TheBloke/zephyr-7B-beta-GGUF',
'TheBloke/zephyr-7B-beta-AWQ'] + model_names_curated_big
openai_gpts = list(gpt_token_mapping.keys())
prompt_type_to_model_name.update({
"openai": ["text-davinci-003", "text-curie-001", "text-babbage-001", "text-ada-001"],
"openai_chat": openai_gpts,
})
model_names_curated += ['gpt-3.5-turbo']
inv_prompt_type_to_model_name = {v.strip(): k for k, l in prompt_type_to_model_name.items() for v in l}
inv_prompt_type_to_model_lower = {v.strip().lower(): k for k, l in prompt_type_to_model_name.items() for v in l}
prompt_types_strings = []
for p in PromptType:
prompt_types_strings.extend([p.name])
prompt_types = []
for p in PromptType:
prompt_types.extend([p.name, p.value, str(p.value)])
def get_prompt(prompt_type, prompt_dict, context, reduced, making_context, return_dict=False,
system_prompt=None, histi=-1):
prompt_dict_error = ''
generates_leading_space = False
can_handle_system_prompt = False
if prompt_type == PromptType.custom.name and not isinstance(prompt_dict, dict):
try:
prompt_dict = ast.literal_eval(prompt_dict)
except BaseException as e:
prompt_dict_error = str(e)
if prompt_dict_error:
promptA = None
promptB = None
PreInstruct = None
PreInput = ''
PreResponse = ''
terminate_response = None
chat_sep = ''
chat_turn_sep = ''
humanstr = ''
botstr = ''
generates_leading_space = False
elif prompt_type in [PromptType.custom.value, str(PromptType.custom.value),
PromptType.custom.name]:
promptA = prompt_dict.get('promptA', '')
promptB = prompt_dict.get('promptB', '')
PreInstruct = prompt_dict.get('PreInstruct', '')
PreInput = prompt_dict.get('PreInput', '')
PreResponse = prompt_dict.get('PreResponse', '')
terminate_response = prompt_dict.get('terminate_response', None)
chat_sep = prompt_dict.get('chat_sep', '\n')
chat_turn_sep = prompt_dict.get('chat_turn_sep', '\n')
humanstr = prompt_dict.get('humanstr', '')
botstr = prompt_dict.get('botstr', '')
elif prompt_type in [PromptType.plain.value, str(PromptType.plain.value),
PromptType.plain.name]:
promptA = promptB = PreInstruct = PreInput = PreResponse = None
terminate_response = []
chat_sep = chat_turn_sep = '\n'
# plain should have None for human/bot, so nothing truncated out, not '' that would truncate after first token
humanstr = None
botstr = None
elif prompt_type in [PromptType.unknown.value, str(PromptType.unknown.value),
PromptType.unknown.name]:
promptA = promptB = PreInstruct = PreInput = PreResponse = None
terminate_response = []
chat_sep = chat_turn_sep = '\n'
# plain should have None for human/bot, so nothing truncated out, not '' that would truncate after first token
humanstr = None
botstr = None
elif prompt_type in [PromptType.template.value, str(PromptType.template.value),
PromptType.template.name]:
promptA = promptB = PreInstruct = PreInput = PreResponse = None
terminate_response = []
chat_sep = chat_turn_sep = '\n'
# plain should have None for human/bot, so nothing truncated out, not '' that would truncate after first token
humanstr = None
botstr = None
elif prompt_type in [PromptType.llava.value, str(PromptType.llava.value),
PromptType.llava.name]:
promptA = promptB = PreInstruct = PreInput = PreResponse = None
terminate_response = []
chat_turn_sep = '\n'
chat_sep = ''
# plain should have None for human/bot, so nothing truncated out, not '' that would truncate after first token
humanstr = None
botstr = None
elif prompt_type == 'simple_instruct':
promptA = promptB = PreInstruct = PreInput = PreResponse = None
terminate_response = []
chat_turn_sep = chat_sep = '\n'
humanstr = None
botstr = None
elif prompt_type in [PromptType.instruct.value, str(PromptType.instruct.value),
PromptType.instruct.name] + [PromptType.instruct_with_end.value,
str(PromptType.instruct_with_end.value),
PromptType.instruct_with_end.name]:
promptA = 'Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n' if not reduced else ''
promptB = 'Below is an instruction that describes a task. Write a response that appropriately completes the request.\n' if not reduced else ''
PreInstruct = """
### Instruction:
"""
PreInput = """
### Input:
"""
PreResponse = """
### Response:
"""
if prompt_type in [PromptType.instruct_with_end.value, str(PromptType.instruct_with_end.value),
PromptType.instruct_with_end.name]:
terminate_response = ['### End']
else:
terminate_response = None
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.quality.value, str(PromptType.quality.value),
PromptType.quality.name]:
promptA = 'Write a detailed high-quality, accurate, fair, Response with about 100 words by following the Instruction as applied on the Input.\n' if not reduced else ''
promptB = 'Write a detailed high-quality, accurate, fair, Response with about 100 words by following the Instruction.\n' if not reduced else ''
PreInstruct = """
### Instruction:
"""
PreInput = """
### Input:
"""
PreResponse = """
### Response:
"""
terminate_response = None
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct # first thing human says
botstr = PreResponse # first thing bot says
elif prompt_type in [PromptType.human_bot.value, str(PromptType.human_bot.value),
PromptType.human_bot.name] + [PromptType.human_bot_orig.value,
str(PromptType.human_bot_orig.value),
PromptType.human_bot_orig.name]:
human = '<human>:'
bot = "<bot>:"
if reduced or context or prompt_type in [PromptType.human_bot.value, str(PromptType.human_bot.value),
PromptType.human_bot.name]:
preprompt = ''
else:
cur_date = time.strftime('%Y-%m-%d')
cur_time = time.strftime('%H:%M:%S %p %Z')
PRE_PROMPT = """\
Current Date: {}
Current Time: {}
"""
preprompt = PRE_PROMPT.format(cur_date, cur_time)
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = human + ' '
PreInput = None
if making_context:
# when making context, want it to appear as-if LLM generated, which starts with space after :
PreResponse = bot + ' '
else:
# normally LLM adds space after this, because was how trained.
# if add space here, non-unique tokenization will often make LLM produce wrong output
PreResponse = bot
terminate_response = ['\n' + human, '\n' + bot, human, bot, PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = human # tag before human talks
botstr = bot # tag before bot talks
generates_leading_space = True
elif prompt_type in [PromptType.dai_faq.value, str(PromptType.dai_faq.value),
PromptType.dai_faq.name]:
promptA = ''
promptB = 'Answer the following Driverless AI question.\n'
PreInstruct = """
### Driverless AI frequently asked question:
"""
PreInput = None
PreResponse = """
### Driverless AI documentation answer:
"""
terminate_response = ['\n\n']
chat_turn_sep = chat_sep = terminate_response
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.summarize.value, str(PromptType.summarize.value),
PromptType.summarize.name]:
promptA = promptB = PreInput = ''
PreInstruct = '## Main Text\n\n'
PreResponse = '\n\n## Summary\n\n'
terminate_response = None
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.instruct_vicuna.value, str(PromptType.instruct_vicuna.value),
PromptType.instruct_vicuna.name]:
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
system_prompt = "A chat between a curious human and an artificial intelligence assistant. " \
"The assistant gives helpful, detailed, and polite answers to the human's questions."
promptA = promptB = system_prompt if not reduced else ''
PreInstruct = """
### Human:
"""
PreInput = None
PreResponse = """
### Assistant:
"""
# but only allow terminate after prompt is found correctly, else can't terminate
terminate_response = ['### Human:', '### Human: ', ' ### Human:', '### Assistant:']
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.prompt_answer.value, str(PromptType.prompt_answer.value),
PromptType.prompt_answer.name]:
preprompt = ''
prompt_tokens = "<|prompt|>"
answer_tokens = "<|answer|>"
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = prompt_tokens
PreInput = None
PreResponse = answer_tokens
eos = '<|endoftext|>' # neox eos
humanstr = prompt_tokens
botstr = answer_tokens
terminate_response = [humanstr, PreResponse, eos]
chat_sep = eos
chat_turn_sep = eos
elif prompt_type in [PromptType.prompt_answer_openllama.value, str(PromptType.prompt_answer_openllama.value),
PromptType.prompt_answer_openllama.name]:
preprompt = ''
prompt_tokens = "<|prompt|>"
answer_tokens = "<|answer|>"
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = prompt_tokens
PreInput = None
PreResponse = answer_tokens
eos = '</s>' # llama eos
humanstr = prompt_tokens
botstr = answer_tokens
terminate_response = [humanstr, PreResponse, eos]
chat_sep = eos
chat_turn_sep = eos
elif prompt_type in [PromptType.danube.value, str(PromptType.danube.value),
PromptType.danube.name]:
can_handle_system_prompt = False # so uses pre-conversation
prompt_tokens = "<|prompt|>"
answer_tokens = "<|answer|>"
if system_prompt in [None, 'None', 'auto']:
system_prompt = ""
promptA = promptB = ''
PreInstruct = prompt_tokens
PreInput = None
PreResponse = answer_tokens
eos = '</s>' # llama eos
humanstr = prompt_tokens
botstr = answer_tokens
terminate_response = [humanstr, PreResponse, eos]
chat_sep = eos
chat_turn_sep = eos
elif prompt_type in [PromptType.open_assistant.value, str(PromptType.open_assistant.value),
PromptType.open_assistant.name]:
# From added_tokens.json
preprompt = ''
prompt_tokens = "<|prompter|>"
answer_tokens = "<|assistant|>"
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = prompt_tokens
PreInput = None
PreResponse = answer_tokens
pend = "<|prefix_end|>"
eos = "</s>"
humanstr = prompt_tokens
botstr = answer_tokens
terminate_response = [humanstr, PreResponse, pend, eos]
chat_turn_sep = chat_sep = eos
elif prompt_type in [PromptType.wizard_lm.value, str(PromptType.wizard_lm.value),
PromptType.wizard_lm.name]:
# https://github.com/ehartford/WizardLM/blob/main/src/train_freeform.py
preprompt = ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = ""
PreInput = None
PreResponse = "\n\n### Response\n"
eos = "</s>"
terminate_response = [PreResponse, eos]
chat_turn_sep = chat_sep = eos
humanstr = promptA
botstr = PreResponse
elif prompt_type in [PromptType.wizard_mega.value, str(PromptType.wizard_mega.value),
PromptType.wizard_mega.name]:
preprompt = ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = """
### Instruction:
"""
PreInput = None
PreResponse = """
### Assistant:
"""
terminate_response = [PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.instruct_vicuna2.value, str(PromptType.instruct_vicuna2.value),
PromptType.instruct_vicuna2.name]:
promptA = promptB = "" if not reduced else ''
PreInstruct = """
HUMAN:
"""
PreInput = None
PreResponse = """
ASSISTANT:
"""
terminate_response = [
'HUMAN:'] # but only allow terminate after prompt is found correctly, else can't terminate
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.instruct_vicuna3.value, str(PromptType.instruct_vicuna3.value),
PromptType.instruct_vicuna3.name]:
promptA = promptB = "" if not reduced else ''
PreInstruct = """
### User:
"""
PreInput = None
PreResponse = """
### Assistant:
"""
terminate_response = [
'### User:'] # but only allow terminate after prompt is found correctly, else can't terminate
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.wizard2.value, str(PromptType.wizard2.value),
PromptType.wizard2.name]:
can_handle_system_prompt = True
# https://huggingface.co/TheBloke/WizardLM-7B-uncensored-GGML
if system_prompt in [None, 'None', 'auto']:
system_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
preprompt = """%s""" % system_prompt if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = """
### Instruction:
"""
PreInput = None
PreResponse = """
### Response:
"""
terminate_response = [PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.wizard3.value, str(PromptType.wizard3.value),
PromptType.wizard3.name]:
# https://huggingface.co/TheBloke/wizardLM-13B-1.0-GGML
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
system_prompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."
preprompt = """%s""" % system_prompt if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = """USER: """
PreInput = None
PreResponse = """ASSISTANT: """
terminate_response = [PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.wizard_vicuna.value, str(PromptType.wizard_vicuna.value),
PromptType.wizard_vicuna.name]:
preprompt = ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = """USER: """
PreInput = None
PreResponse = """ASSISTANT: """
terminate_response = [PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.instruct_simple.value, str(PromptType.instruct_simple.value),
PromptType.instruct_simple.name]:
promptB = promptA = '' if not reduced else ''
PreInstruct = """
### Instruction:
"""
PreInput = """
### Input:
"""
PreResponse = """
### Response:
"""
terminate_response = None
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.openai.value, str(PromptType.openai.value),
PromptType.openai.name]:
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
system_prompt = "The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly."
preprompt = """%s""" % system_prompt if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = "\nHuman: "
PreInput = None
PreResponse = "\nAI:"
terminate_response = [PreResponse] + [" Human:", " AI:"]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.gptj.value, str(PromptType.gptj.value),
PromptType.gptj.name]:
preprompt = "### Instruction:\n The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response." if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = "\n### Prompt: "
PreInput = None
PreResponse = "\n### Response: "
terminate_response = [PreResponse] + ["Prompt:", "Response:"]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.openai_chat.value, str(PromptType.openai_chat.value),
PromptType.openai_chat.name] or \
prompt_type in [PromptType.anthropic.value, str(PromptType.anthropic.value),
PromptType.anthropic.name] or \
prompt_type in [PromptType.google.value, str(PromptType.google.value),
PromptType.google.name] or \
prompt_type in [PromptType.mistralai.value, str(PromptType.mistralai.value),
PromptType.mistralai.name] or \
prompt_type in [PromptType.groq.value, str(PromptType.groq.value),
PromptType.groq.name]:
can_handle_system_prompt = True # handled via special messages/arguments not part of prompt
# mistral safe_mode=True is same as this system prompt:
# Always assist with care, respect, and truth. Respond with utmost utility yet securely. Avoid harmful, unethical, prejudiced, or negative content. Ensure replies promote fairness and positivity.
# prompting and termination all handled by endpoint
preprompt = """"""
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = ""
PreInput = None
PreResponse = ""
terminate_response = []
chat_sep = ''
chat_turn_sep = '\n'
humanstr = None
botstr = None
if prompt_type in [PromptType.google.value, str(PromptType.google.value),
PromptType.google.name] and system_prompt == 'auto':
# google throws safety/harassment errors if don't tell the model it's helpful, even for asking "what is 1+1?"
# so give basic prompt if auto, the current default, so part of pre-conversation always
system_prompt = 'I am a helpful assistant. I will accurately answer all your questions.'
elif prompt_type in [PromptType.vicuna11.value, str(PromptType.vicuna11.value),
PromptType.vicuna11.name] or \
prompt_type in [PromptType.vicuna11nosys.value, str(PromptType.vicuna11nosys.value),
PromptType.vicuna11nosys.name]:
can_handle_system_prompt = prompt_type in [PromptType.vicuna11.value,
str(PromptType.vicuna11.value),
PromptType.vicuna11.name]
if system_prompt in [None, 'None', 'auto']:
system_prompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."
if not can_handle_system_prompt:
# totally remove system prompt stuff, maybe not always done for every model like this
preprompt = ""
else:
preprompt = """%s """ % system_prompt if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
eos = '</s>'
PreInstruct = """USER: """
PreInput = None
PreResponse = """ASSISTANT:"""
terminate_response = [PreResponse, eos]
chat_sep = ' '
chat_turn_sep = eos
humanstr = PreInstruct
botstr = PreResponse
if making_context:
# when making context, want it to appear as-if LLM generated, which starts with space after :
PreResponse = PreResponse + ' '
else:
# normally LLM adds space after this, because was how trained.
# if add space here, non-unique tokenization will often make LLM produce wrong output
PreResponse = PreResponse
elif prompt_type in [PromptType.mptinstruct.value, str(PromptType.mptinstruct.value),
PromptType.mptinstruct.name]:
can_handle_system_prompt = True
# https://huggingface.co/mosaicml/mpt-30b-instruct#formatting
if system_prompt in [None, 'None', 'auto']:
system_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
promptA = promptB = '%s\n' % system_prompt if not reduced else ''
PreInstruct = """
### Instruction
"""
PreInput = """
### Input
"""
PreResponse = """
### Response
"""
terminate_response = None
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.mptchat.value, str(PromptType.mptchat.value),
PromptType.mptchat.name]:
can_handle_system_prompt = True
# https://huggingface.co/TheBloke/mpt-30B-chat-GGML#prompt-template
if system_prompt in [None, 'None', 'auto']:
system_prompt = "A conversation between a user and an LLM-based AI assistant. The assistant gives helpful and honest answers."
promptA = promptB = """<|im_start|>system\n%s\n<|im_end|>""" % system_prompt if not reduced else ''
PreInstruct = """<|im_start|>user
"""
PreInput = None
PreResponse = """<|im_end|><|im_start|>assistant
"""
terminate_response = ['<|im_end|>']
chat_sep = ''
chat_turn_sep = '<|im_end|>'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.orca2.value, str(PromptType.orca2.value),
PromptType.orca2.name]:
can_handle_system_prompt = True
# https://huggingface.co/microsoft/Orca-2-13b#getting-started-with-orca-2
if system_prompt in [None, 'None', 'auto']:
system_prompt = "You are Orca, an AI language model created by Microsoft. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."
promptA = promptB = """<|im_start|>system\n%s\n<|im_end|>""" % system_prompt if not reduced else ''
PreInstruct = """<|im_start|>user
"""
PreInput = None
PreResponse = """<|im_end|><|im_start|>assistant
"""
terminate_response = ['<|im_end|>']
chat_sep = ''
chat_turn_sep = '<|im_end|>'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.falcon.value, str(PromptType.falcon.value),
PromptType.falcon.name]:
promptA = promptB = "" if not reduced else ''
PreInstruct = """User: """
PreInput = None
PreResponse = """Assistant:"""
terminate_response = ['\nUser', "<|endoftext|>"]
chat_sep = '\n\n'
chat_turn_sep = '\n\n'
humanstr = PreInstruct
botstr = PreResponse
if making_context:
# when making context, want it to appear as-if LLM generated, which starts with space after :
PreResponse = 'Assistant: '
else:
# normally LLM adds space after this, because was how trained.
# if add space here, non-unique tokenization will often make LLM produce wrong output
PreResponse = PreResponse
# generates_leading_space = True
elif prompt_type in [PromptType.guanaco.value, str(PromptType.guanaco.value),
PromptType.guanaco.name]:
# https://huggingface.co/TheBloke/guanaco-65B-GPTQ
promptA = promptB = "" if not reduced else ''
PreInstruct = """### Human: """
PreInput = None
PreResponse = """### Assistant:"""
terminate_response = [
'### Human:'] # but only allow terminate after prompt is found correctly, else can't terminate
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.llama2.value, str(PromptType.llama2.value),
PromptType.llama2.name]:
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
# automatic
system_prompt = """You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."""
# too much safety, hurts accuracy
if system_prompt:
sys_msg = """<<SYS>>\n%s\n<</SYS>>\n\n""" % system_prompt
else:
sys_msg = ''
if not reduced:
promptA = promptB = ''
else:
promptA = promptB = ''
PreInput = None
PreInstruct = "<s>[INST] "
if making_context and histi == 0 or not making_context and not reduced:
PreInstruct += sys_msg
PreResponse = "[/INST]"
terminate_response = ["[INST]", "</s>"]
chat_sep = ' '
chat_turn_sep = ' </s>'
humanstr = '[INST]'
botstr = '[/INST]'
if making_context:
PreResponse += " "
elif prompt_type in [PromptType.beluga.value, str(PromptType.beluga.value),
PromptType.beluga.name]:
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
# automatic
system_prompt = "You are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal."
if system_prompt:
sys_msg = """### System:\n%s\n\n""" % system_prompt
else:
sys_msg = ''
if sys_msg and not reduced:
# too much safety, hurts accuracy
promptA = promptB = sys_msg
else:
promptA = promptB = ''
PreInput = None
PreInstruct = "### User:\n"
PreResponse = "\n### Assistant:\n"
terminate_response = ['### Assistant:', "</s>"]
chat_sep = '\n'
chat_turn_sep = '\n\n'
humanstr = '### User:'
botstr = '### Assistant:'
elif prompt_type in [PromptType.wizard3nospace.value, str(PromptType.wizard3nospace.value),
PromptType.wizard3nospace.name]:
# https://huggingface.co/WizardLM/WizardLM-13B-V1.2/discussions/3
preprompt = """A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.""" if not reduced else ''
start = ''
promptB = promptA = '%s%s' % (preprompt, start)
PreInstruct = """USER: """
PreInput = None
PreResponse = """ASSISTANT:"""
terminate_response = [PreResponse]
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.one_shot.value, str(PromptType.one_shot.value),
PromptType.one_shot.name]:
promptA = promptB = """A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
### Human: Got any creative ideas for a 10 year old’s birthday?
### Assistant: Of course! Here are some creative ideas for a 10-year-old's birthday party:
1. Treasure Hunt: Organize a treasure hunt in your backyard or nearby park. Create clues and riddles for the kids to solve, leading them to hidden treasures and surprises.
2. Science Party: Plan a science-themed party where kids can engage in fun and interactive experiments. You can set up different stations with activities like making slime, erupting volcanoes, or creating simple chemical reactions.
3. Outdoor Movie Night: Set up a backyard movie night with a projector and a large screen or white sheet. Create a cozy seating area with blankets and pillows, and serve popcorn and snacks while the kids enjoy a favorite movie under the stars.
4. DIY Crafts Party: Arrange a craft party where kids can unleash their creativity. Provide a variety of craft supplies like beads, paints, and fabrics, and let them create their own unique masterpieces to take home as party favors.
5. Sports Olympics: Host a mini Olympics event with various sports and games. Set up different stations for activities like sack races, relay races, basketball shooting, and obstacle courses. Give out medals or certificates to the participants.
6. Cooking Party: Have a cooking-themed party where the kids can prepare their own mini pizzas, cupcakes, or cookies. Provide toppings, frosting, and decorating supplies, and let them get hands-on in the kitchen.
7. Superhero Training Camp: Create a superhero-themed party where the kids can engage in fun training activities. Set up an obstacle course, have them design their own superhero capes or masks, and organize superhero-themed games and challenges.
8. Outdoor Adventure: Plan an outdoor adventure party at a local park or nature reserve. Arrange activities like hiking, nature scavenger hunts, or a picnic with games. Encourage exploration and appreciation for the outdoors.
Remember to tailor the activities to the birthday child's interests and preferences. Have a great celebration!""" if not reduced else ''
PreInstruct = """
### Human: """
PreInput = None
PreResponse = """
### Assistant:"""
# but only allow terminate after prompt is found correctly, else can't terminate
terminate_response = ['### Human:', '### Human: ', ' ### Human:', '### Assistant:']
chat_turn_sep = chat_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse
elif prompt_type in [PromptType.falcon_chat.value, str(PromptType.falcon_chat.value),
PromptType.falcon_chat.name]:
can_handle_system_prompt = True
if system_prompt in [None, 'None', 'auto']:
# automatic
system_prompt = "You are an intelligent and helpful assistant."
if system_prompt:
sys_msg = "System: %s\n" % system_prompt
else:
sys_msg = ''
if sys_msg and not reduced:
# too much safety, hurts accuracy
promptA = promptB = sys_msg
else:
promptA = promptB = ''
PreInstruct = """User: """
PreInput = None
PreResponse = """Falcon:"""
terminate_response = ['\nUser:', "<|endoftext|>", " User:", "###"]
chat_sep = '\n'
chat_turn_sep = '\n'
humanstr = PreInstruct
botstr = PreResponse