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.
03.1k
1const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i2const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i3const fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/4const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/5const lengthUnitRegex =6 /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/7const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/8// Shadow always begins with x and y offset separated by underscore optionally prepended by inset9const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/10const imageRegex =11 /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/12 13export const isFraction = (value: string) => fractionRegex.test(value)14 15export const isNumber = (value: string) => !!value && !Number.isNaN(Number(value))16 17export const isInteger = (value: string) => !!value && Number.isInteger(Number(value))18 19export const isPercent = (value: string) => value.endsWith('%') && isNumber(value.slice(0, -1))20 21export const isTshirtSize = (value: string) => tshirtUnitRegex.test(value)22 23export const isAny = () => true24 25const isLengthOnly = (value: string) =>26 // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.27 // For example, `hsl(0 0% 0%)` would be classified as a length without this check.28 // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.29 lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)30 31const isNever = () => false32 33const isShadow = (value: string) => shadowRegex.test(value)34 35const isImage = (value: string) => imageRegex.test(value)36 37export const isAnyNonArbitrary = (value: string) =>38 !isArbitraryValue(value) && !isArbitraryVariable(value)39 40export const isNamedContainerQuery = (value: string) =>41 value.startsWith('@container') &&42 ((value[10] === '/' && value[11] !== undefined) ||43 (value[11] === 's' && value[16] !== undefined && value.startsWith('-size/', 10)) ||44 (value[11] === 'n' && value[18] !== undefined && value.startsWith('-normal/', 10)))45 46export const isArbitrarySize = (value: string) => getIsArbitraryValue(value, isLabelSize, isNever)47 48export const isArbitraryValue = (value: string) => arbitraryValueRegex.test(value)49 50export const isArbitraryLength = (value: string) =>51 getIsArbitraryValue(value, isLabelLength, isLengthOnly)52 53export const isArbitraryNumber = (value: string) =>54 getIsArbitraryValue(value, isLabelNumber, isNumber)55 56export const isArbitraryWeight = (value: string) => getIsArbitraryValue(value, isLabelWeight, isAny)57 58export const isArbitraryFamilyName = (value: string) =>59 getIsArbitraryValue(value, isLabelFamilyName, isNever)60 61export const isArbitraryPosition = (value: string) =>62 getIsArbitraryValue(value, isLabelPosition, isNever)63 64export const isArbitraryImage = (value: string) => getIsArbitraryValue(value, isLabelImage, isImage)65 66export const isArbitraryShadow = (value: string) =>67 getIsArbitraryValue(value, isLabelShadow, isShadow)68 69export const isArbitraryVariable = (value: string) => arbitraryVariableRegex.test(value)70 71export const isArbitraryVariableLength = (value: string) =>72 getIsArbitraryVariable(value, isLabelLength)73 74export const isArbitraryVariableFamilyName = (value: string) =>75 getIsArbitraryVariable(value, isLabelFamilyName)76 77export const isArbitraryVariablePosition = (value: string) =>78 getIsArbitraryVariable(value, isLabelPosition)79 80export const isArbitraryVariableSize = (value: string) => getIsArbitraryVariable(value, isLabelSize)81 82export const isArbitraryVariableImage = (value: string) =>83 getIsArbitraryVariable(value, isLabelImage)84 85export const isArbitraryVariableShadow = (value: string) =>86 getIsArbitraryVariable(value, isLabelShadow, true)87 88export const isArbitraryVariableWeight = (value: string) =>89 getIsArbitraryVariable(value, isLabelWeight, true)90 91// Helpers92 93const getIsArbitraryValue = (94 value: string,95 testLabel: (label: string) => boolean,96 testValue: (value: string) => boolean,97) => {98 const result = arbitraryValueRegex.exec(value)99 100 if (result) {101 if (result[1]) {102 return testLabel(result[1])103 }104 105 return testValue(result[2]!)106 }107 108 return false109}110 111const getIsArbitraryVariable = (112 value: string,113 testLabel: (label: string) => boolean,114 shouldMatchNoLabel = false,115) => {116 const result = arbitraryVariableRegex.exec(value)117 118 if (result) {119 if (result[1]) {120 return testLabel(result[1])121 }122 return shouldMatchNoLabel123 }124 125 return false126}127 128// Labels129 130const isLabelPosition = (label: string) => label === 'position' || label === 'percentage'131 132const isLabelImage = (label: string) => label === 'image' || label === 'url'133 134const isLabelSize = (label: string) => label === 'length' || label === 'size' || label === 'bg-size'135 136const isLabelLength = (label: string) => label === 'length'137 138const isLabelNumber = (label: string) => label === 'number'139 140const isLabelFamilyName = (label: string) => label === 'family-name'141 142const isLabelWeight = (label: string) => label === 'number' || label === 'weight'143 144const isLabelShadow = (label: string) => label === 'shadow'145 