mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-28 08:31:25 +00:00 
			
		
		
		
	 47182dd03f
			
		
	
	47182dd03f
	
	
	
		
			
			* llama : deprecate llama_free_model, add llama_model_free ggml-ci * llama : change `llama_load_model_from_file` -> `llama_model_load_from_file` ggml-ci
		
			
				
	
	
		
			28 lines
		
	
	
		
			763 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			763 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "llama.h"
 | |
| #include "get-model.h"
 | |
| 
 | |
| #include <cstdlib>
 | |
| 
 | |
| int main(int argc, char *argv[] ) {
 | |
|     auto * model_path = get_model_or_exit(argc, argv);
 | |
|     auto * file = fopen(model_path, "r");
 | |
|     if (file == nullptr) {
 | |
|         fprintf(stderr, "no model at '%s' found\n", model_path);
 | |
|         return EXIT_FAILURE;
 | |
|     }
 | |
| 
 | |
|     fprintf(stderr, "using '%s'\n", model_path);
 | |
|     fclose(file);
 | |
| 
 | |
|     llama_backend_init();
 | |
|     auto params = llama_model_params{};
 | |
|     params.use_mmap = false;
 | |
|     params.progress_callback = [](float progress, void * ctx){
 | |
|         (void) ctx;
 | |
|         return progress > 0.50;
 | |
|     };
 | |
|     auto * model = llama_model_load_from_file(model_path, params);
 | |
|     llama_backend_free();
 | |
|     return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE;
 | |
| }
 |