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
index.js297 linesDownload Raw Back to lib
1/**2 * @import {Node, Parent} from 'unist'3 */4 5/**6 * @template Fn7 * @template Fallback8 * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate9 */10 11/**12 * @callback Check13 *   Check that an arbitrary value is a node.14 * @param {unknown} this15 *   The given context.16 * @param {unknown} [node]17 *   Anything (typically a node).18 * @param {number | null | undefined} [index]19 *   The node’s position in its parent.20 * @param {Parent | null | undefined} [parent]21 *   The node’s parent.22 * @returns {boolean}23 *   Whether this is a node and passes a test.24 *25 * @typedef {Record<string, unknown> | Node} Props26 *   Object to check for equivalence.27 *28 *   Note: `Node` is included as it is common but is not indexable.29 *30 * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test31 *   Check for an arbitrary node.32 *33 * @callback TestFunction34 *   Check if a node passes a test.35 * @param {unknown} this36 *   The given context.37 * @param {Node} node38 *   A node.39 * @param {number | undefined} [index]40 *   The node’s position in its parent.41 * @param {Parent | undefined} [parent]42 *   The node’s parent.43 * @returns {boolean | undefined | void}44 *   Whether this node passes the test.45 *46 *   Note: `void` is included until TS sees no return as `undefined`.47 */48 49/**50 * Check if `node` is a `Node` and whether it passes the given test.51 *52 * @param {unknown} node53 *   Thing to check, typically `Node`.54 * @param {Test} test55 *   A check for a specific node.56 * @param {number | null | undefined} index57 *   The node’s position in its parent.58 * @param {Parent | null | undefined} parent59 *   The node’s parent.60 * @param {unknown} context61 *   Context object (`this`) to pass to `test` functions.62 * @returns {boolean}63 *   Whether `node` is a node and passes a test.64 */65export const is =66  // Note: overloads in JSDoc can’t yet use different `@template`s.67  /**68   * @type {(69   *   (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &70   *   (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &71   *   (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &72   *   (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &73   *   (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &74   *   ((node?: null | undefined) => false) &75   *   ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &76   *   ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)77   * )}78   */79  (80    /**81     * @param {unknown} [node]82     * @param {Test} [test]83     * @param {number | null | undefined} [index]84     * @param {Parent | null | undefined} [parent]85     * @param {unknown} [context]86     * @returns {boolean}87     */88    // eslint-disable-next-line max-params89    function (node, test, index, parent, context) {90      const check = convert(test)91 92      if (93        index !== undefined &&94        index !== null &&95        (typeof index !== 'number' ||96          index < 0 ||97          index === Number.POSITIVE_INFINITY)98      ) {99        throw new Error('Expected positive finite index')100      }101 102      if (103        parent !== undefined &&104        parent !== null &&105        (!is(parent) || !parent.children)106      ) {107        throw new Error('Expected parent node')108      }109 110      if (111        (parent === undefined || parent === null) !==112        (index === undefined || index === null)113      ) {114        throw new Error('Expected both parent and index')115      }116 117      return looksLikeANode(node)118        ? check.call(context, node, index, parent)119        : false120    }121  )122 123/**124 * Generate an assertion from a test.125 *126 * Useful if you’re going to test many nodes, for example when creating a127 * utility where something else passes a compatible test.128 *129 * The created function is a bit faster because it expects valid input only:130 * a `node`, `index`, and `parent`.131 *132 * @param {Test} test133 *   *   when nullish, checks if `node` is a `Node`.134 *   *   when `string`, works like passing `(node) => node.type === test`.135 *   *   when `function` checks if function passed the node is true.136 *   *   when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.137 *   *   when `array`, checks if any one of the subtests pass.138 * @returns {Check}139 *   An assertion.140 */141export const convert =142  // Note: overloads in JSDoc can’t yet use different `@template`s.143  /**144   * @type {(145   *   (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &146   *   (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &147   *   (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &148   *   ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &149   *   ((test?: Test) => Check)150   * )}151   */152  (153    /**154     * @param {Test} [test]155     * @returns {Check}156     */157    function (test) {158      if (test === null || test === undefined) {159        return ok160      }161 162      if (typeof test === 'function') {163        return castFactory(test)164      }165 166      if (typeof test === 'object') {167        return Array.isArray(test)168          ? anyFactory(test)169          : // Cast because `ReadonlyArray` goes into the above but `isArray`170            // narrows to `Array`.171            propertiesFactory(/** @type {Props} */ (test))172      }173 174      if (typeof test === 'string') {175        return typeFactory(test)176      }177 178      throw new Error('Expected function, string, or object as test')179    }180  )181 182/**183 * @param {Array<Props | TestFunction | string>} tests184 * @returns {Check}185 */186function anyFactory(tests) {187  /** @type {Array<Check>} */188  const checks = []189  let index = -1190 191  while (++index < tests.length) {192    checks[index] = convert(tests[index])193  }194 195  return castFactory(any)196 197  /**198   * @this {unknown}199   * @type {TestFunction}200   */201  function any(...parameters) {202    let index = -1203 204    while (++index < checks.length) {205      if (checks[index].apply(this, parameters)) return true206    }207 208    return false209  }210}211 212/**213 * Turn an object into a test for a node with a certain fields.214 *215 * @param {Props} check216 * @returns {Check}217 */218function propertiesFactory(check) {219  const checkAsRecord = /** @type {Record<string, unknown>} */ (check)220 221  return castFactory(all)222 223  /**224   * @param {Node} node225   * @returns {boolean}226   */227  function all(node) {228    const nodeAsRecord = /** @type {Record<string, unknown>} */ (229      /** @type {unknown} */ (node)230    )231 232    /** @type {string} */233    let key234 235    for (key in check) {236      if (nodeAsRecord[key] !== checkAsRecord[key]) return false237    }238 239    return true240  }241}242 243/**244 * Turn a string into a test for a node with a certain type.245 *246 * @param {string} check247 * @returns {Check}248 */249function typeFactory(check) {250  return castFactory(type)251 252  /**253   * @param {Node} node254   */255  function type(node) {256    return node && node.type === check257  }258}259 260/**261 * Turn a custom test into a test for a node that passes that test.262 *263 * @param {TestFunction} testFunction264 * @returns {Check}265 */266function castFactory(testFunction) {267  return check268 269  /**270   * @this {unknown}271   * @type {Check}272   */273  function check(value, index, parent) {274    return Boolean(275      looksLikeANode(value) &&276        testFunction.call(277          this,278          value,279          typeof index === 'number' ? index : undefined,280          parent || undefined281        )282    )283  }284}285 286function ok() {287  return true288}289 290/**291 * @param {unknown} value292 * @returns {value is Node}293 */294function looksLikeANode(value) {295  return value !== null && typeof value === 'object' && 'type' in value296}297 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai