@@ -400,7 +400,7 @@ def init_library():
400400 libname = lib_clblast_noavx2
401401 elif (args .usevulkan is not None ) and file_exists (lib_vulkan_noavx2 ):
402402 libname = lib_vulkan_noavx2
403- elif (( args . usecpu and args . nommap ) or args .failsafe ) and file_exists (lib_failsafe ):
403+ elif (args .failsafe ) and file_exists (lib_failsafe ):
404404 print ("!!! Attempting to use FAILSAFE MODE !!!" )
405405 libname = lib_failsafe
406406 elif file_exists (lib_noavx2 ):
@@ -923,7 +923,7 @@ def load_model(model_filename):
923923 inputs .use_rowsplit = (True if (args .usecublas and "rowsplit" in args .usecublas ) else False )
924924 inputs .vulkan_info = "0" .encode ("UTF-8" )
925925 inputs .blasthreads = args .blasthreads
926- inputs .use_mmap = ( not args .nommap )
926+ inputs .use_mmap = args .usemmap
927927 inputs .use_mlock = args .usemlock
928928 inputs .lora_filename = "" .encode ("UTF-8" )
929929 inputs .lora_base = "" .encode ("UTF-8" )
@@ -3069,7 +3069,7 @@ def hide_tooltip(event):
30693069
30703070 launchbrowser = ctk .IntVar (value = 1 )
30713071 highpriority = ctk .IntVar ()
3072- disablemmap = ctk .IntVar ()
3072+ usemmap = ctk .IntVar (value = 0 )
30733073 usemlock = ctk .IntVar ()
30743074 debugmode = ctk .IntVar ()
30753075 keepforeground = ctk .IntVar ()
@@ -3481,7 +3481,7 @@ def changerunmode(a,b,c):
34813481 # quick boxes
34823482 quick_boxes = {
34833483 "Launch Browser" : [launchbrowser , "Launches your default browser after model loading is complete" ],
3484- "Disable MMAP" : [disablemmap , "Avoids using mmap to load models if enabled" ],
3484+ "Use MMAP" : [usemmap , "Use mmap to load models if enabled, model will not be unloadable " ],
34853485 "Use ContextShift" : [contextshift , "Uses Context Shifting to reduce reprocessing.\n Recommended. Check the wiki for more info." ],
34863486 "Remote Tunnel" : [remotetunnel , "Creates a trycloudflare tunnel.\n Allows you to access koboldcpp from other devices over an internet URL." ],
34873487 "Quiet Mode" : [quietmode , "Prevents all generation related terminal output from being displayed." ]
@@ -3534,7 +3534,7 @@ def changerunmode(a,b,c):
35343534 hardware_boxes = {
35353535 "Launch Browser" : [launchbrowser , "Launches your default browser after model loading is complete" ],
35363536 "High Priority" : [highpriority , "Increases the koboldcpp process priority.\n May cause lag or slowdown instead. Not recommended." ],
3537- "Disable MMAP" : [disablemmap , "Avoids using mmap to load models if enabled" ],
3537+ "Use MMAP" : [usemmap , "Use mmap to load models if enabled, model will not be unloadable " ],
35383538 "Use mlock" : [usemlock , "Enables mlock, preventing the RAM used to load the model from being paged out." ],
35393539 "Debug Mode" : [debugmode , "Enables debug mode, with extra info printed to the terminal." ],
35403540 "Keep Foreground" : [keepforeground , "Bring KoboldCpp to the foreground every time there is a new generation." ]
@@ -3732,7 +3732,7 @@ def kcpp_export_template():
37323732 savdict ["hordeworkername" ] = ""
37333733 savdict ["sdthreads" ] = 0
37343734 savdict ["password" ] = None
3735- savdict ["nommap " ] = False
3735+ savdict ["usemmap " ] = False
37363736 savdict ["usemlock" ] = False
37373737 savdict ["debugmode" ] = 0
37383738 savdict ["ssl" ] = None
@@ -3780,7 +3780,7 @@ def export_vars():
37803780 args .debugmode = debugmode .get ()
37813781 args .launch = launchbrowser .get ()== 1
37823782 args .highpriority = highpriority .get ()== 1
3783- args .nommap = disablemmap .get ()== 1
3783+ args .usemmap = usemmap .get ()== 1
37843784 args .smartcontext = smartcontext .get ()== 1
37853785 args .flashattention = flashattention .get ()== 1
37863786 args .noshift = contextshift .get ()== 0
@@ -3834,7 +3834,7 @@ def export_vars():
38343834 if runopts_var .get ()== "Failsafe Mode (Older CPU)" :
38353835 args .noavx2 = True
38363836 args .usecpu = True
3837- args .nommap = True
3837+ args .usemmap = False
38383838 args .failsafe = True
38393839 if tensor_split_str_vars .get ()!= "" :
38403840 tssv = tensor_split_str_vars .get ()
@@ -3948,7 +3948,7 @@ def import_vars(dict):
39483948 debugmode .set (dict ["debugmode" ])
39493949 launchbrowser .set (1 if "launch" in dict and dict ["launch" ] else 0 )
39503950 highpriority .set (1 if "highpriority" in dict and dict ["highpriority" ] else 0 )
3951- disablemmap .set (1 if "nommap " in dict and dict ["nommap " ] else 0 )
3951+ usemmap .set (1 if "usemmap " in dict and dict ["usemmap " ] else 0 )
39523952 smartcontext .set (1 if "smartcontext" in dict and dict ["smartcontext" ] else 0 )
39533953 flashattention .set (1 if "flashattention" in dict and dict ["flashattention" ] else 0 )
39543954 contextshift .set (0 if "noshift" in dict and dict ["noshift" ] else 1 )
@@ -5440,7 +5440,8 @@ def range_checker(arg: str):
54405440 advparser .add_argument ("--lora" , help = "LLAMA models only, applies a lora file on top of model. Experimental." , metavar = ('[lora_filename]' , '[lora_base]' ), nargs = '+' )
54415441 advparser .add_argument ("--noshift" , help = "If set, do not attempt to Trim and Shift the GGUF context." , action = 'store_true' )
54425442 advparser .add_argument ("--nofastforward" , help = "If set, do not attempt to fast forward GGUF context (always reprocess). Will also enable noshift" , action = 'store_true' )
5443- advparser .add_argument ("--nommap" , help = "If set, do not use mmap to load newer models" , action = 'store_true' )
5443+ compatgroup3 = advparser .add_mutually_exclusive_group ()
5444+ compatgroup3 .add_argument ("--usemmap" , help = "If set, uses mmap to load model. This model will not be unloadable." , action = 'store_true' )
54445445 advparser .add_argument ("--usemlock" , help = "Enables mlock, preventing the RAM used to load the model from being paged out. Not usually recommended." , action = 'store_true' )
54455446 advparser .add_argument ("--noavx2" , help = "Do not use AVX2 instructions, a slower compatibility mode for older devices." , action = 'store_true' )
54465447 advparser .add_argument ("--failsafe" , help = "Use failsafe mode, extremely slow CPU only compatibility mode that should work on all devices." , action = 'store_true' )
@@ -5513,5 +5514,6 @@ def range_checker(arg: str):
55135514 deprecatedgroup .add_argument ("--hordeconfig" , help = argparse .SUPPRESS , nargs = '+' )
55145515 deprecatedgroup .add_argument ("--sdconfig" , help = argparse .SUPPRESS , nargs = '+' )
55155516 compatgroup .add_argument ("--noblas" , help = argparse .SUPPRESS , action = 'store_true' )
5517+ compatgroup3 .add_argument ("--nommap" , help = argparse .SUPPRESS , action = 'store_true' )
55165518
55175519 main (parser .parse_args (),start_server = True )
0 commit comments