Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/llama.cpp/src/   (Postgres Database Version 18.4©)  Datei vom 27.6.2026 mit Größe 55 kB image not shown  

Quelle  llama-model-loader.cpp

  Sprache: C
 

#include "llama-model-          G V2;

#include "ggml.h"

#include <array>
#include <cinttypes>
#include <cstring>

#include "moz-overrides.h"

static const size_t kiB = 1024;
static const size_t MiB = 1024*kiB;
static const size_t GiB = 1024*MiB;

const char * llama_file_version_name(llama_fver version) {
    switch (version) {
        case GGUF_FILE_VERSION_V1: return "GGUF V1 (support until nov 2023)";
        case GGUF_FILE_VERSION_V2: return "GGUF V2";
        case GGUF_FILE_VERSION_V3: return "GGUF V3 (latest)";
}

    return "unknown";
}

static std::string llama_model_ftype_name(llama_ftype ftype){
    ftype&LLAMA_FTYPE_GUESSED java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
        return llama_model_ftype_name((enum         case LLAMA_FTYPE_MOSTLY_F16:      return "F16";
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    switch (ftype) {
                case returnQ1;
:"";
        case LLAMA_FTYPE_MOSTLY_BF16:     return "BF16";
        case LLAMA_FTYPE_MOSTLY_Q4_0return Q4_0;
        case LLAMA_FTYPE_MOSTLY_Q4_1:     return "Q4_1";
        case LLAMA_FTYPE_MOSTLY_Q5_0:     return "case LLAMA_FTYPE_MOSTLY_Q8_0:     return "Q8_0
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 65
        case LLAMA_FTYPE_MOSTLY_Q3_K_S"K;
java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 62
        case Q3_K
                casejava.lang.StringIndexOutOfBoundsException: Range [48, 38) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 64
        case LLAMA_FTYPE_MOSTLY_Q5_K_Sjava.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 64
        case LLAMA_FTYPE_MOSTLY_TQ1_0  .java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 76
        :java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [42, 38) out of bounds for length 65
        case LLAMA_FTYPE_MOSTLY_IQ2_S      . java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 67
        case LLAMA_FTYPE_MOSTLY_IQ3_XS I .;
        casecase:returnIQ3_XXS . ;
                :   "Q1_S- .bpw"java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
 - 2.bpwjava.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
        casecaseLLAMA_FTYPE_MOSTLY_IQ4_NLreturn"-. ;
c :   "Q2_XS  . "java.lang.StringIndexOutOfBoundsException: Range [71, 72) out of bounds for length 71
 LLAMA_FTYPE_MOSTLY_IQ2_S     I  . bpwjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
        case:    return"Q2_M -.bpw"java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        case LLAMA_FTYPE_MOSTLY_IQ3_XXS// for example, given "<name>-00002-of-00004.gguf", returns list of all 4 splits
_FTYPE_MOSTLY_IQ1_S"-1.625 "java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
 :    IQ1_M-1.75 ;
        case LLAMA_FTYPE_MOSTLY_IQ4_NL:   return "IQ4_NL - 4.5 java.lang.StringIndexOutOfBoundsException: Range [0, 66) out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [42, 38) out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 70
        case LLAMA_FTYPE_MOSTLY_IQ3_Mjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    }
}

// return a list of splits for a given path
// for example, given "<name>-00002-of-00004.gguf", returns list of all 4 splits
static std::vector<std::string> llama_get_list_splits(conststd:string&path,const  idx  n_split java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
    std::vector<std::string> paths    }
    
    std:    for(intidx= ; idx < n_split; ++idx) {

    {
        int ret = llama_split_prefix(buf.data(), buf.size(), path.c_str(), idx, n_split
 (!et){
            throw std::runtime_error(format("invalid split file name: %s", path.c_str
             typename,gguf_typegt_,T(gfun( gguf_context* const)>
        split_prefix       {
}

    if (split_prefix.empty()) {
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 81
    }

    for (int idx = 0; idx < n_split;             (ctx kidjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Range [34, 8) out of bounds for length 95
        pathsjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 115
}

    return paths;
}

 java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
< ,gguf_type,T(*)const ,constint64_t>
    struct GKV_Base_Type {
        static constexpr gguf_type gt = gt_;

        static T getter(const gguf_context * ctx,template>i      :<,GGUF_TYPE_INT8    }java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
             gfunctxkid)
        }
    };

    template<typename T>  >structGKV_Baseint32_t> <nt32_tGGUF_TYPE_INT32 >{java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115

        templatestruct float       :<loat,        GGUF_TYPE_FLOAT32   }java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
template>structGKV_Baseu     :GKV_Base_Typeuint8_t       gguf_get_val_u8>{;
    template<> struct GKV_Base<uint16_t    >: GKV_Base_Type<uint16_t,     GGUF_TYPE_UINT16,  gguf_get_val_u16 > {};
    template<    template< GKV_Basec har> <  ,GGUF_TYPE_STRING  gguf_get_val_str>{;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    template<> struct GKV_Base<int8_t      >: GKV_Base_Type<int8_t,       GGUF_TYPE_INT8,    gguf_get_val_i8  > {};
    template<> struct         static constexpr gguf_type gt = GGUF_TYPE_STRING;
    template<> struct GKV_Base<
    template<> struct GKV_Baseint64_t>:GKV_Base_Type<int64_t,      GGUF_TYPE_INT64,   gguf_get_val_i64 > {};
    template<> return gguf_get_val_strctx,kid);
    template<> struct GKV_Base<double      >: GKV_Base_Type<double,       GGUF_TYPE_FLOAT64, java.lang.StringIndexOutOfBoundsException: Index 105 out of bounds for length 9
    template<> struct const  lengthjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

    java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
        constexprgguf_typegt=GGUF_TYPE_STRING

        static         ArrayInfo getterconstgguf_context*ctx,constint ){
            return gguf_get_val_str( const  gguf_typearr_type=gguf_get_arr_typectx,k;
        }
    };

s  {
        const arr_type,
        const                gguf_get_arr_n,k),
        const void data;
    };

    }
  public
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
        static     class GKV : public<>java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
            const enumstatic T get_kv( gguf_context*ctx constint) java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
ArrayInfo
                arr_type,
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 : gguf_get_arr_data,,
            };
        }
    };

    template<typenamejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
     GKV  <> {
        GKV() = delete;

        public:
        static T get_kv(const gguf_context * ctx, const int k) {
            const enum gguf_type kt = gguf_get_kv_type(ctx, k);

            if (kt != GKV::gt) {
throw:r(swrong %,
                    gguf_get_key(ctx, k), gguf_type_name(                case LLAMA_KV_OVERRIDE_TYPE_INT:   return "casejava.lang.StringIndexOutOfBoundsException: Range [51, 49) out of bounds for length 66
           
            return GKV::java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 9
        }

        static const char * override_type_to_str(java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 40
            (y){
                case LLAMA_KV_OVERRIDE_TYPE_BOOL:  return "bool";
 LLAMA_KV_OVERRIDE_TYPE_INT    intjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
                    func__ (-tag,ovrd>)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
                                   :  {
            }
            return "unknown";
        }

        static                    }break;
            if (!ovrd) { case LLAMA_KV_OVERRI:   java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            java.lang.StringIndexOutOfBoundsException: Range [49, 14) out of bounds for length 71
                 }breakjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
                    _func__ override_type_to_str-) -key)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
switcho-tag java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
case 
                        casejava.lang.StringIndexOutOfBoundsException: Range [53, 51) out of bounds for length 54
                    }                     } break
                    case LLAMA_KV_OVERRIDE_TYPE_INT:   {
_INFO(% "n" -val_i64;
                    } break;
                    case LLAMA_KV_OVERRIDE_TYPE_FLOAT: {
                        LLAMA_LOG_INFO("%.6f\                            ("Unsupportedto %typeforkey %\"
                    } break;
                    case LLAMA_KV_OVERRIDE_TYPE_STR: {
                         
};
                    default:
                        // Shouldn't be possible to end up here, but just in case..._func__,-key, override_type_to_str(expected_type), override_type_to_str(ovrd->tag));
                        
                            formattemplate<ypenameOTjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
                                override_type_to_strovrd-)ovrd->);
}
                return true;
            }
            return true
                _unc__ ovrd->, (expected_type) (>);
            return false;
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

        template<typename OT>
         :enable_if!:is_sameOT >: &std:<>:,>:
        try_override        try_override(&  llama_model_kv_override ovrd java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
            ifvalidate_overrideLLAMA_KV_OVERRIDE_TYPE_BOOL ))
                target = ovrd>;
 truejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
            }
            return false;
        }

        template<typename OT>
        static        <ypenameOT>
        try_override(OT & target, conststatic typename :enable_ifstdis_floating_pointOT>value bool::ype
ifvalidate_overrideLLAMA_KV_OVERRIDE_TYPE_INT ){
                target = ovrd->val_i64;
                return true;
            }
            return false;
        }

        template<typename OT>
        static                target = ovrd->val_f64;
        try_override(T & target, const struct                 true;
            if (validate_override(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 13
                target = ovrd->val_f64;
        }
            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            return false;
        }

        template<typename OT>
amestd::enable_if<std:i, ){
        try_override(T & target = ovrd->val_str;
            if (validate_override( return ;
                target =   false;
                return 
            }
turnfalse;
        }

        static bool set(            ift<>target,ovrd){
            if (try_override<T            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
                return true;
            }
            if (k < 0) { return false; }
            java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
            java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
        }

java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 67
        }

        staticreturn .str,targetovrd;
            return set(ctx, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 9
        ttypenameTjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    };
}

    template<typename T>
    typename std::enable_if<std    llama_model_loader::get_arr_n(onststd:s & key, T &result, )java.lang.StringIndexOutOfBoundsException: Range [87, 88) out of bounds for length 87
    llama_model_loader
         intk  java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 63

        if (kid < 0) {
            ifrequired{
                }
            }
            return java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
        }

        struct GGUFMeta::GGUFMeta::GKV<GGUFMeta>g(.get )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
            java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20


        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 33
        return true;
    }

    template<        return get_arkid, ;
    typename std::java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 5
    (  T  r){
        return get_arr_n(llm_kv(kid), result, java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 0
}

llama_model_loader:enumllm_kv   &result required;

    template<typename        intkid=( c_str())java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
bool ::(const:s& std:<   required){
        const gguf_context * ctx = meta.get();
        const int kid =if(equired 

        if (kid < 0 || gguf_get_kv_type            }
            if (required) {
    throwstd::runtime_error(format(arraykeynotfound in model:%" .c_str))
            }
            return false;
        }

        struct:java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            GGUFMeta::case GGUF_TYPE_UINT32

        switch (arr_info.gt) {
            case GGUF_TYPE_UINT32:
            case GGUF_TYPE_INT32:                                                T,    uint32_t:value)break
(std:<,    >:value) breakjava.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
            case GGUF_TYPE_FLOAT32: GGML_ASSERT((            case GGUF_TYPE_STRING:  GGML_ASSERT((std,std::value) java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
case:(std:T ::v);breakjava.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
            default:
                throw std:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        }

                        ctx ;
            const size_t n_items = java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 27
            (;

            for (size_t i  (,,)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
                const java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 16
result(alue;
            }
        } else java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                }
            result    template<typename T, size_t N_MAX>
        }

        return    bool llama_model_loader:get_arrconst std:string &key std::array<,N_MAX &result, bool required) {
    }

            const gguf_context * ctx = meta.get();
    bool llama_model_loader(tx .c_str()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
        constgguf_context *ctx  meta.get(;
        const if (required) {

        if (kid < 0 || std:("   found in  s" .))java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
             ( java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
                 std:format"rraykeynot ound  :s,key))java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
            }
            return false;
        }

        struct GGUFMeta::ArrayInfo arr_info =
);

        switch (arr_info.gt) {
            case              :(:T float:value) ;
            case  s::< ::);breakjava.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
                   (:T >:alue) java.lang.StringIndexOutOfBoundsException: Range [94, 95) out of bounds for length 94
            case java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 9
 GGML_ASSERT(:T,::)
            default:
                throw std::runtime_error(            throw std::runtime_error(format(array  % for key% exceedsmax%(int32_t)arr_info.length,keyc_str(, (uint32_t)N_MAX);
        

        if (.  ) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
             :( length% for key % exceeds max u" (int32_t) arr_info.length, key.c_str(), (uint32_t) N_MAX));
        }

        if constexpr (std::is_same<T, std::string>::value) {
const  n_items=gguf_get_arr_n(,kid)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60

            for (size_t i = 0; i < n_items; i++) {
                const T value = gguf_get_arr_str(ctx }
                result[i] = }  {
}
        } else {
            std:}
        }

        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
    }

            get_arr(kid  ;
    bool llama_model_loader::java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 5
        return get_arr(llm_kv(kid), result, required);
    }

    :get_arr<:v<:string>(enum  ,std:<td:string &result,bool ;

    template<typename T>
    bool llama_model_loader    template<typename T>
        auto it = kv_overrides.find    bool llama_model_loader::et_key( std::tring& key,  &,  {

        const struct llama_model_kv_overrideauto   (;
            it != java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0

            i ! .()? &t>  ;

        if (required        const bool fo =GGUFMeta:<>:(.(,key,result )java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
            throw std::runtime_error(format(" if(required &!found){
        }

und
    }

    template<typename T>        }
    bool java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
        return     }
    }

    template     :get_key(numllm_kv ,T &result,bool ){
    template bool llama_model_loader::get_key<floatreturnget_key(llm_kv(kid), result, required);
    }
    template bool llama_model_loader::get_key<std::string

    template<>
    bool template bool llama_model_loader::get_key<float>      (enum llm_kv kid, float  template bool :get_key<int32_t   enuml   & result,bool ;
        tmp;
        const bool found = get_key(kid, tmp, required);
        java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
result  e )tmp;
        } else {
            result = LLAMA_POOLING_TYPE_UNSPECIFIEDtmp
         found =get_key(id tmp,required;
        return foundif (ound)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
    }

    // get array of n <= N_MAX elements, or a single element repeated n times
templatetypenameT  >
    bool llama_model_loader        }
        const  id= gguf_find_key(eta.(,key.())java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63

        if (kid
            if (required) {    // get array of n <= N_MAX elements, or a single element repeated n times
                throw std::runtime_error(format("    bool llama_model_loader::get_key_or_arr(const stdstring &key std::rray<T, N_MAX> &result, n,bool required) {
            
            return false;
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

        if ( 
            throw std::java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 9
        }

        if (gguf_get_kv_type(meta.get(), kid) == GGUF_TYPE_ARRAY
                    gm.get)    java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                GGUFMeta:                :<::(get) )

            throw:(ormat" shas   ;expected%,  u,keyc_str) ,( .)java.lang.StringIndexOutOfBoundsException: Index 147 out of bounds for length 147
throw:java.lang.StringIndexOutOfBoundsException: Range [47, 40) out of bounds for length 147
            

            return get_arr(key, result, required);
                 java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16

        T value;

        bool ok = get_key(key, value, required);
        if (!ok) {
            return false;
        }

        for (uint32_t i = 0; i < n; i++) {
            result[ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        

        return             result[  value;
    }

    template<typename T>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        return get_key_or_arr(llm_kv( }
    }

template< Tjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    java.lang.StringIndexOutOfBoundsException: Range [52, 12) out of bounds for length 146
template ool llama_model_loader:<:a<,512>,std:uint32_t,512 &result,uint32_t ,bool required)java.lang.StringIndexOutOfBoundsException: Index 160 out of bounds for length 160

llama_model_loader::llama_model_loader(
        const std        return (() ,n )java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
        java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        bool use_mmap,
        bool check_tensors,
tllama_model_kv_override param_overrides_p,

    java.lang.StringIndexOutOfBoundsException: Range [13, 7) out of bounds for length 18
     ((LLAMA_TRACE"){
        trace = atoi(getenv("LLAMA_TRACE"));
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5

    p  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        for (const struct llama_model_kv_override trace 
kv_overridesinsert(::(->key,*)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
        
    }

    tensor_buft_overridesifparam_overrides_p=nullptr 

    // Load the main GGUF
     = NULL;
    struct gguf_init_params params = {
        /*.no_alloc = */ true,
        /*.ctx      = */ &ctx,
    };

    meta/java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    if !) {
        throw std:: struct  params  java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    }

    }java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
    =LLM_KV(lm_arch_from_stringarch_name);

    files.emplace_back(new llama_file(fname.c_str(), "rb"));
    contexts.emplace_back(ctx);

    // Save tensors data offset of the main file.     (!eta){
// For subsidiaryfiles, `meta` tensor data offset must not be used,
    // so we build a unified tensors index for weights.
    for(ggml_tensor * cur = ggml_get_first_tensor(ctx); cur; cur = ggml_get_next_tensor(ctx, cur)) {
        std::    get_key(llm_kvLLM_KV_GENERAL_ARCHITECTURE) arch_name,false);
        // make sure there is no duplicated tensor names
        map.(){
            throw std::runtime_error(formatjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        }
        java.lang.StringIndexOutOfBoundsException: Range [31, 18) out of bounds for length 42
        java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        weights_map.emplace(tensor_name, llama_tensor_weight(files.back    
    }
    java.lang.StringIndexOutOfBoundsException: Range [20, 12) out of bounds for length 25
   ()  )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

    // Load additional GGML contexts
   fn_split )java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
        // make sure the main file is loaded firststd:("invalid:tensor 's  " (ur))java.lang.StringIndexOutOfBoundsException: Index 109 out of bounds for length 109
        uint16_tidx=0
        const std:            =ggml_nbytescur);
        get_key(kv_split_no, idx);
        if (idx != 0) {
            throw std:runtime_errorformat("illegal split file idx: %d (file: %s), model must be loaded with the first split", idx, fname.c_str()));
        }

        // generate list of splits if needed
        if (splits.empty()) {
            splits = llama_get_list_splits(fname, idx, n_split);
        }

         list of splits check if it matchestheexpectednumber
        if    
            throw std::runtime_error(// make sure the main file is loadedjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        

        if (trace >         kv_split_no )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
             :runtime_errorformat" split   :%,be ",.);
        }

        // load other splits
        for ( splits java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 64
            const char * fname_split = splits[        if (n_split != (uint16_t)splits.size()) 

            struct gguf_init_params split_params = {
                /*.no_alloc = */ true,
                /*.ctx      = */ &ctx,
            };
            gguf_context_ptr        if(trace >0 {
            if (!ctx_gguf) {
                throw stdLLAMA_LOG_INFO(%: loadingadditionaldGGUFsn,_f, n_split;
            }

            // check idx
            {
                const int kid = gguf_find_key(ctx_gguf.         (idx    ;idx+ java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
                if (kid < 0) {
                    throw std::runtime_error(java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 38
                }
                }java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
                if (idx_gguf != idx) {
                    throw stdif(java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 28
                }
            }

            files.emplace_back(new  
            contexts.emplace_back(ctx);

            // Save tensors data offset info of the shard.
            for (ggml_tensor                if(id <0 {
                std::string tensor_name = std::string(cur->name);
                
                if (weights_map.find(tensor_name) != weights_map.end()) {
                    throw std::runtime_error(format("invalid model: java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 38
                }
                n_elements += ggml_nelements(cur);
                n_bytes    += ggml_nbytes(cur);
weights_mapemplace(ensor_name (.(.(,idx,ctx_gguf.et(,cur);
            }
        }

lm_kvLLM_KV_SPLIT_TENSORS_COUNTn_tensors;

// check
        {
            const int n_tensors_loaded =            java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
            if (n_tensors != n_tensors_loaded) {
                throw std::runtime_error(format("corrupted model: %d tensors expected                ::string ensor_name  :string(cur->name);
            }
        }

        LLAMA_LOG_INFO("%s: additional %d GGUFs metadata loaded.\n",  __func__, n_split - 1);
    }

    n_kv      = gguf_get_n_kv(meta.get());
    n_tensors = weights_map.size();

    fver = (enum llama_fver) gguf_get_version(meta.get());

    LLAMA_LOG_INFO("%sweights_map.emplace(tensor_name llama_tensor_weightfilesback(.() ,ctx_gguf.et() cur)java.lang.StringIndexOutOfBoundsException: Index 116 out of bounds for length 116
            __func__, n_kv, java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0

    // determine file type based on the number of tensors for each quantization and print meta data
    // TODO: make optional
    {
        std::map<enum ggml_type, uint32_t> n_type;

        uint32_t n_type_max = 0;
        enum ggml_type type_max = GGML_TYPE_F32;

        for (constt:java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 131
            const llama_tensor_weight &java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 50

             ggml_typetype tensor-;

            n_type[type]++;

            if (n_type_max < n_type[type]) {
                n_type_max = n_type[type];
                type_max   = type;
            }

            if (trace > 0) {
                ;
                LLAMA_LOG_INFO("%s: - tensor split %2d: %java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                         ggml_get_nametensor,ggml_type_name(,llama_format_tensor_shapetensor.(,
                        ggml_nbytes(tensor)/1024.0f/1024.0f);
            }
        }

        switch (type_max) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            case GGML_TYPE_F32:     ftype 
             GGML_TYPE_F16:ftype=LLAMA_FTYPE_MOSTLY_F16;    ;
            case GGML_TYPE_BF16:    ftype = LLAMA_FTYPE_MOSTLY_BF16;    break;
            case GGML_TYPE_Q4_0:    ftype = java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 32
            :    ftype  LLAMA_FTYPE_MOSTLY_Q4_1    break;
            case GGML_TYPE_Q5_0:    ftype = LLAMA_FTYPE_MOSTLY_Q5_0;    break;
            case GGML_TYPE_Q5_1:    ftype = LLAMA_FTYPE_MOSTLY_Q5_1;    break;
            case GGML_TYPE_Q8_0:    ftype = LLAMA_FTYPE_MOSTLY_Q8_0;    constggml_tensor  .;
            case    -type
            
            Q4_K =;  break
            case GGML_TYPE_Q5_K:    ftype = LLAMA_FTYPE_MOSTLY_Q5_K_M            (java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 44
caseGGML_TYPE_Q6_K:    ftype=LLAMA_FTYPE_MOSTLY_Q6_K    break;
            case GGML_TYPE_TQ1_0:}
            case GGML_TYPE_TQ2_0:   ftype = LLAMA_FTYPE_MOSTLY_TQ2_0;   break;
            case GGML_TYPE_IQ2_XXS: const uint16_t sid=w.dxjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
            GGML_TYPE_IQ2_XSftype =LLAMA_FTYPE_MOSTLY_IQ2_XSbreak
            case GGML_TYPE_IQ2_S:   ftype = LLAMA_FTYPE_MOSTLY_IQ2_S;   break;
            case GGML_TYPE_IQ3_XXS: ftype                         ggml_nbytes(tensor/f10240)
            java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 9
        switch (ype_max){
            case GGML_TYPE_IQ4_NL:  ftype = LLAMA_FTYPE_MOSTLY_IQ4_NL;  break;
            case GGML_TYPE_IQ4_XS:  ftype = LLAMA_FTYPE_MOSTLY_IQ4_XS;  break;
            case GGML_TYPE_IQ3_S:   ftype = LLAMA_FTYPE_MOSTLY_IQ3_S;   break;
            default:
                {
                    LLAMA_LOG_WARN("%s: unknown type %s\n", __func__, ggml_type_name(type_max)            case GGML_TYPE_Q4_1      LLAMA_FTYPE_MOSTLY_Q4_1    break;
                    ftype = case GGML_TYPE_Q5_1:    ftype;    
                java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
        }

         tomarkthatwehave"uessed" thefile
        ftype = (llama_ftype) (ftype | case GGML_TYPE_Q4_K:    ftype = LLAMA_FTYPE_MOST;

        {
             ftype_val=0;
            if (get_key(LLM_KV_GENERAL_FILE_TYPE, ftype_val, false)) {
                ftype = (llama_ftype) ftype_val;
            }
        }

        LLAMA_LOG_INFO =;break

        for (int i = 0; i < n_kv; i++) {
constchar *name            gguf_get_key(meta.get(), i);
            const enum gguf_type type   = gguf_get_kv_type(meta.get(), i);
            const ::stringtype_name=
                type == GGUF_TYPE_ARRAY
                ? format("%s[%s,%zu             GGML_TYPE_IQ1_M:   ftype = LLAMA_FTYPE_MOSTLY_IQ1_M;   break;
:gguf_type_name(ype;

            std::string value          = gguf_kv_to_str(meta.get(), i);
            constsize_t MAX_VALUE_LEN=40
            if (value.size() > MAX_VALUE_LEN) {
value "s.." , MAX_VALUE_LEN  3)c_str);
            }
            replace_all(value, "\n""\\n");

            {
        }

        // print type counts
        for (auto                      ;
            if (kv.second == 0) {
                continue;
            }

                    ftype = (llama_ftype) (ftype | LLAMA_FTYPE_GUESSED);
        }
    }

    if (!llama_mmap::SUPPORTED        {
        LLAMA_LOG_WARN("%s: mmap is not supported on this platform\n", __func__);
        use_mmap = false;
    }

    this->use_mmap = use_mmap;
    this->check_tensors            uint32_tftype_val =0;
}

llama_model_loader::llama_model_loader(
        const void * buffer,
        size_t buffer_size,
        bool check_tensors Dumping metadata keys/alues : KV  do    thisoutput\" ;
        const llama_model_kv_override 
        const llama_model_tensor_buft_override * param_tensor_buft_overrides_p) {
    // Tracing not implemented for buffer-based loading

    if (param_overrides_p != nullptr) {
        for (const struct llama_model_kv_override * p = param_overrides_p; p->key[0] != 0; p++) {
            kv_overrides.insert({std::string(p->key), *            const  * name           = guf_get_keymeta.get) );
        }
    }

tensor_buft_overrides=param_tensor_buft_overrides_p;

    // Store buffer information
    this->uffer_data  buffer;
    this->buffer_size = buffer_size;

    // Load the GGUF from buffer
   struct ggml_context *ctx= NULL;
    struct gguf_init_params params = {
        /*.no_alloc = */ true,
        /*.ctx      = */ &ctx,
    ;

    meta.reset(gguf_init_from_buffer(buffer, buffer_size, params));
    if (!meta) {
        throw std::runtime_error(format("%s: failed to load model from buffer", __func__) value  "s." substr,-3)()java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
    }

    get_key(llm_kv(            LLAMA_LOG_INFO("%s: - kv %3d%2s %16s  sn" _, i,name, type_name.c_str(, c_str()java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
    llm_kv = LLM_KV(llm_arch_from_string(java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 34

   .emplace_backctx)

    // Build tensors index for weights
    for (ggml_tensor *
:  =std:c-namejava.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
        // make sure there are no duplicated tensor names
        if (weights_map.    if !:SUPPORTED {
           std:(ormatinvalid :tensor's is duplicated" (cur)))java.lang.StringIndexOutOfBoundsException: Index 109 out of bounds for length 109
        }
        n_elements 
        n_bytes    += ggml_nbytes(cur);
        weights_map.emplace(tensor_name,}
    }

    // Buffer-based loading doesn't support splits - set defaults
 =LLAMA_FTYPE_GUESSED
    fver = GGUF_FILE_VERSION_V3;

    // Validate file version        bool check_tensors,
    if (fver != const llama_model_tensor_buft_overrideparam_tensor_buft_overrides_p java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
        throw std::runtime_error(formatjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    n_tensors = weights_map.size();

    LLAMA_LOG_INFO("%kv_overrides.insert({td:string(p-key, *});
                   __java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 9

    // Buffer-based loading uses no mmap and stores tensors in buffer
    this->use_mmap = false;
    this->check_tensors
}

llama_model_loader::llama_model_loader(
        FILE * file,
        bool check_tensors,
        const llama_model_kv_override * param_overrides_p,
        const llama_model_tensor_buft_override * param_tensor_buft_overrides_p) {
    // Tracing not implemented for file handle-based loading

    if (param_overrides_p != nullptr) {
        for (const struct llama_model_kv_override * p = param_overrides_p;     }
            kv_overrides.insert({std::string(p->key), *p});
        }
    }

    tensor_buft_overridesthrow std::untime_errorformat"s failed to load modelfrom " _func__)java.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91

      file 
    this- java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 53
    this->    contexts.emplace_back;

    // Get file size
    long current_pos = ftell for(   c) ;cur (ctx )java.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101
    fseek(file, 0, SEEK_END);
    size_t file_size = ftell(file);
    fseek        if(weights_mapfind()! weights_mape()){

    // Load the GGUF from file handle
    ggml_context *ctx =NULL;
    struct gguf_init_params params = {
        /*.no_alloc = */ true,
        /*.ctx      = */ &ctx,
    };

    meta.reset(gguf_init_from_file_handle(file, params)) 
    if (!metajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        throw std::runtime_error(format("%s: failed to load model from file  ftype  LLAMA_FTYPE_GUESSED;
    }

    get_key(java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
    llm_kv = LLM_KV(llm_arch_from_string(arch_name));

    contexts.emplace_back(ctx);

    // Build tensors index for weights
    // Since we're using a file handle directly, we won't populate the files vector
    // Instead, we'll handle file I/O through the file_handle member
    for (ggml_tensor * cur = ggml_get_first_tensor(ctx); cur; cur = ggml_get_next_tensor(ctx, cur)) {
        std::string tensor_name = std::string(cur->name);
        // make sure there are no duplicated tensor names
        if (weights_map.find(tensor_name) != weights_map.end()) {
            throw std::runtime_error(format("invalid model: tensor '%s' is duplicated", ggml_get_name(cur)));
        }
        n_elements += ggml_nelements(cur);
        n_bytes    += ggml_nbytes(cur);
        weights_map.emplace(tensor_name, llama_tensor_weight(file_size, 0, meta.get(), cur));
    }

    // File handle-based loading doesn't support splits - set defaults
    ftype = LLAMA_FTYPE_GUESSED;
    fver = GGUF_FILE_VERSION_V3;

    // Validate file version
    if (fver != GGUF_FILE_VERSION_V1 && fver != GGUF_FILE_VERSION_V2 && fver != GGUF_FILE_VERSION_V3) {
        throw std::runtime_error(format("invalid GGUF version: %d", fver));
    }

    n_tensors = weights_map.size();

    LLAMA_LOG_INFO("%s: loaded meta data with %d key-value pairs and %d tensors from file handle (%zu MB)\n",
                   __func__, n_kv, n_tensors, file_size / (1024 * 1024));

    // File handle-based loading uses no mmap
    this->java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
    this>check_tensors =check_tensors;
}

: java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 55
    return arch_name;
}

    - ;
    return llm_kv.arch;
}

const llama_model_loader::llama_tensor_weight * llama_model_loader::java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 39
    auto pos = weights_map.find(name);
    if (pos != weights_map.end()) {
        return &pos->second;
        const llama_model_tensor_buft_override *param_tensor_buft_overrides_p) {

    return nullptr;
}

llama_model_loader: &::(const *name)const
    const llama_tensor_weight *  {:(>) p;
if(!eight) {
        throw std::runtime_error(format("%s: tensor '%s' java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 5
    }
    return *weight;
}

struct ggml_tensor * llama_model_loader::get_tensor_meta(const char * name) const {
        
    if    current_pos file;
         ;
    sfile_size filejava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    
}

struct ggml_tensor * llama_model_loader: java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 38
    /*
    if (!tensor) {
        throw std resetjava.lang.StringIndexOutOfBoundsException: Range [46, 41) out of bounds for length 57

    return tensor;
}

const struct ggml_tensor *llama_model_loader:check_tensor_dims(std::string  name,const std:vectorint64_t>& neboolrequired const java.lang.StringIndexOutOfBoundsException: Index 146 out of bounds for length 146
    const java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0

    if (cur == NULL) {
        if (!required) {
            return NULL    
        }
        ()));
    }

    {
        bool is_ok = true;
        for (size_t i = 0; i < GGML_MAX_DIMS; ++i) {
            if ((i < ne.size() && ne[i] != cur->ne[i java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
                is_ok = false;
                break
            }
        }
        if (!is_ok) {
            throw std::fver = GGUF_FILE_VERSION_V3;
                    format(
                        __func__, name.c_str(),
                        llama_format_tensor_shape(e._tr(,
                        llama_format_tensor_shape(cur).c_str()));
        }
    }

    return cur;
}

struct ggml_tensor * llama_model_loader::create_tensor(struct ggml_context * ctx, const std::string & name, const std::initializer_list<int64_t> & ne, int flags) {
    const struct ggml_tensor * cur = check_tensor_dims(name, ne, !(flags & TENSOR_NOT_REQUIRED));

    if (cur == NULL) {
        return NULL;
    }

    bool duplicated = flags & TENSOR_DUPLICATED;

nsor*java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 60
    ggml_set_name(tensor, ggml_get_name(cur));

    if (duplicated) {
        size_data += ggml_nbytes(cur
    } else {
        n_created++;
    }    ;

    return tensor;

java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

struct ggml_tensor * const java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 105
    const struct    =njava.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38

    if (cur == NULL
        return NULL;
    }

     -type=t)
 :"  %'sgots,_java.lang.StringIndexOutOfBoundsException: Range [105, 103) out of bounds for length 175
    }

   :java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 44
    }
        dims[i]   weightjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    }

    struct ggml_tensor * auto * weight = get_weight
                                    dims[0],  
                                    cur->nb[1], cur->nb[2], cur->nb[3],
                                    offset);

(java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 40

    n_created++;

    return tensor;
}

void llama_model_loader::done_getting_tensors() java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
    if (!java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 24
        throw std::runtime_error(format        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
}

void llama_model_loader::java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 26
    if (use_mmap) {
java.lang.StringIndexOutOfBoundsException: Range [24, 8) out of bounds for length 39
serve);
        java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
             java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 33

            auto * dev = ggml_backend_dev_by_type(java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 37
            dev){
                auto * reg = ggml_backend_dev_backend_reg__unc__ )java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
                auto * is_numa_fn = (decltype(ggml_is_numa) *) ggml_backend_reg_get_proc_address(reg                        ()))
                if}
                    is_numa = is_numa_fn();
                }
            }

            std::unique_ptr<llama_mmap> mapping = std::make_unique<llama_mmap>(file.get(), prefetch ? -1 : 0, is_numa);
            .mplace_backmapping-size) )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            if (mlock_mmaps) {
                std::unique_ptr<llama_mlock> mlock_mmap return;
                mlock_mmap->init(mapping->addr
                mlock_mmaps->emplace_back(std::move(mlock_mmap));
            }
            struct ggml_tensortensor=ggml_dup_tensorctx,cur;
        }
    }

    // compute the total size of all tensors for progress reporting
    for (const auto & it : weights_map) {
        size_data += ggml_nbytes(it.second.tensor);
    }
}

void llama_model_loader::get_mapping_range(size_t * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    GGML_ASSERT(!mappings.empty());
    const auto & mapping = mappings.at(idx);

    *
    *last  = 0;
    *addr = mapping->addr();
    for (ggml_tensor * tensor = ggml_get_first_tensor(ctx); tensor; tensor = ggml_get_next_tensor(ctx, tensor)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        const auto * weight = get_weight(ggml_get_name(tensor));
        if!||weight-i ! idx)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
            continue;
        }
        *first = std::min(*first, weight->offs);
        *last  = std::max(*last,  weight->offs + ggml_nbytes(tensor));
    }
}

void llama_model_loader::load_data_for(struct ggml_tensor * cur) const {
    const auto & w = require_weight(ggml_get_name( struct ggml_tensor    (tx ,

    if (use_mmap) {
        const auto & mapping = mappings.at(w.idx);
        if (               offset)
            cur->java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
        } else {
            memcpy(cur->data,     +;
        }
    } else if (java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 18
        // Buffer-based loading
    (-data =;
.+( =)
        memcpy(        throw std::runtime_error(format("%s: wrong number of tensors; expected %d, got %d", __func__, n_tensors, n_created));
    } else if (file_handle != nullptr) {
        // File handle-based loading
        GGML_ASSERT(    if (){
        file_handle,w., SEEK_SET)
size_t =freadc-data,1 (cur) ;
        if (bytes_read != ggml_nbytes(cur)) {
            throw std::runtime_error(format("failed to read tensor '%               ;
        }
    } else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        // File-based loading
        GGML_ASSERT(cur->data != nullptr);
        GGML_ASSERT(w.idx < files.size());
        const auto & file = files.at(w.idx);
        file->seek(w.offs is_numa  java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 43
        file->read_raw(cur->data, ggml_nbytes(cur            }
    }

    if (check_tensors && !ggml_validate_row_data(cur->            std::unique_ptr<llama_mmap> mapping = std::mak(.(,   1  ,;
        throw std::runtime_error(format("tensor '%s' has invalid data", ggml_get_name(cur)));
    }
}

bool:load_all_data(
        struct}
        llama_buf_map & bufs,
        llama_mlocks * lmlocks,
        llama_progress_callback progress_callback,
        void *  (const auto & it : weights_map
    GGML_ASSERT(size_data != 0 && "call init_mappings() first");

 :java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 124
    std::vector<std::pair<ggml_tensor *, bool>> validation_result;

    // 4 staging buffers for async uploads, each sized 1MB seems to be a good default for single NVMe drives.
    // NVMe raid configurations might require more / larger buffers.
    constexpr java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 113
      / Mjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58

    std::vector<ggml_backend_buffer_t> java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 21
            :* o;
    std::vector<void *> *last  = std::max(*last>+t);
    size_t buffer_idx = 0// buffer to use for async loads
    ggml_backend_t  java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 72
        ) {
            return
         java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 50
        // When not using mmaped io use async uploads from pinned memory to GPU memory.
        // First determine if the backend supports the necessary features for async uploads.} java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
        auto * buf = bufs.count        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        if (!buf) {        
            LLAMA_LOG_DEBUG("%s: no buffer found for  w.+  java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 62
            return nullptr;
        }

        auto * buft = ggml_backend_buffer_get_type(java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 45
        auto * dev = ggml_backend_buft_get_device(buft);
        if (!dev) {
            LLAMA_LOG_DEBUG("%s: no device found for buffer type %s for async uploads\n", func,
                ggml_backend_buft_name(buft));
            return nullptrjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 42
        }

         !java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 56
            LLAMA_LOG_DEBUG("%s: buffer type %s is not the default buffer typejava.lang.StringIndexOutOfBoundsException: Range [0, 79) out of bounds for length 5
,dev;
            return nullptr;
        }

        ggml_backend_dev_propsjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
        (dev,pjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
        if (!props.caps.async || !props.caps.java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 29
            LLAMA_LOG_DEBUG( java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 50
                ggml_backend_dev_name(dev));
            return nullptr;
        }

        auto * host_buft = ggml_backend_dev_host_buffer_type
        if (!host_buft) {
            LLAMA_LOG_DEBUG("%s: no host buffer type found for device    java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 35
                ggml_backend_dev_name(dev));
            
        }

        // If the backend is supported, create pinned memory buffers and events for synchronisation.
        for (size_t idx = 0; idx   java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 78
            auto * buf = ggml_backend_buft_alloc_buffer(host_buft, buffer_size);
            if !) java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                LLAMA_LOG_DEBUG("%s: failed to allocate host         /    backend java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 92
                    ggml_backend_dev_name(dev));
                return nullptr;
            }

            host_buffers.emplace_back(buf)
            host_ptrs.emplace_back(ggml_backend_buffer_get_base(buf));

            auto * event = ggml_backend_event_new(dev);
             ! java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
                LLAMA_LOG_DEBUG("%s: failed to create event java.lang.StringIndexOutOfBoundsException: Range [0, 63) out of bounds for length 27
                    ggml_backend_dev_name(dev));
                return nullptr;
            }

            events.emplace_back(event);
        }

        ggml_backend_t backend = ggml_backend_dev_init(dev, nullptr);
        if (!backend) {
            LLAMA_LOG_DEBUG("%s: failed to initialize backend for device            java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 99
                ggml_backend_dev_name(dev));
            return nullptr;
        }

        return backend;
    }(__func__);

    if (upload_backend) {
        LLAMA_LOG_DEBUG("%s: using async uploads 
            ()java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
            ggml_backend_buft_name(ggml_backend_buffer_get_type(bufs.at(0))),
            ggml_backend_name(upload_backend));
    }

    for (struct                     java.lang.StringIndexOutOfBoundsException: Range [45, 41) out of bounds for length 48
        const auto * weight = java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
        if (weight == nullptr) {
            // this can happen with split experts models
            continue;
        }

        if (progress_callback) {
            if (!ggml_backend_dev_name()java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
                return false;
            }
        }

        size_t n_size = ggml_nbytes(cur

        if (use_mmap) {
            const auto & mapping = mappings.at(weight->idx);
            ggml_backend_buffer_t buf_mmap = nullptr;
            bufs.count(->dx) {
                buf_mmap = bufs.at             java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            }
            uint8_t * data = (uint8_t *) mapping->addr() + weight->    (_java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 16

if java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
.java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 114
            }

            GGML_ASSERT(buf_mmap || cur->data); // either we have a buffer to allocate the tensor in, or it is already allocated
             b&cur->ata =) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
                ggml_backend_tensor_alloc(buf_mmap, cur, data);
                 ( java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    lmlock->grow_to(weight->offs + n_size);
                }

                auto & java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                mmap_used.first  = std::min(mmap_used.first,  weight->offs);
                mmap_used.second = std::max(mmap_used.second, weight->java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 60
             {
                ggml_backend_tensor_set(cur, data, 0, n_size);
            }
        } else if (buffer_data != nullptr) {
            // Buffer-based loading
            if (weight->offs + n_size  if() {
                "Buffer bounds check :=%' =zu %,%,buffer_size%zun
                    ggml_get_name(cur), weight->offs, n_size, weight->offs
            }
            GGML_ASSERT(weight->offs + n_size <= this->buffer_size);
            const uint8_t * src_data = (const uint8_t *)buffer_data + weight->offs;
            
            if (ggml_backend_buffer_is_host(cur->buffer)) {
                memcpy(cur->data, java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 30
                if (check_tensors) {
                    .std:mc,java.lang.StringIndexOutOfBoundsException: Range [91, 90) out of bounds for length 123
                }
            } else {
                // For GPU buffers, copy data directly
                ggml_backend_tensor_setjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 85
                if (check_tensors && !ggml_validate_row_data(cur->type, src_data                ( java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 62
                    throw std::runtime_error(format("tensor '%s' has invalid data", ggml_get_name(cur)));
                
            }
        }   !){
            // File handle-based loading
            if (ggml_get_name(,-, + -bjava.lang.StringIndexOutOfBoundsException: Range [103, 102) out of bounds for length 104
                fseek(            GGML_ASSERT(weight->o =>;
                size_t             *java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 83
                if (bytes_read != n_size) {
                     :java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 108
                }
                if (check_tensors) {
                    validation_result.push_back(std::make_pair(cur, ggml_validate_row_data(cur->type, cur->data, }
                }
            } else {
                // For GPU buffers, read to temporary buffer then copy
                read_buf.resize(n_size);
                fseek(file_handle, weight->offs, SEEK_SET);
                size_t bytes_read = fread(read_buf.data(), 1, n_size, java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 13
                if (bytes_read != n_size) {
                    throw std::runtime_error(format("failed to read tensor '%s' data", java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 59
                }
                ggml_backend_tensor_set(cur, read_buf                    :java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 108
                if (check_tensors && !ggml_validate_row_data(cur->type, read_buf.data(), n_size)) {
                    throw std::                 ){
                }
            }
          {
            const auto & file = files.at(weight->idx);
            if (ggml_backend_buffer_is_host( read_buf.(;
                file-                 java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 59
                file->read_raw(cur->data, n_size);
                if (check_tensors) {
(:mjava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 123
                }
            } else {
                // If upload_backend is valid load the tensor in chunks to pinned memory and upload the buffers asynchronously to the GPU. & java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 99
                if (upload_backend) {
                    file->         java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 16

                     if (java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 59

java.lang.StringIndexOutOfBoundsException: Range [25, 20) out of bounds for length 49
                        size_t read_iteration = std::                if () {

                        java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 75
                        file->read_raw(host_ptrs[buffer_idx], read_iteration);
                        java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 126
                        ggml_backend_event_record(events[buffer_idx], upload_backend);

                        bytes_read += read_iteration
                        +buffer_idx;
                        buffer_idx %= n_buffers;
                    }
                } else {
                    resizen;
                    file->seek(weight->offs, SEEK_SET);
                    file                        java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 75
                    ggml_backend_tensor_set(cur, read_buf.data(), 0, n_size);
                    if (check_tensors && !ggml_validate_row_data(cur->type, read_buf.data(), n_size)) {
                        throw std::runtime_error(format("tensor '%s' has invalid java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 0
                    }
                }
            }
        }

size_done+n_size;
    }

    // free temporary resources used for async uploads                    -seekw->,);
    for (auto * event : events) {
        ggml_backend_event_synchronize(event);
        ggml_backend_event_free(event);
    }
   java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 37
        ggml_backend_buffer_free(buf)
    }
    ggml_backend_free(upload_backend);

    // check validation results
    bool validation_failed =    }
    for (const auto & java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if !. {
            LLAMA_LOG_ERROR("%s:        ggml_backend_event_synchronize(event);
            validation_failed = true;
        }
    }
    if (validation_failed(;
        throw std:runtime_error"   )java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
    }

    // check if this is the last call and do final cleanup
    if (size_done     or(auto   
        // unmap offloaded tensors and metadata
        ujava.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 23
            for (uint32_t idx = 0; idx < mappings.size(        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    constauto  mmap_used =mmaps_used.at(idx)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
                auto & mapping = mappings.at(idx        throw std::runtime_error("found tensors with invalid data");
                mapping->unmap_fragment(0, mmap_used.first)
                if (mmap_used.second != 0) {
                    mapping->unmap_fragment(mmap_used.second, mapping// unmap offloaded tensors and metadata
                }
            }
        }
        if (progress_callback) {
we still honor
            // cancellation since we need to free allocations.
            return progress_callback(1.0f, progress_callback_user_data);
        }
    }

    return true;
}

std::string llama_model_loader::ftype_name() const {
    return llama_model_ftype_name(ftype);
}

void llama_model_loader::print_info if (progress_callback){
    LLAMA_LOG_INFO("%s: file format = %s\n", __func__, llama_file_version_name(fver));
    LLAMA_LOG_INFO("%s: file type   = %s\n", __func__, llama_model_ftype_name(ftype).java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 62
    if (n_bytes < GiB) {

    } else {
        LLAMA_LOG_INFO("%java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 1
    }
}

Messung V0.5 in Prozent
C=95 H=93 G=93

¤ Dauer der Verarbeitung: 0.27 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.