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
node.js495 linesDownload Raw Back to lib
1'use strict'2 3let CssSyntaxError = require('./css-syntax-error')4let Stringifier = require('./stringifier')5let stringify = require('./stringify')6let { isClean, my } = require('./symbols')7 8function cloneNode(obj, parent) {9  let cloned = new obj.constructor()10  // An explicit stack instead of recursive calls to survive deeply11  // nested trees. Each entry is [source, its clone, clone's parent].12  let stack = [[obj, cloned, parent]]13 14  while (stack.length > 0) {15    let [source, target, targetParent] = stack.pop()16    for (let i in source) {17      if (!Object.prototype.hasOwnProperty.call(source, i)) {18        /* c8 ignore next 2 */19        continue20      }21      if (i === 'proxyCache') continue22      let value = source[i]23      let type = typeof value24 25      if (i === 'parent' && type === 'object') {26        if (targetParent) target[i] = targetParent27      } else if (i === 'source') {28        target[i] = value29      } else if (Array.isArray(value)) {30        let children = []31        target[i] = children32        for (let j of value) {33          let childClone = new j.constructor()34          children.push(childClone)35          stack.push([j, childClone, target])36        }37      } else {38        if (type === 'object' && value !== null) {39          let valueClone = new value.constructor()40          stack.push([value, valueClone, undefined])41          value = valueClone42        }43        target[i] = value44      }45    }46  }47 48  return cloned49}50 51function sourceOffset(inputCSS, position) {52  // Not all custom syntaxes support `offset` in `source.start` and `source.end`53  if (position && typeof position.offset !== 'undefined') {54    return position.offset55  }56 57  let column = 158  let line = 159  let offset = 060 61  for (let i = 0; i < inputCSS.length; i++) {62    if (line === position.line && column === position.column) {63      offset = i64      break65    }66 67    if (inputCSS[i] === '\n') {68      column = 169      line += 170    } else {71      column += 172    }73  }74 75  return offset76}77 78class Node {79  get proxyOf() {80    return this81  }82 83  constructor(defaults = {}) {84    this.raws = {}85    this[isClean] = false86    this[my] = true87 88    for (let name of Object.keys(defaults)) {89      if (name === '__proto__') continue90      if (name === 'nodes') {91        this.nodes = []92        for (let node of defaults[name]) {93          // Clone only nodes that already belong to another tree, so passing a94          // freshly created (parent-less) node adopts that instance instead of95          // a copy and keeps the caller's reference usable. See #1987.96          if (typeof node.clone === 'function' && node.parent) {97            this.append(node.clone())98          } else {99            this.append(node)100          }101        }102      } else {103        this[name] = defaults[name]104      }105    }106  }107 108  addToError(error) {109    error.postcssNode = this110    if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {111      let s = this.source112      error.stack = error.stack.replace(113        /\n\s{4}at /,114        `$&${s.input.from}:${s.start.line}:${s.start.column}$&`115      )116    }117    return error118  }119 120  after(add) {121    this.parent.insertAfter(this, add)122    return this123  }124 125  assign(overrides = {}) {126    for (let name in overrides) {127      this[name] = overrides[name]128    }129    return this130  }131 132  before(add) {133    this.parent.insertBefore(this, add)134    return this135  }136 137  cleanRaws(keepBetween) {138    delete this.raws.before139    delete this.raws.after140    if (!keepBetween) delete this.raws.between141  }142 143  clone(overrides = {}) {144    let cloned = cloneNode(this)145    for (let name in overrides) {146      cloned[name] = overrides[name]147    }148    return cloned149  }150 151  cloneAfter(overrides = {}) {152    let cloned = this.clone(overrides)153    this.parent.insertAfter(this, cloned)154    return cloned155  }156 157  cloneBefore(overrides = {}) {158    let cloned = this.clone(overrides)159    this.parent.insertBefore(this, cloned)160    return cloned161  }162 163  error(message, opts = {}) {164    if (this.source) {165      let { end, start } = this.rangeBy(opts)166      return this.source.input.error(167        message,168        { column: start.column, line: start.line },169        { column: end.column, line: end.line },170        opts171      )172    }173    return new CssSyntaxError(message)174  }175 176  getProxyProcessor() {177    return {178      get(node, prop) {179        if (prop === 'proxyOf') {180          return node181        } else if (prop === 'root') {182          return () => node.root().toProxy()183        } else {184          return node[prop]185        }186      },187 188      set(node, prop, value) {189        if (node[prop] === value) return true190        node[prop] = value191        if (192          prop === 'prop' ||193          prop === 'value' ||194          prop === 'name' ||195          prop === 'params' ||196          prop === 'important' ||197          /* c8 ignore next */198          prop === 'text'199        ) {200          node.markDirty()201        }202        return true203      }204    }205  }206 207  /* c8 ignore next 3 */208  markClean() {209    this[isClean] = true210  }211 212  markDirty() {213    if (this[isClean]) {214      this[isClean] = false215      let next = this216      while ((next = next.parent)) {217        next[isClean] = false218      }219    }220  }221 222  next() {223    if (!this.parent) return undefined224    let index = this.parent.index(this)225    return this.parent.nodes[index + 1]226  }227 228  positionBy(opts = {}) {229    let inputString =230      'document' in this.source.input231        ? this.source.input.document232        : this.source.input.css233    let pos = {234      column: this.source.start.column,235      line: this.source.start.line,236      offset: sourceOffset(inputString, this.source.start)237    }238    if (opts.index) {239      pos = this.positionInside(opts.index)240    } else if (opts.word) {241      let stringRepresentation = inputString.slice(242        sourceOffset(inputString, this.source.start),243        sourceOffset(inputString, this.source.end)244      )245      let index = stringRepresentation.indexOf(opts.word)246      if (index !== -1) pos = this.positionInside(index)247    }248    return pos249  }250 251  positionInside(index) {252    let column = this.source.start.column253    let line = this.source.start.line254    let inputString =255      'document' in this.source.input256        ? this.source.input.document257        : this.source.input.css258    let offset = sourceOffset(inputString, this.source.start)259    let end = offset + index260 261    for (let i = offset; i < end; i++) {262      if (inputString[i] === '\n') {263        column = 1264        line += 1265      } else {266        column += 1267      }268    }269 270    return { column, line, offset: end }271  }272 273  prev() {274    if (!this.parent) return undefined275    let index = this.parent.index(this)276    return this.parent.nodes[index - 1]277  }278 279  rangeBy(opts = {}) {280    let inputString =281      'document' in this.source.input282        ? this.source.input.document283        : this.source.input.css284    let start = {285      column: this.source.start.column,286      line: this.source.start.line,287      offset: sourceOffset(inputString, this.source.start)288    }289    let end = this.source.end290      ? {291          column: this.source.end.column + 1,292          line: this.source.end.line,293          offset:294            typeof this.source.end.offset === 'number'295              ? // `source.end.offset` is exclusive, so we don't need to add 1296                this.source.end.offset297              : // Since line/column in this.source.end is inclusive,298                // the `sourceOffset(... , this.source.end)` returns an inclusive offset.299                // So, we add 1 to convert it to exclusive.300                sourceOffset(inputString, this.source.end) + 1301        }302      : {303          column: start.column + 1,304          line: start.line,305          offset: start.offset + 1306        }307 308    if (opts.word) {309      let stringRepresentation = inputString.slice(310        sourceOffset(inputString, this.source.start),311        sourceOffset(inputString, this.source.end)312      )313      let index = stringRepresentation.indexOf(opts.word)314      if (index !== -1) {315        start = this.positionInside(index)316        end = this.positionInside(index + opts.word.length)317      }318    } else {319      if (opts.start) {320        start = {321          column: opts.start.column,322          line: opts.start.line,323          offset: sourceOffset(inputString, opts.start)324        }325      } else if (typeof opts.index === 'number') {326        start = this.positionInside(opts.index)327      }328 329      if (opts.end) {330        end = {331          column: opts.end.column,332          line: opts.end.line,333          offset: sourceOffset(inputString, opts.end)334        }335      } else if (typeof opts.endIndex === 'number') {336        end = this.positionInside(opts.endIndex)337      } else if (typeof opts.index === 'number') {338        end = this.positionInside(opts.index + 1)339      }340    }341 342    if (343      end.line < start.line ||344      (end.line === start.line && end.column <= start.column)345    ) {346      end = {347        column: start.column + 1,348        line: start.line,349        offset: start.offset + 1350      }351    }352 353    return { end, start }354  }355 356  raw(prop, defaultType) {357    let str = new Stringifier()358    return str.raw(this, prop, defaultType)359  }360 361  remove() {362    if (this.parent) {363      this.parent.removeChild(this)364    }365    this.parent = undefined366    return this367  }368 369  replaceWith(...nodes) {370    if (this.parent) {371      let bookmark = this372      let foundSelf = false373      for (let node of nodes) {374        if (node === this) {375          foundSelf = true376        } else if (foundSelf) {377          this.parent.insertAfter(bookmark, node)378          bookmark = node379        } else {380          this.parent.insertBefore(bookmark, node)381        }382      }383 384      if (!foundSelf) {385        this.remove()386      }387    }388 389    return this390  }391 392  root() {393    let result = this394    while (result.parent && result.parent.type !== 'document') {395      result = result.parent396    }397    return result398  }399 400  toJSON(_, inputs) {401    let emitInputs = inputs == null402    inputs = inputs || new Map()403 404    // A worklist instead of recursive `toJSON()` calls to survive deeply405    // nested trees. Each entry converts one node and writes the result406    // into the already converted parent by [holder, key].407    let holderOfRoot = []408    let queue = [[this, holderOfRoot, 0]]409 410    for (let step = 0; step < queue.length; step++) {411      let [node, holder, key] = queue[step]412      let fixed = {}413      holder[key] = fixed414 415      for (let name in node) {416        if (!Object.prototype.hasOwnProperty.call(node, name)) {417          /* c8 ignore next 2 */418          continue419        }420        if (name === 'parent' || name === 'proxyCache') continue421        let value = node[name]422 423        if (Array.isArray(value)) {424          let fixedArray = []425          fixed[name] = fixedArray426          for (let i = 0; i < value.length; i++) {427            let item = value[i]428            if (typeof item === 'object' && item.toJSON) {429              if (item.toJSON === Node.prototype.toJSON) {430                queue.push([item, fixedArray, i])431              } else {432                fixedArray[i] = item.toJSON(null, inputs)433              }434            } else {435              fixedArray[i] = item436            }437          }438        } else if (typeof value === 'object' && value.toJSON) {439          if (value.toJSON === Node.prototype.toJSON) {440            queue.push([value, fixed, name])441          } else {442            fixed[name] = value.toJSON(null, inputs)443          }444        } else if (name === 'source') {445          if (value == null) continue446          let inputId = inputs.get(value.input)447          if (inputId == null) {448            inputId = inputs.size449            inputs.set(value.input, inputId)450          }451          fixed[name] = {452            end: value.end,453            inputId,454            start: value.start455          }456        } else {457          fixed[name] = value458        }459      }460    }461 462    let fixed = holderOfRoot[0]463    if (emitInputs) {464      fixed.inputs = [...inputs.keys()].map(input => input.toJSON())465    }466 467    return fixed468  }469 470  toProxy() {471    if (!this.proxyCache) {472      this.proxyCache = new Proxy(this, this.getProxyProcessor())473    }474    return this.proxyCache475  }476 477  toString(stringifier = stringify) {478    if (stringifier.stringify) stringifier = stringifier.stringify479    let result = ''480    stringifier(this, i => {481      result += i482    })483    return result484  }485 486  warn(result, text, opts = {}) {487    let data = { node: this }488    for (let i in opts) data[i] = opts[i]489    return result.warn(text, data)490  }491}492 493module.exports = Node494Node.default = Node495 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai