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
0likes3.1kdownloads
arrow.ts142 linesDownload Raw Back to functions
1import defineFunction from "../defineFunction";2import {makeSpan, makeVList, wrapFragment} from "../buildCommon";3import {MathNode} from "../mathMLTree";4import {stretchyMathML, stretchySvg} from "../stretchy";5 6import * as html from "../buildHTML";7import * as mml from "../buildMathML";8 9import type {ParseNode} from "../parseNode";10import type {MathDomNode} from "../mathMLTree";11 12// Helper function13const paddedNode = (group?: MathDomNode | null | undefined) => {14    const node = new MathNode("mpadded", group ? [group] : []);15    node.setAttribute("width", "+0.6em");16    node.setAttribute("lspace", "0.3em");17    return node;18};19 20// Stretchy arrows with an optional argument21defineFunction({22    type: "xArrow",23    names: [24        "\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow",25        "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow",26        "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown",27        "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup",28        "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal",29        "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom",30        // The next 3 functions are here to support the mhchem extension.31        // Direct use of these functions is discouraged and may break someday.32        "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium",33        // The next 3 functions are here only to support the {CD} environment.34        "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal",35    ],36    props: {37        numArgs: 1,38        numOptionalArgs: 1,39    },40    handler({parser, funcName}, args, optArgs) {41        return {42            type: "xArrow",43            mode: parser.mode,44            label: funcName,45            body: args[0],46            below: optArgs[0],47        };48    },49    htmlBuilder(group: ParseNode<"xArrow">, options) {50        const style = options.style;51 52        // Build the argument groups in the appropriate style.53        // Ref: amsmath.dtx:   \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%54 55        // Some groups can return document fragments.  Handle those by wrapping56        // them in a span.57        let newOptions = options.havingStyle(style.sup());58        const upperGroup = wrapFragment(59            html.buildGroup(group.body, newOptions, options), options);60        const arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";61        upperGroup.classes.push(arrowPrefix + "-arrow-pad");62 63        let lowerGroup;64        if (group.below) {65            // Build the lower group66            newOptions = options.havingStyle(style.sub());67            lowerGroup = wrapFragment(68                html.buildGroup(group.below, newOptions, options), options);69            lowerGroup.classes.push(arrowPrefix + "-arrow-pad");70        }71 72        const arrowBody = stretchySvg(group, options);73 74        // Re shift: Note that stretchySvg returned arrowBody.depth = 0.75        // The point we want on the math axis is at 0.5 * arrowBody.height.76        const arrowShift = -options.fontMetrics().axisHeight +77            0.5 * arrowBody.height;78        // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi79        let upperShift = -options.fontMetrics().axisHeight80            - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu81        if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {82            upperShift -= upperGroup.depth;  // shift up if depth encroaches83        }84 85        // Generate the vlist86        let vlist;87        if (lowerGroup) {88            const lowerShift = -options.fontMetrics().axisHeight89                + lowerGroup.height + 0.5 * arrowBody.height90                + 0.111;91            vlist = makeVList({92                positionType: "individualShift",93                children: [94                    {type: "elem", elem: upperGroup, shift: upperShift},95                    {type: "elem", elem: arrowBody,  shift: arrowShift,96                        wrapperClasses: ["svg-align"]},97                    {type: "elem", elem: lowerGroup, shift: lowerShift},98                ],99            }, options);100        } else {101            vlist = makeVList({102                positionType: "individualShift",103                children: [104                    {type: "elem", elem: upperGroup, shift: upperShift},105                    {type: "elem", elem: arrowBody,  shift: arrowShift,106                        wrapperClasses: ["svg-align"]},107                ],108            }, options);109        }110 111        return makeSpan(["mrel", "x-arrow"], [vlist], options);112    },113    mathmlBuilder(group, options) {114        const arrowNode = stretchyMathML(group.label);115        arrowNode.setAttribute(116            "minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em"117        );118        let node;119 120        if (group.body) {121            const upperNode = paddedNode(mml.buildGroup(group.body, options));122            if (group.below) {123                const lowerNode = paddedNode(mml.buildGroup(group.below, options));124                node = new MathNode(125                    "munderover", [arrowNode, lowerNode, upperNode]126                );127            } else {128                node = new MathNode("mover", [arrowNode, upperNode]);129            }130        } else if (group.below) {131            const lowerNode = paddedNode(mml.buildGroup(group.below, options));132            node = new MathNode("munder", [arrowNode, lowerNode]);133        } else {134            // This should never happen.135            // Parser.js throws an error if there is no argument.136            node = paddedNode();137            node = new MathNode("mover", [arrowNode, node]);138        }139        return node;140    },141});142 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai