Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3kdownloads
flatted.py145 linesDownload Raw Back to python
1# ISC License2#3# Copyright (c) 2018-2025, Andrea Giammarchi, @WebReflection4#5# Permission to use, copy, modify, and/or distribute this software for any6# purpose with or without fee is hereby granted, provided that the above7# copyright notice and this permission notice appear in all copies.8#9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY11# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR15# PERFORMANCE OF THIS SOFTWARE.16 17import json as _json18 19class _Known:20    def __init__(self):21        self.key = []22        self.value = []23 24class _String:25    def __init__(self, value):26        self.value = value27 28def _array_keys(value):29    for i in range(len(value)):30        yield i31 32def _object_keys(value):33    for key in value:34        yield key35 36def _is_array(value):37    return isinstance(value, (list, tuple))38 39def _is_object(value):40    return isinstance(value, dict)41 42def _is_string(value):43    return isinstance(value, str)44 45def _index(known, input, value):46    input.append(value)47    index = str(len(input) - 1)48    known.key.append(value)49    known.value.append(index)50    return index51 52def _relate(known, input, value):53    if _is_string(value) or _is_array(value) or _is_object(value):54        try:55            return known.value[known.key.index(value)]56        except:57            return _index(known, input, value)58 59    return value60 61def _resolver(input, lazy, parsed):62    def resolver(output):63        keys = _array_keys(output) if _is_array(output) else _object_keys(output) if _is_object(output) else []64        for key in keys:65            value = output[key]66            if isinstance(value, _String):67                tmp = input[int(value.value)]68                output[key] = tmp69                if (_is_array(tmp) or _is_object(tmp)) and tmp not in parsed:70                    parsed.append(tmp)71                    lazy.append([output, key])72 73        return output74 75    return resolver76 77def _transform(known, input, value):78    if _is_array(value):79        output = []80        for val in value:81            output.append(_relate(known, input, val))82        return output83 84    if _is_object(value):85        obj = {}86        for key in value:87            obj[key] = _relate(known, input, value[key])88        return obj89 90    return value91 92def _wrap(value):93    if _is_string(value):94        return _String(value)95 96    if _is_array(value):97        i = 098        for val in value:99            value[i] = _wrap(val)100            i += 1101 102    elif _is_object(value):103        for key in value:104            value[key] = _wrap(value[key])105 106    return value107 108def parse(value, *args, **kwargs):109    json = _json.loads(value, *args, **kwargs)110    wrapped = []111    for value in json:112        wrapped.append(_wrap(value))113 114    input = []115    for value in wrapped:116        if isinstance(value, _String):117            input.append(value.value)118        else:119            input.append(value)120 121    value = input[0]122    lazy = []123    revive = _resolver(input, lazy, [value])124 125    value = revive(value)126 127    i = 0128    while i < len(lazy):129        o, k = lazy[i]130        i += 1131        o[k] = revive(o[k])132 133    return value134 135 136def stringify(value, *args, **kwargs):137    known = _Known()138    input = []139    output = []140    i = int(_index(known, input, value))141    while i < len(input):142        output.append(_transform(known, input, input[i]))143        i += 1144    return _json.dumps(output, *args, **kwargs)145 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai