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
fromJSON.js108 linesDownload Raw Back to lib
1'use strict'2 3let AtRule = require('./at-rule')4let Comment = require('./comment')5let Declaration = require('./declaration')6let Input = require('./input')7let PreviousMap = require('./previous-map')8let Root = require('./root')9let Rule = require('./rule')10 11function hydrateInputs(json, inputs) {12  if (!json.inputs) return inputs13  return json.inputs.map(input => {14    let inputHydrated = { ...input, __proto__: Input.prototype }15    if (inputHydrated.map) {16      inputHydrated.map = {17        ...inputHydrated.map,18        __proto__: PreviousMap.prototype19      }20    }21    return inputHydrated22  })23}24 25function constructNode(json, inputs, children) {26  let defaults = { ...json }27  delete defaults.inputs28  delete defaults.nodes29  if (defaults.source) {30    let { inputId, ...source } = defaults.source31    defaults.source = source32    if (inputId != null) {33      defaults.source.input = inputs[inputId]34    }35  }36 37  let node38  if (defaults.type === 'root') {39    node = new Root(defaults)40  } else if (defaults.type === 'decl') {41    node = new Declaration(defaults)42  } else if (defaults.type === 'rule') {43    node = new Rule(defaults)44  } else if (defaults.type === 'comment') {45    node = new Comment(defaults)46  } else if (defaults.type === 'atrule') {47    node = new AtRule(defaults)48  } else {49    throw new Error('Unknown node type: ' + json.type)50  }51 52  // Rehydrated children are attached after construction. Passing them53  // through the container constructor would re-run insertion spacing54  // normalization and overwrite each child's own `raws.before`.55  if (children) {56    node.nodes = children57    for (let child of children) child.parent = node58  }59 60  return node61}62 63function fromJSON(json, inputs) {64  if (Array.isArray(json)) return json.map(n => fromJSON(n))65 66  // An explicit stack instead of recursive calls to survive deeply67  // nested trees. Children are rehydrated before their parent node68  // is constructed.69  let result70  let stack = [71    { childIndex: 0, children: [], inputs: hydrateInputs(json, inputs), json }72  ]73 74  while (stack.length > 0) {75    let frame = stack[stack.length - 1]76    let jsonNodes = frame.json.nodes77 78    if (jsonNodes && frame.childIndex < jsonNodes.length) {79      let childJson = jsonNodes[frame.childIndex]80      frame.childIndex += 181      stack.push({82        childIndex: 0,83        children: [],84        inputs: hydrateInputs(childJson, frame.inputs),85        json: childJson86      })87      continue88    }89 90    stack.pop()91    let node = constructNode(92      frame.json,93      frame.inputs,94      jsonNodes ? frame.children : undefined95    )96    if (stack.length > 0) {97      stack[stack.length - 1].children.push(node)98    } else {99      result = node100    }101  }102 103  return result104}105 106module.exports = fromJSON107fromJSON.default = fromJSON108 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai