Spaces:
Running
Running
adjustments
Browse files- build/asset-manifest.json +6 -6
- build/index.html +1 -1
- build/static/css/main.6f7196f1.css +4 -0
- build/static/css/main.6f7196f1.css.map +1 -0
- build/static/css/main.8c50b145.css +0 -4
- build/static/css/main.8c50b145.css.map +0 -1
- build/static/js/{main.1c60d32c.js β main.26cb67d8.js} +0 -0
- build/static/js/{main.1c60d32c.js.LICENSE.txt β main.26cb67d8.js.LICENSE.txt} +0 -0
- build/static/js/{main.1c60d32c.js.map β main.26cb67d8.js.map} +0 -0
- src/pages/Calculator.tsx +428 -1130
build/asset-manifest.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
-
"main.css": "/static/css/main.
|
| 4 |
-
"main.js": "/static/js/main.
|
| 5 |
"static/media/logo-dark-mode.png": "/static/media/logo-dark-mode.0c51ff42111d2779453a.png",
|
| 6 |
"static/media/logo-light-mode.png": "/static/media/logo-light-mode.6bc3b2d5ed1ec2d7d721.png",
|
| 7 |
"index.html": "/index.html",
|
| 8 |
-
"main.
|
| 9 |
-
"main.
|
| 10 |
},
|
| 11 |
"entrypoints": [
|
| 12 |
-
"static/css/main.
|
| 13 |
-
"static/js/main.
|
| 14 |
]
|
| 15 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
+
"main.css": "/static/css/main.6f7196f1.css",
|
| 4 |
+
"main.js": "/static/js/main.26cb67d8.js",
|
| 5 |
"static/media/logo-dark-mode.png": "/static/media/logo-dark-mode.0c51ff42111d2779453a.png",
|
| 6 |
"static/media/logo-light-mode.png": "/static/media/logo-light-mode.6bc3b2d5ed1ec2d7d721.png",
|
| 7 |
"index.html": "/index.html",
|
| 8 |
+
"main.6f7196f1.css.map": "/static/css/main.6f7196f1.css.map",
|
| 9 |
+
"main.26cb67d8.js.map": "/static/js/main.26cb67d8.js.map"
|
| 10 |
},
|
| 11 |
"entrypoints": [
|
| 12 |
+
"static/css/main.6f7196f1.css",
|
| 13 |
+
"static/js/main.26cb67d8.js"
|
| 14 |
]
|
| 15 |
}
|
build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="icon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="Titan Takeoff Server" content="Titan Takeoff Server"/><link rel="manifest" crossorigin="use-credentials" href="manifest.json"/><title>Titan Takeoff Server</title><script defer="defer" src="./static/js/main.
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="icon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="Titan Takeoff Server" content="Titan Takeoff Server"/><link rel="manifest" crossorigin="use-credentials" href="manifest.json"/><title>Titan Takeoff Server</title><script defer="defer" src="./static/js/main.26cb67d8.js"></script><link href="./static/css/main.6f7196f1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
build/static/css/main.6f7196f1.css
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
|
| 3 |
+
*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.static{position:static}.m-2{margin:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-8{margin-left:2rem}.mr-4{margin-right:1rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.grid{display:grid}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-full{width:100%}.max-w-4xl{max-width:56rem}.flex-grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-4{gap:1rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.whitespace-nowrap{white-space:nowrap}.border{border-width:1px}.p-4{padding:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.invert{--tw-invert:invert(100%)}.filter,.invert{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{--text-color:#f9fafb;--background-color:#181f26;--input-color:#1f2937;--button-color:#374151;--button-hover-color:#4b5563;--scrollbar-color:#9b9b9bb3;--chatbox-color:#2f3e46;--message-border-colors:#e25e5b,#f29062,#ffc068,#ffe7dc,#71cbe8,#444292;--message-text-color:var(--text-color)}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#181f26;background-color:var(--background-color);color:#f9fafb;color:var(--text-color);display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;height:100vh;margin:0}body.light{--text-color:#111827;--background-color:#f9fafb;--input-color:#f1f5f9;--button-color:#e5e7eb;--button-hover-color:#d1d5db;--scrollbar-color:#646464b3;--chatbox-color:#64748b;--message-border-colors:#e25e5b,#f29062,#ffc068,#ffe7dc,#71cbe8,#444292;--message-text-color:#f9fafb}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}#topbar{height:60px}#layout{height:calc(100vh - 60px)}#textarea{height:calc(100vh - 180px)}#textarea,.config-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);width:100%}.button-style{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color)}.button-style:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.toggle-switch{display:inline-block;height:34px;margin-top:1em;position:relative;width:60px}.toggle-switch input{height:0;opacity:0;width:0}.toggle-switch .slider{background-color:#374151;background-color:var(--button-color);border-radius:34px;bottom:0;cursor:pointer;height:34px;left:0;position:absolute;right:0;top:0;transition:background-color .4s}.toggle-switch .slider:before{background-color:#f9fafb;background-color:var(--text-color);content:"";position:absolute}.toggle-switch .slider-content,.toggle-switch .slider:before{border-radius:50%;bottom:4px;height:26px;left:4px;transition:transform .4s;width:26px}.toggle-switch .slider-content{align-items:center;display:flex;justify-content:center;position:relative;top:4px}.toggle-switch input:checked+.slider .slider-content,.toggle-switch input:checked+.slider:before{transform:translateX(26px)}#sun-icon{color:#e5e7eb}#moon-icon{color:#374151}.modal-overlay{align-items:center;background-color:#000000b3;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%}.modal-content{background-color:#fff;background-color:#181f26;background-color:var(--background-color);border-radius:8px;color:#f9fafb;color:var(--text-color);max-width:500px;padding:20px;width:80%}.modal-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between}.form-button{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color);padding:8px;width:100%}.form-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.refresh-button{align-items:center;border-radius:50%;display:flex;height:36px;justify-content:center;min-width:36px;transition:transform .4s;width:36px}.refresh-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.content-header{display:flex;flex-direction:row;justify-content:space-between;width:100%}.dropdown-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);height:32px;min-width:200px;padding-left:8px;width:100%}#chat-container,#playground-box{height:calc(100vh - 60px)}#chat-container{display:flex;flex-direction:column}#chatbox{background-color:#1f2937;background-color:var(--input-color);flex:1 1;margin:1em;overflow:auto;scrollbar-color:#9b9b9bb3 #0000;scrollbar-color:var(--scrollbar-color) #0000;scrollbar-width:thin}#chatbox::-webkit-scrollbar{width:12px}#chatbox::-webkit-scrollbar-track{background:#0000}#chatbox::-webkit-scrollbar-thumb{border-radius:50px}#chatbox::-webkit-scrollbar-thumb,#chatbox:hover::-webkit-scrollbar-thumb{background:#9b9b9bb3;background:var(--scrollbar-color)}#inputbox{background-color:#1f2937;background-color:var(--input-color);display:flex;flex-direction:row;height:80px;margin:1em}#message-input{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color);flex:1 1}.chat-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.message{background-color:#2f3e46;background-color:var(--chatbox-color);border-radius:10px;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d;color:#f9fafb;color:var(--message-text-color);margin:10px;padding:10px;position:relative;z-index:1}.message.user{margin-left:auto;margin-right:40px}.message.assistant{margin-left:40px;margin-right:auto}.home-button{width:600px}.home-button,.home-button-small{background-color:#374151;background-color:var(--button-color);border-radius:10px;color:#f9fafb;color:var(--text-color);cursor:pointer;padding:20px;text-align:center;transition:background-color .3s}.home-button-small{width:300px}.home-button-small:hover,.home-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.home-button-title{font-size:20px;font-weight:700;margin-bottom:10px}.home-button-description{font-size:16px}.chart{border:1px solid #f9fafb;border:1px solid var(--text-color);border-radius:4px;flex-direction:column;margin-bottom:10px;margin-top:10px;padding-bottom:12px;padding-left:20px;padding-top:12px}.chart,.chart-row{align-items:center;display:flex}.chart-row{flex-direction:row}.chart-row-size,.chart-row-title{width:100px}.calculator-input-box{display:flex;flex-direction:row}.calculator-box,.calculator-input-box{border:1px solid #f9fafb;border:1px solid var(--text-color);border-radius:4px;margin-bottom:10px;margin-top:10px;padding-block:12px;width:100%}.calculator-input-title{height:100%;margin-left:20px;width:140px}.calculator-input-tab,.calculator-input-tab-active{padding-bottom:4px;padding-left:8px;padding-right:8px}.calculator-input-tab-active{border-bottom:2px solid #f9fafb;border-bottom:2px solid var(--text-color)}.calculator-input,.calculator-select{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);display:block;padding-block:4px;width:100%}#tooltip{opacity:0;padding:5px;pointer-events:none;position:absolute}#right-container{display:flex;flex-direction:column;height:calc(100vh - 60px)}.table-cell{border:1px solid #f9fafb;border:1px solid var(--text-color)}.chart-side-panel{width:200px}.side-panel-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);display:block;padding-block:4px;width:100%}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
| 4 |
+
/*# sourceMappingURL=main.6f7196f1.css.map*/
|
build/static/css/main.6f7196f1.css.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"static/css/main.6f7196f1.css","mappings":"AAAA;;CAAc,CAAd,uCAAc,CAAd,qBAAc,CAAd,8BAAc,CAAd,wCAAc,CAAd,4BAAc,CAAd,uCAAc,CAAd,gHAAc,CAAd,8BAAc,CAAd,eAAc,CAAd,UAAc,CAAd,wBAAc,CAAd,uBAAc,CAAd,aAAc,CAAd,QAAc,CAAd,4DAAc,CAAd,gCAAc,CAAd,mCAAc,CAAd,mBAAc,CAAd,eAAc,CAAd,uBAAc,CAAd,2BAAc,CAAd,8CAAc,CAAd,mGAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,aAAc,CAAd,iBAAc,CAAd,sBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,oBAAc,CAAd,aAAc,CAAd,mEAAc,CAAd,aAAc,CAAd,mBAAc,CAAd,cAAc,CAAd,+BAAc,CAAd,mBAAc,CAAd,sBAAc,CAAd,mBAAc,CAAd,QAAc,CAAd,SAAc,CAAd,iCAAc,CAAd,gHAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,4BAAc,CAAd,gCAAc,CAA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kCAAmC,CACnC,iBAAkB,CAFlB,kBAAmB,CADnB,eAAgB,CAIhB,kBAAmB,CALnB,UAeF,CAEA,wBAGE,WAAY,CADZ,gBAAiB,CADjB,WAGF,CAQA,mDALE,kBAAmB,CACnB,gBAAiB,CACjB,iBAQF,CALA,6BAIE,+BAA0C,CAA1C,yCACF,CAUA,qCACE,wBAAoC,CAApC,mCAAoC,CACpC,aAAwB,CAAxB,uBAAwB,CACxB,aAAc,CAEd,iBAAkB,CADlB,UAEF,CAEA,SAEE,SAAU,CAEV,WAAY,CADZ,mBAAoB,CAFpB,iBAIF,CAEA,iBACE,YAAa,CACb,qBAAsB,CACtB,yBACF,CAEA,YACE,wBAAmC,CAAnC,kCACF,CAEA,kBACE,WACF,CAEA,kBACE,wBAAoC,CAApC,mCAAoC,CACpC,aAAwB,CAAxB,uBAAwB,CACxB,aAAc,CAEd,iBAAkB,CADlB,UAEF,CAhcA,uFAicA","sources":["index.css"],"sourcesContent":["@tailwind base;\r\n@tailwind components;\r\n@tailwind utilities;\r\n\r\n:root {\r\n --text-color: #f9fafb;\r\n --background-color: #181f26;\r\n --input-color: #1f2937; /* lighter */\r\n --button-color: #374151; /* lighter */\r\n --button-hover-color: #4b5563; /* lighter */\r\n --scrollbar-color: rgba(155, 155, 155, 0.7);\r\n --chatbox-color: #2f3e46;\r\n --message-border-colors: #e25e5b, #f29062, #ffc068, #ffe7dc, #71cbe8, #444292;\r\n --message-text-color: var(--text-color);\r\n}\r\n\r\nbody {\r\n margin: 0;\r\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',\r\n 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n background-color: var(--background-color);\r\n color: var(--text-color);\r\n display: flex;\r\n flex-direction: column;\r\n height: 100vh;\r\n margin: 0;\r\n}\r\n\r\nbody.light {\r\n --text-color: #111827;\r\n --background-color: #f9fafb;\r\n --input-color: #f1f5f9;\r\n --button-color: #e5e7eb;\r\n --button-hover-color: #d1d5db;\r\n --scrollbar-color: rgba(100, 100, 100, 0.7);\r\n --chatbox-color: #64748b;\r\n --message-border-colors: #e25e5b, #f29062, #ffc068, #ffe7dc, #71cbe8, #444292;\r\n --message-text-color: #f9fafb;\r\n}\r\n\r\ncode {\r\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\r\n}\r\n\r\n#topbar {\r\n height: 60px;\r\n}\r\n\r\n#layout {\r\n height: calc(100vh - 60px);\r\n}\r\n\r\n#textarea {\r\n color: var(--text-color);\r\n background-color: var(--input-color);\r\n width: 100%;\r\n height: calc(100vh - 180px);\r\n}\r\n\r\n.config-input {\r\n color: var(--text-color);\r\n background-color: var(--input-color);\r\n width: 100%;\r\n}\r\n\r\n/* button */\r\n.button-style {\r\n background-color: var(--button-color);\r\n color: var(--text-color);\r\n}\r\n\r\n.button-style:hover {\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n/* toggle switch */\r\n.toggle-switch {\r\n position: relative;\r\n display: inline-block;\r\n width: 60px;\r\n height: 34px;\r\n margin-top: 1em;\r\n}\r\n\r\n.toggle-switch input {\r\n opacity: 0;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\n.toggle-switch .slider {\r\n position: absolute;\r\n cursor: pointer;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n height: 34px;\r\n background-color: var(--button-color);\r\n transition: background-color 0.4s;\r\n border-radius: 34px;\r\n}\r\n\r\n.toggle-switch .slider:before {\r\n position: absolute;\r\n content: '';\r\n height: 26px;\r\n width: 26px;\r\n left: 4px;\r\n bottom: 4px;\r\n background-color: var(--text-color);\r\n transition: transform 0.4s;\r\n border-radius: 50%;\r\n}\r\n\r\n.toggle-switch .slider-content {\r\n position: relative;\r\n display: flex;\r\n height: 26px;\r\n width: 26px;\r\n top: 4px;\r\n align-items: center;\r\n justify-content: center;\r\n left: 4px;\r\n bottom: 4px;\r\n transition: transform 0.4s;\r\n border-radius: 50%;\r\n}\r\n\r\n.toggle-switch input:checked + .slider:before,\r\n.toggle-switch input:checked + .slider .slider-content {\r\n transform: translateX(26px);\r\n}\r\n\r\n#sun-icon {\r\n color: #e5e7eb;\r\n}\r\n\r\n#moon-icon {\r\n color: #374151;\r\n}\r\n\r\n/* modal */\r\n.modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n background-color: rgba(0, 0, 0, 0.7);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.modal-content {\r\n background-color: #fff;\r\n padding: 20px;\r\n border-radius: 8px;\r\n max-width: 500px;\r\n width: 80%;\r\n background-color: var(--background-color);\r\n color: var(--text-color);\r\n}\r\n\r\n.modal-header {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.form-button {\r\n background-color: var(--button-color);\r\n color: var(--text-color);\r\n width: 100%;\r\n padding: 8px;\r\n}\r\n\r\n.form-button:hover {\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n.refresh-button {\r\n width: 36px;\r\n height: 36px;\r\n min-width: 36px;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n transition: transform 0.4s;\r\n border-radius: 50%;\r\n}\r\n\r\n.refresh-button:hover {\r\n /* transform: rotate(360deg); */\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n.content-header {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n width: 100%;\r\n}\r\n\r\n.dropdown-input {\r\n background-color: var(--input-color);\r\n color: var(--text-color);\r\n padding-left: 8px;\r\n width: 100%;\r\n min-width: 200px;\r\n height: 32px;\r\n}\r\n\r\n#playground-box {\r\n height: calc(100vh - 60px);\r\n}\r\n\r\n#chat-container {\r\n display: flex;\r\n flex-direction: column;\r\n height: calc(100vh - 60px);\r\n}\r\n\r\n#chatbox {\r\n flex: 1;\r\n overflow: auto;\r\n margin: 1em;\r\n scrollbar-width: thin; /* For Firefox */\r\n scrollbar-color: var(--scrollbar-color) transparent; /* For Firefox */\r\n background-color: var(--input-color);\r\n}\r\n\r\n#chatbox::-webkit-scrollbar {\r\n /* For Chrome, Safari, and Opera */\r\n width: 12px;\r\n}\r\n\r\n#chatbox::-webkit-scrollbar-track {\r\n /* For Chrome, Safari, and Opera */\r\n background: transparent;\r\n}\r\n\r\n#chatbox::-webkit-scrollbar-thumb {\r\n /* For Chrome, Safari, and Opera */\r\n background: var(--scrollbar-color);\r\n border-radius: 50px;\r\n}\r\n\r\n#chatbox:hover::-webkit-scrollbar-thumb {\r\n /* For Chrome, Safari, and Opera */\r\n background: var(--scrollbar-color);\r\n}\r\n\r\n#inputbox {\r\n height: 80px;\r\n margin: 1em;\r\n background-color: var(--input-color);\r\n display: flex;\r\n flex-direction: row;\r\n}\r\n\r\n#message-input {\r\n flex: 1;\r\n background-color: var(--button-color);\r\n color: var(--text-color);\r\n}\r\n\r\n.chat-button:hover {\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n.message {\r\n position: relative;\r\n background-color: var(--chatbox-color);\r\n box-shadow:\r\n 0 10px 15px -3px rgba(0, 0, 0, 0.1),\r\n 0 4px 6px -2px rgba(0, 0, 0, 0.05);\r\n border-radius: 10px;\r\n color: var(--message-text-color);\r\n padding: 10px;\r\n margin: 10px;\r\n z-index: 1;\r\n}\r\n\r\n.message.user {\r\n margin-left: auto;\r\n margin-right: 40px;\r\n}\r\n\r\n.message.assistant {\r\n margin-left: 40px;\r\n margin-right: auto;\r\n}\r\n\r\n.home-button {\r\n padding: 20px;\r\n background-color: var(--button-color);\r\n color: var(--text-color);\r\n border-radius: 10px;\r\n width: 600px;\r\n text-align: center;\r\n cursor: pointer;\r\n transition: background-color 0.3s;\r\n}\r\n\r\n.home-button-small {\r\n padding: 20px;\r\n background-color: var(--button-color);\r\n color: var(--text-color);\r\n border-radius: 10px;\r\n width: 300px;\r\n text-align: center;\r\n cursor: pointer;\r\n transition: background-color 0.3s;\r\n}\r\n\r\n.home-button-small:hover {\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n.home-button:hover {\r\n background-color: var(--button-hover-color);\r\n}\r\n\r\n.home-button-title {\r\n font-size: 20px;\r\n font-weight: bold;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.home-button-description {\r\n font-size: 16px;\r\n}\r\n\r\n/* Calculator */\r\n.chart {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n margin-top: 10px;\r\n margin-bottom: 10px;\r\n border: 1px solid var(--text-color);\r\n border-radius: 4px;\r\n padding-left: 20px;\r\n padding-top: 12px;\r\n padding-bottom: 12px;\r\n}\r\n\r\n.chart-row {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n}\r\n\r\n.chart-row-title {\r\n width: 100px;\r\n}\r\n\r\n.chart-row-size {\r\n width: 100px;\r\n}\r\n\r\n.calculator-input-box {\r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n margin-top: 10px;\r\n margin-bottom: 10px;\r\n border: 1px solid var(--text-color);\r\n border-radius: 4px;\r\n padding-block: 12px;\r\n}\r\n\r\n.calculator-box {\r\n width: 100%;\r\n margin-top: 10px;\r\n margin-bottom: 10px;\r\n border: 1px solid var(--text-color);\r\n border-radius: 4px;\r\n padding-block: 12px;\r\n}\r\n\r\n.calculator-input-title {\r\n width: 140px;\r\n margin-left: 20px;\r\n height: 100%;\r\n}\r\n\r\n.calculator-input-tab {\r\n padding-bottom: 4px;\r\n padding-left: 8px;\r\n padding-right: 8px;\r\n}\r\n\r\n.calculator-input-tab-active {\r\n padding-bottom: 4px;\r\n padding-left: 8px;\r\n padding-right: 8px;\r\n border-bottom: 2px solid var(--text-color);\r\n}\r\n\r\n.calculator-select {\r\n background-color: var(--input-color);\r\n color: var(--text-color);\r\n display: block;\r\n width: 100%;\r\n padding-block: 4px;\r\n}\r\n\r\n.calculator-input {\r\n background-color: var(--input-color);\r\n color: var(--text-color);\r\n display: block;\r\n width: 100%;\r\n padding-block: 4px;\r\n}\r\n\r\n#tooltip {\r\n position: absolute;\r\n opacity: 0;\r\n pointer-events: none;\r\n padding: 5px;\r\n}\r\n\r\n#right-container {\r\n display: flex;\r\n flex-direction: column;\r\n height: calc(100vh - 60px);\r\n}\r\n\r\n.table-cell {\r\n border: 1px solid var(--text-color);\r\n}\r\n\r\n.chart-side-panel {\r\n width: 200px;\r\n}\r\n\r\n.side-panel-input {\r\n background-color: var(--input-color);\r\n color: var(--text-color);\r\n display: block;\r\n width: 100%;\r\n padding-block: 4px;\r\n}\r\n"],"names":[],"sourceRoot":""}
|
build/static/css/main.8c50b145.css
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
/*
|
| 2 |
-
! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
|
| 3 |
-
*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.static{position:static}.m-2{margin:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.my-8{margin-bottom:2rem;margin-top:2rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.mr-4{margin-right:1rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.table{display:table}.table-cell{display:table-cell}.grid{display:grid}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-full{width:100%}.max-w-4xl{max-width:56rem}.flex-grow{flex-grow:1}.table-auto{table-layout:auto}.border-collapse{border-collapse:collapse}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-4{gap:1rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.whitespace-nowrap{white-space:nowrap}.border{border-width:1px}.p-4{padding:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.invert{--tw-invert:invert(100%)}.filter,.invert{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{--text-color:#f9fafb;--background-color:#181f26;--input-color:#1f2937;--button-color:#374151;--button-hover-color:#4b5563;--scrollbar-color:#9b9b9bb3;--chatbox-color:#2f3e46;--message-border-colors:#e25e5b,#f29062,#ffc068,#ffe7dc,#71cbe8,#444292;--message-text-color:var(--text-color)}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#181f26;background-color:var(--background-color);color:#f9fafb;color:var(--text-color);display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;height:100vh;margin:0}body.light{--text-color:#111827;--background-color:#f9fafb;--input-color:#f1f5f9;--button-color:#e5e7eb;--button-hover-color:#d1d5db;--scrollbar-color:#646464b3;--chatbox-color:#64748b;--message-border-colors:#e25e5b,#f29062,#ffc068,#ffe7dc,#71cbe8,#444292;--message-text-color:#f9fafb}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}#topbar{height:60px}#layout{height:calc(100vh - 60px)}#textarea{height:calc(100vh - 180px)}#textarea,.config-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);width:100%}.button-style{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color)}.button-style:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.toggle-switch{display:inline-block;height:34px;margin-top:1em;position:relative;width:60px}.toggle-switch input{height:0;opacity:0;width:0}.toggle-switch .slider{background-color:#374151;background-color:var(--button-color);border-radius:34px;bottom:0;cursor:pointer;height:34px;left:0;position:absolute;right:0;top:0;transition:background-color .4s}.toggle-switch .slider:before{background-color:#f9fafb;background-color:var(--text-color);content:"";position:absolute}.toggle-switch .slider-content,.toggle-switch .slider:before{border-radius:50%;bottom:4px;height:26px;left:4px;transition:transform .4s;width:26px}.toggle-switch .slider-content{align-items:center;display:flex;justify-content:center;position:relative;top:4px}.toggle-switch input:checked+.slider .slider-content,.toggle-switch input:checked+.slider:before{transform:translateX(26px)}#sun-icon{color:#e5e7eb}#moon-icon{color:#374151}.modal-overlay{align-items:center;background-color:#000000b3;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%}.modal-content{background-color:#fff;background-color:#181f26;background-color:var(--background-color);border-radius:8px;color:#f9fafb;color:var(--text-color);max-width:500px;padding:20px;width:80%}.modal-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between}.form-button{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color);padding:8px;width:100%}.form-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.refresh-button{align-items:center;border-radius:50%;display:flex;height:36px;justify-content:center;min-width:36px;transition:transform .4s;width:36px}.refresh-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.content-header{display:flex;flex-direction:row;justify-content:space-between;width:100%}.dropdown-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);height:32px;min-width:200px;padding-left:8px;width:100%}#chat-container,#playground-box{height:calc(100vh - 60px)}#chat-container{display:flex;flex-direction:column}#chatbox{background-color:#1f2937;background-color:var(--input-color);flex:1 1;margin:1em;overflow:auto;scrollbar-color:#9b9b9bb3 #0000;scrollbar-color:var(--scrollbar-color) #0000;scrollbar-width:thin}#chatbox::-webkit-scrollbar{width:12px}#chatbox::-webkit-scrollbar-track{background:#0000}#chatbox::-webkit-scrollbar-thumb{border-radius:50px}#chatbox::-webkit-scrollbar-thumb,#chatbox:hover::-webkit-scrollbar-thumb{background:#9b9b9bb3;background:var(--scrollbar-color)}#inputbox{background-color:#1f2937;background-color:var(--input-color);display:flex;flex-direction:row;height:80px;margin:1em}#message-input{background-color:#374151;background-color:var(--button-color);color:#f9fafb;color:var(--text-color);flex:1 1}.chat-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.message{background-color:#2f3e46;background-color:var(--chatbox-color);border-radius:10px;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d;color:#f9fafb;color:var(--message-text-color);margin:10px;padding:10px;position:relative;z-index:1}.message.user{margin-left:auto;margin-right:40px}.message.assistant{margin-left:40px;margin-right:auto}.home-button{width:600px}.home-button,.home-button-small{background-color:#374151;background-color:var(--button-color);border-radius:10px;color:#f9fafb;color:var(--text-color);cursor:pointer;padding:20px;text-align:center;transition:background-color .3s}.home-button-small{width:300px}.home-button-small:hover,.home-button:hover{background-color:#4b5563;background-color:var(--button-hover-color)}.home-button-title{font-size:20px;font-weight:700;margin-bottom:10px}.home-button-description{font-size:16px}.chart{border:1px solid #f9fafb;border:1px solid var(--text-color);border-radius:4px;flex-direction:column;margin-bottom:10px;margin-top:10px;padding-bottom:12px;padding-left:20px;padding-top:12px}.chart,.chart-row{align-items:center;display:flex}.chart-row{flex-direction:row}.chart-row-size,.chart-row-title{width:100px}.calculator-input-box{display:flex;flex-direction:row}.calculator-box,.calculator-input-box{border:1px solid #f9fafb;border:1px solid var(--text-color);border-radius:4px;margin-bottom:10px;margin-top:10px;padding-block:12px;width:100%}.calculator-input-title{height:100%;margin-left:20px;width:140px}.calculator-input-tab,.calculator-input-tab-active{padding-bottom:4px;padding-left:8px;padding-right:8px}.calculator-input-tab-active{border-bottom:2px solid #f9fafb;border-bottom:2px solid var(--text-color)}.calculator-input,.calculator-select{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);display:block;padding-block:4px;width:100%}#tooltip{opacity:0;padding:5px;pointer-events:none;position:absolute}#right-container{display:flex;flex-direction:column;height:calc(100vh - 60px)}.table-cell{border:1px solid #f9fafb;border:1px solid var(--text-color)}.chart-side-panel{width:200px}.side-panel-input{background-color:#1f2937;background-color:var(--input-color);color:#f9fafb;color:var(--text-color);display:block;padding-block:4px;width:100%}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
| 4 |
-
/*# sourceMappingURL=main.8c50b145.css.map*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/static/css/main.8c50b145.css.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"static/css/main.8c50b145.css","mappings":"AAAA;;CAAc,CAAd,uCAAc,CAAd,qBAAc,CAAd,8BAAc,CAAd,wCAAc,CAAd,4BAAc,CAAd,uCAAc,CAAd,gHAAc,CAAd,8BAAc,CAAd,eAAc,CAAd,UAAc,CAAd,wBAAc,CAAd,uBAAc,CAAd,aAAc,CAAd,QAAc,CAAd,4DAAc,CAAd,gCAAc,CAAd,mCAAc,CAAd,mBAAc,CAAd,eAAc,CAAd,uBAAc,CAAd,2BAAc,CAAd,8CAAc,CAAd,mGAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,aAAc,CAAd,iBAAc,CAAd,sBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,8BAAc,CAAd,oBAAc,CAAd,aAAc,CAAd,mEAAc,CAAd,aAAc,CAAd,mBAAc,CAAd,cAAc,CAAd,+BAAc,CAAd,mBAAc,CAAd,sBAAc,CAAd,mBAAc,CAAd,QAAc,CAAd,SAAc,CAAd,iCAAc,CAAd,gHAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,4BAAc,CAAd,gCAAc,CAAd,+BAAc,CAAd,mEAAc,CAAd,0CAAc,CAAd,mBAAc,CAAd,mDAAc,CAAd,sDAAc,CAAd,YAAc,CAAd,yBAAc,CAAd,2DAA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AAmC,CACnC,iBAAkB,CAFlB,kBAAmB,CADnB,eAAgB,CAIhB,kBAAmB,CALnB,UAeF,CAEA,wBAGE,WAAY,CADZ,gBAAiB,CADjB,WAGF,CAQA,mDALE,kBAAmB,CACnB,gBAAiB,CACjB,iBAQF,CALA,6BAIE,+BAA0C,CAA1C,yCACF,CAUA,qCACE,wBAAoC,CAApC,mCAAoC,CACpC,aAAwB,CAAxB,uBAAwB,CACxB,aAAc,CAEd,iBAAkB,CADlB,UAEF,CAEA,SAEE,SAAU,CAEV,WAAY,CADZ,mBAAoB,CAFpB,iBAIF,CAEA,iBACE,YAAa,CACb,qBAAsB,CACtB,yBACF,CAEA,YACE,wBAAmC,CAAnC,kCACF,CAEA,kBACE,WACF,CAEA,kBACE,wBAAoC,CAApC,mCAAoC,CACpC,aAAwB,CAAxB,uBAAwB,CACxB,aAAc,CAEd,iBAAkB,CADlB,UAEF,CAhcA,uFAicA","sources":["index.css"],"sourcesContent":["@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n:root {\n --text-color: #f9fafb;\n --background-color: #181f26;\n --input-color: #1f2937; /* lighter */\n --button-color: #374151; /* lighter */\n --button-hover-color: #4b5563; /* lighter */\n --scrollbar-color: rgba(155, 155, 155, 0.7);\n --chatbox-color: #2f3e46;\n --message-border-colors: #e25e5b, #f29062, #ffc068, #ffe7dc, #71cbe8, #444292;\n --message-text-color: var(--text-color);\n}\n\nbody {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',\n 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background-color: var(--background-color);\n color: var(--text-color);\n display: flex;\n flex-direction: column;\n height: 100vh;\n margin: 0;\n}\n\nbody.light {\n --text-color: #111827;\n --background-color: #f9fafb;\n --input-color: #f1f5f9;\n --button-color: #e5e7eb;\n --button-hover-color: #d1d5db;\n --scrollbar-color: rgba(100, 100, 100, 0.7);\n --chatbox-color: #64748b;\n --message-border-colors: #e25e5b, #f29062, #ffc068, #ffe7dc, #71cbe8, #444292;\n --message-text-color: #f9fafb;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n\n#topbar {\n height: 60px;\n}\n\n#layout {\n height: calc(100vh - 60px);\n}\n\n#textarea {\n color: var(--text-color);\n background-color: var(--input-color);\n width: 100%;\n height: calc(100vh - 180px);\n}\n\n.config-input {\n color: var(--text-color);\n background-color: var(--input-color);\n width: 100%;\n}\n\n/* button */\n.button-style {\n background-color: var(--button-color);\n color: var(--text-color);\n}\n\n.button-style:hover {\n background-color: var(--button-hover-color);\n}\n\n/* toggle switch */\n.toggle-switch {\n position: relative;\n display: inline-block;\n width: 60px;\n height: 34px;\n margin-top: 1em;\n}\n\n.toggle-switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.toggle-switch .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n height: 34px;\n background-color: var(--button-color);\n transition: background-color 0.4s;\n border-radius: 34px;\n}\n\n.toggle-switch .slider:before {\n position: absolute;\n content: '';\n height: 26px;\n width: 26px;\n left: 4px;\n bottom: 4px;\n background-color: var(--text-color);\n transition: transform 0.4s;\n border-radius: 50%;\n}\n\n.toggle-switch .slider-content {\n position: relative;\n display: flex;\n height: 26px;\n width: 26px;\n top: 4px;\n align-items: center;\n justify-content: center;\n left: 4px;\n bottom: 4px;\n transition: transform 0.4s;\n border-radius: 50%;\n}\n\n.toggle-switch input:checked + .slider:before,\n.toggle-switch input:checked + .slider .slider-content {\n transform: translateX(26px);\n}\n\n#sun-icon {\n color: #e5e7eb;\n}\n\n#moon-icon {\n color: #374151;\n}\n\n/* modal */\n.modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.modal-content {\n background-color: #fff;\n padding: 20px;\n border-radius: 8px;\n max-width: 500px;\n width: 80%;\n background-color: var(--background-color);\n color: var(--text-color);\n}\n\n.modal-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n\n.form-button {\n background-color: var(--button-color);\n color: var(--text-color);\n width: 100%;\n padding: 8px;\n}\n\n.form-button:hover {\n background-color: var(--button-hover-color);\n}\n\n.refresh-button {\n width: 36px;\n height: 36px;\n min-width: 36px;\n display: flex;\n justify-content: center;\n align-items: center;\n transition: transform 0.4s;\n border-radius: 50%;\n}\n\n.refresh-button:hover {\n /* transform: rotate(360deg); */\n background-color: var(--button-hover-color);\n}\n\n.content-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n}\n\n.dropdown-input {\n background-color: var(--input-color);\n color: var(--text-color);\n padding-left: 8px;\n width: 100%;\n min-width: 200px;\n height: 32px;\n}\n\n#playground-box {\n height: calc(100vh - 60px);\n}\n\n#chat-container {\n display: flex;\n flex-direction: column;\n height: calc(100vh - 60px);\n}\n\n#chatbox {\n flex: 1;\n overflow: auto;\n margin: 1em;\n scrollbar-width: thin; /* For Firefox */\n scrollbar-color: var(--scrollbar-color) transparent; /* For Firefox */\n background-color: var(--input-color);\n}\n\n#chatbox::-webkit-scrollbar {\n /* For Chrome, Safari, and Opera */\n width: 12px;\n}\n\n#chatbox::-webkit-scrollbar-track {\n /* For Chrome, Safari, and Opera */\n background: transparent;\n}\n\n#chatbox::-webkit-scrollbar-thumb {\n /* For Chrome, Safari, and Opera */\n background: var(--scrollbar-color);\n border-radius: 50px;\n}\n\n#chatbox:hover::-webkit-scrollbar-thumb {\n /* For Chrome, Safari, and Opera */\n background: var(--scrollbar-color);\n}\n\n#inputbox {\n height: 80px;\n margin: 1em;\n background-color: var(--input-color);\n display: flex;\n flex-direction: row;\n}\n\n#message-input {\n flex: 1;\n background-color: var(--button-color);\n color: var(--text-color);\n}\n\n.chat-button:hover {\n background-color: var(--button-hover-color);\n}\n\n.message {\n position: relative;\n background-color: var(--chatbox-color);\n box-shadow:\n 0 10px 15px -3px rgba(0, 0, 0, 0.1),\n 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n border-radius: 10px;\n color: var(--message-text-color);\n padding: 10px;\n margin: 10px;\n z-index: 1;\n}\n\n.message.user {\n margin-left: auto;\n margin-right: 40px;\n}\n\n.message.assistant {\n margin-left: 40px;\n margin-right: auto;\n}\n\n.home-button {\n padding: 20px;\n background-color: var(--button-color);\n color: var(--text-color);\n border-radius: 10px;\n width: 600px;\n text-align: center;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.home-button-small {\n padding: 20px;\n background-color: var(--button-color);\n color: var(--text-color);\n border-radius: 10px;\n width: 300px;\n text-align: center;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.home-button-small:hover {\n background-color: var(--button-hover-color);\n}\n\n.home-button:hover {\n background-color: var(--button-hover-color);\n}\n\n.home-button-title {\n font-size: 20px;\n font-weight: bold;\n margin-bottom: 10px;\n}\n\n.home-button-description {\n font-size: 16px;\n}\n\n/* Calculator */\n.chart {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-top: 10px;\n margin-bottom: 10px;\n border: 1px solid var(--text-color);\n border-radius: 4px;\n padding-left: 20px;\n padding-top: 12px;\n padding-bottom: 12px;\n}\n\n.chart-row {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.chart-row-title {\n width: 100px;\n}\n\n.chart-row-size {\n width: 100px;\n}\n\n.calculator-input-box {\n display: flex;\n flex-direction: row;\n width: 100%;\n margin-top: 10px;\n margin-bottom: 10px;\n border: 1px solid var(--text-color);\n border-radius: 4px;\n padding-block: 12px;\n}\n\n.calculator-box {\n width: 100%;\n margin-top: 10px;\n margin-bottom: 10px;\n border: 1px solid var(--text-color);\n border-radius: 4px;\n padding-block: 12px;\n}\n\n.calculator-input-title {\n width: 140px;\n margin-left: 20px;\n height: 100%;\n}\n\n.calculator-input-tab {\n padding-bottom: 4px;\n padding-left: 8px;\n padding-right: 8px;\n}\n\n.calculator-input-tab-active {\n padding-bottom: 4px;\n padding-left: 8px;\n padding-right: 8px;\n border-bottom: 2px solid var(--text-color);\n}\n\n.calculator-select {\n background-color: var(--input-color);\n color: var(--text-color);\n display: block;\n width: 100%;\n padding-block: 4px;\n}\n\n.calculator-input {\n background-color: var(--input-color);\n color: var(--text-color);\n display: block;\n width: 100%;\n padding-block: 4px;\n}\n\n#tooltip {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n padding: 5px;\n}\n\n#right-container {\n display: flex;\n flex-direction: column;\n height: calc(100vh - 60px);\n}\n\n.table-cell {\n border: 1px solid var(--text-color);\n}\n\n.chart-side-panel {\n width: 200px;\n}\n\n.side-panel-input {\n background-color: var(--input-color);\n color: var(--text-color);\n display: block;\n width: 100%;\n padding-block: 4px;\n}\n"],"names":[],"sourceRoot":""}
|
|
|
|
|
|
build/static/js/{main.1c60d32c.js β main.26cb67d8.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
build/static/js/{main.1c60d32c.js.LICENSE.txt β main.26cb67d8.js.LICENSE.txt}
RENAMED
|
File without changes
|
build/static/js/{main.1c60d32c.js.map β main.26cb67d8.js.map}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/pages/Calculator.tsx
CHANGED
|
@@ -1,747 +1,421 @@
|
|
| 1 |
-
import React, { useState, useEffect, useRef } from 'react'
|
| 2 |
-
import * as d3 from 'd3'
|
| 3 |
-
import { useTheme } from '../context/themeContext'
|
| 4 |
|
| 5 |
-
import MODELS from '../utils/models'
|
| 6 |
-
import DEVICES from '../utils/devices'
|
| 7 |
|
| 8 |
-
type Precision = 'fp32' | 'fp16' | 'int8' | 'int4'
|
| 9 |
|
| 10 |
interface ModelSizeBarChartProps {
|
| 11 |
-
modelSize: number // in GB
|
| 12 |
-
largestModelSize: number // largest model in full precision (fp32)
|
| 13 |
-
modelPrecision: Precision
|
| 14 |
-
deviceMemorySet: boolean
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
interface InferenceRuntimeLineChartProps {
|
| 18 |
-
availableMemory: AvailableMemory // in GB
|
| 19 |
-
memoryPerInput: number // in GB
|
| 20 |
}
|
| 21 |
|
| 22 |
interface LineChartData {
|
| 23 |
-
seqLength: number
|
| 24 |
-
batchSize: number
|
| 25 |
}
|
| 26 |
|
| 27 |
interface AvailableMemory {
|
| 28 |
-
int4: number
|
| 29 |
-
int8: number
|
| 30 |
-
fp16: number
|
| 31 |
-
fp32: number
|
| 32 |
}
|
| 33 |
|
| 34 |
-
//
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
<tr>
|
| 66 |
-
<td className='table-cell px-4 py-2'>baseline</td>
|
| 67 |
-
<td className='table-cell px-4 py-2'>16</td>
|
| 68 |
-
<td className='table-cell px-4 py-2'>16</td>
|
| 69 |
-
<td className='table-cell px-4 py-2'>βββ</td>
|
| 70 |
-
</tr>
|
| 71 |
-
</tbody>
|
| 72 |
-
</table>
|
| 73 |
-
)
|
| 74 |
}
|
| 75 |
|
| 76 |
-
// Bar chart for model footprint (standard
|
| 77 |
function ModelSizeBarChart({
|
| 78 |
modelSize,
|
| 79 |
largestModelSize,
|
| 80 |
modelPrecision,
|
| 81 |
deviceMemorySet,
|
|
|
|
| 82 |
}: ModelSizeBarChartProps) {
|
| 83 |
-
const { theme } = useTheme()
|
| 84 |
-
const chartRef = useRef<SVGSVGElement>(null)
|
| 85 |
|
| 86 |
-
const width = 600
|
| 87 |
-
const height = 50
|
| 88 |
|
| 89 |
useEffect(() => {
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
const svg = d3.select(chartRef.current).attr('width', width).attr('height', height)
|
| 93 |
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
-
svg
|
| 98 |
-
.append('rect')
|
| 99 |
-
.attr('x', 0)
|
| 100 |
-
.attr('y', 0)
|
| 101 |
-
.attr('width', width)
|
| 102 |
-
.attr('height', height)
|
| 103 |
-
.attr('fill', 'transparent')
|
| 104 |
-
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 105 |
-
.style('stroke-dasharray', '4, 4')
|
| 106 |
-
.style('stroke-width', '2px')
|
| 107 |
-
svg
|
| 108 |
-
.append('text')
|
| 109 |
-
.attr('x', width / 2)
|
| 110 |
-
.attr('y', height / 2)
|
| 111 |
-
.attr('text-anchor', 'middle')
|
| 112 |
-
.attr('alignment-baseline', 'middle')
|
| 113 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 114 |
-
.text('Out of Memory')
|
| 115 |
-
} else {
|
| 116 |
-
svg
|
| 117 |
-
.append('rect')
|
| 118 |
-
.attr('x', 0)
|
| 119 |
-
.attr('y', 0)
|
| 120 |
-
.attr('width', xScale(modelSize))
|
| 121 |
-
.attr('height', height)
|
| 122 |
-
.attr('fill', chooseColor(modelPrecision))
|
| 123 |
|
| 124 |
-
if (
|
| 125 |
svg
|
| 126 |
.append('rect')
|
| 127 |
-
.attr('x',
|
| 128 |
.attr('y', 0)
|
| 129 |
-
.attr('width',
|
| 130 |
.attr('height', height)
|
| 131 |
.attr('fill', 'transparent')
|
| 132 |
-
.style('stroke',
|
| 133 |
-
.style('stroke-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
}
|
| 136 |
-
}, [modelSize, largestModelSize, modelPrecision, deviceMemorySet, theme])
|
| 137 |
-
|
| 138 |
-
function chooseColor(precision: Precision) {
|
| 139 |
-
const colors = {
|
| 140 |
-
fp32: '#e45f5b',
|
| 141 |
-
fp16: '#ffc068',
|
| 142 |
-
int8: '#71cce9',
|
| 143 |
-
int4: '#383d95',
|
| 144 |
-
}
|
| 145 |
-
return colors[precision] || 'gray'
|
| 146 |
-
}
|
| 147 |
|
| 148 |
-
return <svg ref={chartRef}></svg
|
| 149 |
}
|
| 150 |
|
| 151 |
-
// Line chart for standard
|
| 152 |
function InferenceRuntimeLineChart({
|
| 153 |
availableMemory,
|
| 154 |
memoryPerInput,
|
| 155 |
}: InferenceRuntimeLineChartProps) {
|
| 156 |
-
const { theme } = useTheme()
|
| 157 |
-
const chartRef = useRef(null)
|
| 158 |
-
const maxSeqLength = 4096
|
| 159 |
-
const maxBatchSize = 128
|
| 160 |
|
| 161 |
useEffect(() => {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
|
|
|
|
|
|
| 193 |
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
.style('text-anchor', 'middle')
|
| 198 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 199 |
-
.text('Sequence Length')
|
| 200 |
-
|
| 201 |
-
svg
|
| 202 |
-
.append('text')
|
| 203 |
-
.attr('transform', `rotate(-90)`)
|
| 204 |
-
.attr('y', 0)
|
| 205 |
-
.attr('x', 0 - height / 2 - margin.top)
|
| 206 |
-
.attr('dy', '1em')
|
| 207 |
-
.style('text-anchor', 'middle')
|
| 208 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 209 |
-
.text('Batch Size')
|
| 210 |
-
|
| 211 |
-
const legend = svg
|
| 212 |
-
.append('g')
|
| 213 |
-
.attr('class', 'legend')
|
| 214 |
-
.attr('transform', `translate(${width - 20}, 20)`)
|
| 215 |
-
|
| 216 |
-
precisions.forEach((precision, index) => {
|
| 217 |
-
const legendItem = legend.append('g').attr('transform', `translate(0, ${index * 30})`)
|
| 218 |
-
|
| 219 |
-
legendItem
|
| 220 |
-
.append('rect')
|
| 221 |
-
.attr('x', 10)
|
| 222 |
-
.attr('y', 10)
|
| 223 |
-
.attr('width', 10)
|
| 224 |
-
.attr('height', 10)
|
| 225 |
-
.style('fill', precision.color)
|
| 226 |
-
|
| 227 |
-
legendItem
|
| 228 |
-
.append('text')
|
| 229 |
-
.attr('x', 30)
|
| 230 |
-
.attr('y', 16)
|
| 231 |
-
.text(precision.name)
|
| 232 |
-
.style('font-size', '16px')
|
| 233 |
-
.style('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 234 |
-
.attr('alignment-baseline', 'middle')
|
| 235 |
-
})
|
| 236 |
-
legend
|
| 237 |
-
.append('rect')
|
| 238 |
-
.attr('class', 'legend-box')
|
| 239 |
-
.attr('width', 80)
|
| 240 |
-
.attr('height', precisions.length * 30)
|
| 241 |
-
.style('fill', 'none')
|
| 242 |
-
.style('stroke-width', '1px')
|
| 243 |
-
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 244 |
-
|
| 245 |
-
const tooltip = d3.select('#tooltip')
|
| 246 |
-
|
| 247 |
-
for (const [precision, memory] of Object.entries(availableMemory)) {
|
| 248 |
-
const sequenceLengths = d3
|
| 249 |
-
.range(1, maxSeqLength, 1)
|
| 250 |
-
.map((seqLength) => {
|
| 251 |
-
return { seqLength, batchSize: memory / (seqLength * memoryPerInput) }
|
| 252 |
-
})
|
| 253 |
-
.filter((seqLength) => seqLength.batchSize <= maxBatchSize)
|
| 254 |
-
.filter((seqLength) => seqLength.batchSize > 1 && seqLength.seqLength > 1)
|
| 255 |
-
|
| 256 |
-
const lineGroup = svg
|
| 257 |
.append('g')
|
| 258 |
.attr('transform', `translate(${margin.left}, ${margin.top})`)
|
| 259 |
-
|
| 260 |
-
.line<LineChartData>()
|
| 261 |
-
.x((d) => xScale(d.seqLength))
|
| 262 |
-
.y((d) => yScale(d.batchSize))
|
| 263 |
-
.curve(d3.curveBasis)
|
| 264 |
|
| 265 |
-
|
| 266 |
-
.append('
|
| 267 |
-
.
|
| 268 |
-
.attr('
|
| 269 |
-
.
|
| 270 |
-
.attr('stroke-width', 4)
|
| 271 |
-
.attr('d', line)
|
| 272 |
-
.on('mouseover', () => {
|
| 273 |
-
tooltip.style('opacity', 1)
|
| 274 |
-
tooltip.style('background-color', theme === 'dark' ? '#181f26' : '#f9fafb')
|
| 275 |
-
})
|
| 276 |
-
.on('mousemove', (event) => {
|
| 277 |
-
tooltip.selectAll('text').remove()
|
| 278 |
-
const [x, y] = d3.pointer(event)
|
| 279 |
-
const xValue = xScale.invert(x)
|
| 280 |
-
const yValue = yScale.invert(y)
|
| 281 |
-
tooltip
|
| 282 |
-
.html(`Sequence Length: ${xValue.toFixed(0)}<br/>Batch Size: ${yValue.toFixed(0)}`)
|
| 283 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 284 |
-
.style('left', event.pageX + 10 + 'px')
|
| 285 |
-
.style('top', event.pageY + 10 + 'px')
|
| 286 |
-
})
|
| 287 |
-
.on('mouseout', () => {
|
| 288 |
-
tooltip.style('opacity', 0)
|
| 289 |
-
})
|
| 290 |
-
}
|
| 291 |
-
}, [availableMemory, memoryPerInput, theme])
|
| 292 |
-
|
| 293 |
-
function chooseColor(precision: Precision) {
|
| 294 |
-
const colors = {
|
| 295 |
-
fp32: '#e45f5b',
|
| 296 |
-
fp16: '#ffc068',
|
| 297 |
-
int8: '#71cce9',
|
| 298 |
-
int4: '#383d95',
|
| 299 |
-
}
|
| 300 |
-
return colors[precision] || 'gray'
|
| 301 |
-
}
|
| 302 |
-
|
| 303 |
-
return (
|
| 304 |
-
<>
|
| 305 |
-
<div id='tooltip'></div>
|
| 306 |
-
<svg ref={chartRef} width={600} height={400} />
|
| 307 |
-
</>
|
| 308 |
-
)
|
| 309 |
-
}
|
| 310 |
-
|
| 311 |
-
// Prefill Chunking Model Size Bar Chart
|
| 312 |
-
function PrefillChunkingModelSizeBarChart({
|
| 313 |
-
modelSize,
|
| 314 |
-
largestModelSize,
|
| 315 |
-
modelPrecision,
|
| 316 |
-
deviceMemorySet,
|
| 317 |
-
activationMemorySize,
|
| 318 |
-
}: {
|
| 319 |
-
modelSize: number // in GB
|
| 320 |
-
largestModelSize: number // largest model in full precision (fp32)
|
| 321 |
-
modelPrecision: Precision // enum of fp32, fp16, int8, int4
|
| 322 |
-
deviceMemorySet: boolean // true if device memory is set
|
| 323 |
-
activationMemorySize: number // additional memory for activations in GB
|
| 324 |
-
}) {
|
| 325 |
-
const { theme } = useTheme()
|
| 326 |
-
const chartRef = useRef<SVGSVGElement>(null)
|
| 327 |
-
|
| 328 |
-
const width = 600
|
| 329 |
-
const height = 50
|
| 330 |
-
|
| 331 |
-
useEffect(() => {
|
| 332 |
-
d3.select(chartRef.current).selectAll('*').remove()
|
| 333 |
-
|
| 334 |
-
const svg = d3.select(chartRef.current).attr('width', width).attr('height', height)
|
| 335 |
-
|
| 336 |
-
const xScale = d3.scaleLinear().domain([0, largestModelSize]).range([0, width])
|
| 337 |
|
| 338 |
-
if (modelSize + activationMemorySize > largestModelSize) {
|
| 339 |
svg
|
| 340 |
-
.append('
|
| 341 |
-
.attr('
|
| 342 |
-
.attr('
|
| 343 |
-
.
|
| 344 |
-
|
| 345 |
-
.attr('fill', 'transparent')
|
| 346 |
-
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 347 |
-
.style('stroke-dasharray', '4, 4')
|
| 348 |
-
.style('stroke-width', '2px')
|
| 349 |
svg
|
| 350 |
.append('text')
|
| 351 |
-
.attr('
|
| 352 |
-
.
|
| 353 |
-
.attr('text-anchor', 'middle')
|
| 354 |
-
.attr('alignment-baseline', 'middle')
|
| 355 |
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 356 |
-
.text('
|
| 357 |
-
} else {
|
| 358 |
-
svg
|
| 359 |
-
.append('rect')
|
| 360 |
-
.attr('x', 0)
|
| 361 |
-
.attr('y', 0)
|
| 362 |
-
.attr('width', xScale(modelSize))
|
| 363 |
-
.attr('height', height)
|
| 364 |
-
.attr('fill', chooseColor(modelPrecision))
|
| 365 |
|
| 366 |
svg
|
| 367 |
-
.append('
|
| 368 |
-
.attr('
|
| 369 |
.attr('y', 0)
|
| 370 |
-
.attr('
|
| 371 |
-
.attr('
|
| 372 |
-
.
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
svg
|
| 376 |
-
.append('rect')
|
| 377 |
-
.attr('x', xScale(modelSize + activationMemorySize))
|
| 378 |
-
.attr('y', 0)
|
| 379 |
-
.attr('width', xScale(largestModelSize - (modelSize + activationMemorySize)))
|
| 380 |
-
.attr('height', height)
|
| 381 |
-
.attr('fill', 'transparent')
|
| 382 |
-
.style('stroke', chooseColor(modelPrecision))
|
| 383 |
-
.style('stroke-width', '2px')
|
| 384 |
-
}
|
| 385 |
-
}
|
| 386 |
-
}, [modelSize, largestModelSize, modelPrecision, deviceMemorySet, activationMemorySize, theme])
|
| 387 |
-
|
| 388 |
-
function chooseColor(precision: Precision) {
|
| 389 |
-
const colors = {
|
| 390 |
-
fp32: '#e45f5b',
|
| 391 |
-
fp16: '#ffc068',
|
| 392 |
-
int8: '#71cce9',
|
| 393 |
-
int4: '#383d95',
|
| 394 |
-
}
|
| 395 |
-
return colors[precision] || 'gray'
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
return <svg ref={chartRef}></svg>
|
| 399 |
-
}
|
| 400 |
-
|
| 401 |
-
// Prefill Chunking Inference Runtime Line Chart
|
| 402 |
-
function PrefillChunkingInferenceRuntimeLineChart({
|
| 403 |
-
availableMemory,
|
| 404 |
-
memoryPerInput,
|
| 405 |
-
activationMemorySize,
|
| 406 |
-
}: {
|
| 407 |
-
availableMemory: AvailableMemory // in GB
|
| 408 |
-
memoryPerInput: number // in GB
|
| 409 |
-
activationMemorySize: number // in GB
|
| 410 |
-
}) {
|
| 411 |
-
const { theme } = useTheme()
|
| 412 |
-
const chartRef = useRef(null)
|
| 413 |
-
const maxSeqLength = 4096
|
| 414 |
-
const maxBatchSize = 128
|
| 415 |
-
|
| 416 |
-
useEffect(() => {
|
| 417 |
-
const margin = { top: 20, right: 20, bottom: 50, left: 50 }
|
| 418 |
-
const width = 600 - margin.left - margin.right
|
| 419 |
-
const height = 400 - margin.top - margin.bottom
|
| 420 |
-
const precisions = [
|
| 421 |
-
{ name: 'FP32', color: '#e45f5b' },
|
| 422 |
-
{ name: 'FP16', color: '#ffc068' },
|
| 423 |
-
{ name: 'INT8', color: '#71cce9' },
|
| 424 |
-
{ name: 'INT4', color: '#383d95' },
|
| 425 |
-
]
|
| 426 |
-
|
| 427 |
-
const svg = d3.select(chartRef.current)
|
| 428 |
-
svg.selectAll('*').remove()
|
| 429 |
-
|
| 430 |
-
const xScale = d3.scaleLinear().domain([0, maxSeqLength]).range([0, width])
|
| 431 |
-
|
| 432 |
-
const yScale = d3.scaleLinear().domain([0, maxBatchSize]).range([height, 0])
|
| 433 |
-
|
| 434 |
-
const xAxis = d3.axisBottom(xScale)
|
| 435 |
-
const yAxis = d3.axisLeft(yScale)
|
| 436 |
-
svg
|
| 437 |
-
.attr('width', width + margin.left + margin.right)
|
| 438 |
-
.attr('height', height + margin.top + margin.bottom)
|
| 439 |
-
.append('g')
|
| 440 |
-
.attr('transform', `translate(${margin.left}, ${margin.top})`)
|
| 441 |
-
|
| 442 |
-
svg
|
| 443 |
-
.append('g')
|
| 444 |
-
.attr('transform', `translate(${margin.left}, ${height + margin.top})`)
|
| 445 |
-
.call(xAxis)
|
| 446 |
-
|
| 447 |
-
svg.append('g').attr('transform', `translate(${margin.left}, ${margin.top})`).call(yAxis)
|
| 448 |
-
|
| 449 |
-
svg
|
| 450 |
-
.append('text')
|
| 451 |
-
.attr('transform', `translate(${width / 2 + margin.left}, ${height + margin.top + 40})`)
|
| 452 |
-
.style('text-anchor', 'middle')
|
| 453 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 454 |
-
.text('Sequence Length')
|
| 455 |
-
|
| 456 |
-
svg
|
| 457 |
-
.append('text')
|
| 458 |
-
.attr('transform', `rotate(-90)`)
|
| 459 |
-
.attr('y', 0)
|
| 460 |
-
.attr('x', 0 - height / 2 - margin.top)
|
| 461 |
-
.attr('dy', '1em')
|
| 462 |
-
.style('text-anchor', 'middle')
|
| 463 |
-
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 464 |
-
.text('Batch Size')
|
| 465 |
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
|
|
|
| 470 |
|
| 471 |
-
|
| 472 |
-
|
| 473 |
|
| 474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
.append('rect')
|
| 476 |
-
.attr('
|
| 477 |
-
.attr('
|
| 478 |
-
.attr('
|
| 479 |
-
.
|
| 480 |
-
.style('
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
.attr('alignment-baseline', 'middle')
|
| 490 |
-
})
|
| 491 |
-
legend
|
| 492 |
-
.append('rect')
|
| 493 |
-
.attr('class', 'legend-box')
|
| 494 |
-
.attr('width', 80)
|
| 495 |
-
.attr('height', precisions.length * 30)
|
| 496 |
-
.style('fill', 'none')
|
| 497 |
-
.style('stroke-width', '1px')
|
| 498 |
-
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 499 |
-
|
| 500 |
-
const tooltip = d3.select('#tooltip')
|
| 501 |
-
|
| 502 |
-
for (const [precision, memory] of Object.entries(availableMemory)) {
|
| 503 |
-
const sequenceLengths = d3
|
| 504 |
-
.range(1, maxSeqLength, 1)
|
| 505 |
-
.map((seqLength) => {
|
| 506 |
-
return {
|
| 507 |
seqLength,
|
| 508 |
-
batchSize:
|
| 509 |
-
}
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
}
|
| 549 |
-
}, [availableMemory, memoryPerInput, activationMemorySize, theme])
|
| 550 |
-
|
| 551 |
-
function chooseColor(precision: Precision) {
|
| 552 |
-
const colors = {
|
| 553 |
-
fp32: '#e45f5b',
|
| 554 |
-
fp16: '#ffc068',
|
| 555 |
-
int8: '#71cce9',
|
| 556 |
-
int4: '#383d95',
|
| 557 |
}
|
| 558 |
-
|
| 559 |
-
}
|
| 560 |
|
| 561 |
return (
|
| 562 |
<>
|
| 563 |
<div id='tooltip'></div>
|
| 564 |
<svg ref={chartRef} width={600} height={400} />
|
| 565 |
</>
|
| 566 |
-
)
|
| 567 |
}
|
| 568 |
|
| 569 |
-
// Prefill Chunking Calculator
|
| 570 |
-
|
| 571 |
deviceMemory,
|
| 572 |
modelParams,
|
| 573 |
hiddenSize,
|
| 574 |
numLayers,
|
| 575 |
-
maxChunkSize,
|
| 576 |
intermediateSize,
|
| 577 |
}: {
|
| 578 |
-
deviceMemory: number
|
| 579 |
-
modelParams: number
|
| 580 |
-
hiddenSize: number
|
| 581 |
-
numLayers: number
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
}) => {
|
| 587 |
-
// Function to calculate memory usage based on precision and model parameters
|
| 588 |
-
function calculateMemory(params: number, precision: 'fp32' | 'fp16' | 'int8' | 'int4'): number {
|
| 589 |
-
const paramSize = { fp32: 4, fp16: 2, int8: 1, int4: 0.5 }
|
| 590 |
-
return params * paramSize[precision] // in GB
|
| 591 |
-
}
|
| 592 |
-
|
| 593 |
-
function calculateMemoryPerInput(hiddenSize: number, numLayers: number) {
|
| 594 |
-
const memoryPerInput = 4 * hiddenSize * numLayers
|
| 595 |
-
return memoryPerInput / 1_000_000_000 // in GB
|
| 596 |
-
}
|
| 597 |
-
|
| 598 |
-
function calculateMemoryNeededForActivations(
|
| 599 |
-
maxChunkSize: number,
|
| 600 |
-
intermediateSize: number,
|
| 601 |
-
hiddenSize: number,
|
| 602 |
-
) {
|
| 603 |
-
const activationMemorySize = maxChunkSize * 2 * Math.max(2 * intermediateSize, 4 * hiddenSize)
|
| 604 |
-
return activationMemorySize / 1_000_000_000 // in GB
|
| 605 |
}
|
| 606 |
|
| 607 |
-
const memoryPerInput = calculateMemoryPerInput(hiddenSize, numLayers)
|
| 608 |
-
const activationMemorySize = calculateMemoryNeededForActivations(
|
| 609 |
-
maxChunkSize!,
|
| 610 |
-
intermediateSize!,
|
| 611 |
-
hiddenSize,
|
| 612 |
-
)
|
| 613 |
-
|
| 614 |
return (
|
| 615 |
-
|
| 616 |
<>
|
| 617 |
{/* Model Footprint with Prefill Chunking */}
|
| 618 |
-
<div>
|
| 619 |
-
<div className='
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
activationMemorySize={activationMemorySize}
|
| 645 |
-
/>
|
| 646 |
-
<div className='chart-row-size ml-8'>
|
| 647 |
-
{(calculateMemory(modelParams, 'fp16') + activationMemorySize).toFixed(2)}{' '}
|
| 648 |
-
{deviceMemory !== null && deviceMemory > 0 ? `/ ${deviceMemory} ` : null}GB
|
| 649 |
-
</div>
|
| 650 |
-
</div>
|
| 651 |
-
|
| 652 |
-
<div className='chart-row my-8'>
|
| 653 |
-
<div className='chart-row-title'>INT8</div>
|
| 654 |
-
<PrefillChunkingModelSizeBarChart
|
| 655 |
-
modelSize={calculateMemory(modelParams, 'int8')}
|
| 656 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'int8')}
|
| 657 |
-
modelPrecision='int8'
|
| 658 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 659 |
-
activationMemorySize={activationMemorySize}
|
| 660 |
-
/>
|
| 661 |
-
<div className='chart-row-size ml-8'>
|
| 662 |
-
{(calculateMemory(modelParams, 'int8') + activationMemorySize).toFixed(2)}{' '}
|
| 663 |
-
{deviceMemory !== null && deviceMemory > 0 ? `/ ${deviceMemory} ` : null}GB
|
| 664 |
-
</div>
|
| 665 |
-
</div>
|
| 666 |
-
|
| 667 |
-
<div className='chart-row my-8'>
|
| 668 |
-
<div className='chart-row-title'>INT4</div>
|
| 669 |
-
<PrefillChunkingModelSizeBarChart
|
| 670 |
-
modelSize={calculateMemory(modelParams, 'int4')}
|
| 671 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'int4')}
|
| 672 |
-
modelPrecision='int4'
|
| 673 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 674 |
-
activationMemorySize={activationMemorySize}
|
| 675 |
-
/>
|
| 676 |
-
<div className='chart-row-size ml-8'>
|
| 677 |
-
{(calculateMemory(modelParams, 'int4') + activationMemorySize).toFixed(2)}{' '}
|
| 678 |
-
{deviceMemory !== null && deviceMemory > 0 ? `/ ${deviceMemory} ` : null}GB
|
| 679 |
</div>
|
| 680 |
-
|
| 681 |
-
|
| 682 |
</div>
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
<PrefillChunkingInferenceRuntimeLineChart
|
| 690 |
-
availableMemory={{
|
| 691 |
-
int4: deviceMemory - calculateMemory(modelParams, 'int4'),
|
| 692 |
-
int8: deviceMemory - calculateMemory(modelParams, 'int8'),
|
| 693 |
-
fp16: deviceMemory - calculateMemory(modelParams, 'fp16'),
|
| 694 |
-
fp32: deviceMemory - calculateMemory(modelParams, 'fp32'),
|
| 695 |
-
}}
|
| 696 |
-
memoryPerInput={memoryPerInput}
|
| 697 |
-
activationMemorySize={activationMemorySize}
|
| 698 |
-
/>
|
| 699 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
</div>
|
| 701 |
</>
|
| 702 |
-
)
|
| 703 |
}
|
| 704 |
|
| 705 |
-
//
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
|
| 720 |
-
const [maxChunkSize, setMaxChunkSize] = useState<number | null>(null)
|
| 721 |
-
const [intermediateSize, setIntermediateSize] = useState<number | null>(null)
|
| 722 |
-
|
| 723 |
-
// Toggle between standard calculator and prefill chunking calculator
|
| 724 |
-
const [isPrefillChunking, setIsPrefillChunking] = useState<boolean>(false)
|
| 725 |
-
|
| 726 |
-
// Toggle between model selection and custom model input
|
| 727 |
-
const [modelSelectionTab, setModelSelectionTab] = useState<boolean>(true)
|
| 728 |
-
|
| 729 |
-
// Toggle between device selection and custom device input
|
| 730 |
-
const [deviceSelectionTab, setDeviceSelectionTab] = useState<boolean>(true)
|
| 731 |
|
| 732 |
-
// Calculate model memory
|
| 733 |
function calculateMemory(params: number, precision: Precision) {
|
| 734 |
-
const paramSize = { fp32: 4, fp16: 2, int8: 1, int4: 0.5 }
|
| 735 |
-
return params * paramSize[precision] // in GB
|
| 736 |
}
|
| 737 |
|
| 738 |
-
// Calculate memory per input (sequence length and batch size)
|
| 739 |
function calculateMemoryPerInput(hiddenSize: number, numLayers: number) {
|
| 740 |
-
const memoryPerInput = 4 * hiddenSize * numLayers
|
| 741 |
-
return memoryPerInput / 1_000_000_000 // in GB
|
| 742 |
}
|
| 743 |
|
| 744 |
-
// Calculate maximum batch size / sequence length
|
| 745 |
function calculateMaxInputSize(
|
| 746 |
deviceMemory: number,
|
| 747 |
modelParams: number,
|
|
@@ -750,12 +424,11 @@ const Calculator = () => {
|
|
| 750 |
precision: Precision,
|
| 751 |
inputSize: number,
|
| 752 |
) {
|
| 753 |
-
const memoryPerInput = calculateMemoryPerInput(hiddenSize, numLayers)
|
| 754 |
-
const availableMemory = deviceMemory - calculateMemory(modelParams, precision)
|
| 755 |
-
return Math.floor(availableMemory / (memoryPerInput * inputSize))
|
| 756 |
}
|
| 757 |
|
| 758 |
-
// Check if memory is valid for batch size / sequence length combination
|
| 759 |
function calculateMemoryValid(
|
| 760 |
deviceMemory: number,
|
| 761 |
modelParams: number,
|
|
@@ -765,43 +438,90 @@ const Calculator = () => {
|
|
| 765 |
batchSize: number,
|
| 766 |
seqLength: number,
|
| 767 |
) {
|
| 768 |
-
const memoryPerInput = calculateMemoryPerInput(hiddenSize, numLayers)
|
| 769 |
-
const availableMemory = deviceMemory - calculateMemory(modelParams, precision)
|
| 770 |
-
return availableMemory >= memoryPerInput * batchSize * seqLength
|
| 771 |
}
|
| 772 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 773 |
return (
|
| 774 |
<div className='flex flex-col items-center justify-center min-h-screen px-4'>
|
| 775 |
-
{/* Toggle
|
| 776 |
<div className='mb-4 flex space-x-4'>
|
| 777 |
<button
|
| 778 |
-
className={`${
|
| 779 |
-
!isPrefillChunking ? 'calculator-input-tab-active' : 'calculator-input-tab'
|
| 780 |
-
}`}
|
| 781 |
onClick={() => setIsPrefillChunking(false)}
|
| 782 |
>
|
| 783 |
Standard Calculator
|
| 784 |
</button>
|
| 785 |
<button
|
| 786 |
-
className={`${
|
| 787 |
-
isPrefillChunking ? 'calculator-input-tab-active' : 'calculator-input-tab'
|
| 788 |
-
}`}
|
| 789 |
onClick={() => setIsPrefillChunking(true)}
|
| 790 |
>
|
| 791 |
Calculator with Prefill Chunking
|
| 792 |
</button>
|
| 793 |
</div>
|
| 794 |
|
| 795 |
-
{/* Model
|
| 796 |
<div className='w-full max-w-4xl'>
|
| 797 |
<div className='text-4xl mb-4 text-center'>Model Memory Calculator</div>
|
| 798 |
<div className='mb-6 text-center'>
|
| 799 |
Use our Model Memory Calculator to help you estimate the memory footprint of your model
|
| 800 |
-
|
| 801 |
-
run on your device.
|
| 802 |
</div>
|
| 803 |
|
| 804 |
-
{/* Model and Device Selection */}
|
| 805 |
<div className='grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6'>
|
| 806 |
{/* Model Selection */}
|
| 807 |
<div className='calculator-input-box'>
|
|
@@ -809,17 +529,13 @@ const Calculator = () => {
|
|
| 809 |
<div className='calculator-input-content'>
|
| 810 |
<div className='mb-2'>
|
| 811 |
<button
|
| 812 |
-
className={`${
|
| 813 |
-
modelSelectionTab ? 'calculator-input-tab-active' : 'calculator-input-tab'
|
| 814 |
-
}`}
|
| 815 |
onClick={() => setModelSelectionTab(true)}
|
| 816 |
>
|
| 817 |
Model Selection
|
| 818 |
</button>
|
| 819 |
<button
|
| 820 |
-
className={`${
|
| 821 |
-
modelSelectionTab ? 'calculator-input-tab' : 'calculator-input-tab-active'
|
| 822 |
-
}`}
|
| 823 |
onClick={() => setModelSelectionTab(false)}
|
| 824 |
>
|
| 825 |
Custom Model
|
|
@@ -833,19 +549,15 @@ const Calculator = () => {
|
|
| 833 |
id='model'
|
| 834 |
className='calculator-select'
|
| 835 |
onChange={(e) => {
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
)
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
Number(
|
| 846 |
-
e.target.options[e.target.selectedIndex].getAttribute('data-numLayers'),
|
| 847 |
-
),
|
| 848 |
-
)
|
| 849 |
}}
|
| 850 |
>
|
| 851 |
<option value=''>None selected</option>
|
|
@@ -853,8 +565,6 @@ const Calculator = () => {
|
|
| 853 |
<option
|
| 854 |
key={model.name}
|
| 855 |
value={model.params}
|
| 856 |
-
data-hiddenSize={model.hidden_size}
|
| 857 |
-
data-numLayers={model.num_hidden_layers}
|
| 858 |
>
|
| 859 |
{model.name}
|
| 860 |
</option>
|
|
@@ -893,6 +603,20 @@ const Calculator = () => {
|
|
| 893 |
min={1}
|
| 894 |
onChange={(e) => setNumLayers(Number(e.target.value))}
|
| 895 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 896 |
</>
|
| 897 |
)}
|
| 898 |
</div>
|
|
@@ -905,23 +629,19 @@ const Calculator = () => {
|
|
| 905 |
<div className='calculator-input-content'>
|
| 906 |
<div className='mb-2'>
|
| 907 |
<button
|
| 908 |
-
className={`${
|
| 909 |
-
deviceSelectionTab ? 'calculator-input-tab-active' : 'calculator-input-tab'
|
| 910 |
-
}`}
|
| 911 |
onClick={() => {
|
| 912 |
-
setDeviceSelectionTab(true)
|
| 913 |
-
setDeviceMemory(null)
|
| 914 |
}}
|
| 915 |
>
|
| 916 |
Device Selection
|
| 917 |
</button>
|
| 918 |
<button
|
| 919 |
-
className={`${
|
| 920 |
-
deviceSelectionTab ? 'calculator-input-tab' : 'calculator-input-tab-active'
|
| 921 |
-
}`}
|
| 922 |
onClick={() => {
|
| 923 |
-
setDeviceSelectionTab(false)
|
| 924 |
-
setDeviceMemory(null)
|
| 925 |
}}
|
| 926 |
>
|
| 927 |
Custom Device
|
|
@@ -963,448 +683,26 @@ const Calculator = () => {
|
|
| 963 |
</div>
|
| 964 |
</div>
|
| 965 |
|
| 966 |
-
{/*
|
| 967 |
-
{isPrefillChunking && (
|
| 968 |
-
<div className='calculator-input-box mb-6'>
|
| 969 |
-
<div className='text-2xl calculator-input-title'>Prefill Chunking Settings</div>
|
| 970 |
-
<div className='calculator-input-content'>
|
| 971 |
-
<label htmlFor='maxChunkSize'>Max Chunk Size</label>
|
| 972 |
-
<input
|
| 973 |
-
type='number'
|
| 974 |
-
id='maxChunkSize'
|
| 975 |
-
className='calculator-input mb-2'
|
| 976 |
-
placeholder='e.g. 512'
|
| 977 |
-
value={maxChunkSize || ''}
|
| 978 |
-
min={1}
|
| 979 |
-
onChange={(e) => setMaxChunkSize(Number(e.target.value))}
|
| 980 |
-
/>
|
| 981 |
-
<label htmlFor='intermediateSize'>Intermediate Size</label>
|
| 982 |
-
<input
|
| 983 |
-
type='number'
|
| 984 |
-
id='intermediateSize'
|
| 985 |
-
className='calculator-input'
|
| 986 |
-
placeholder='e.g. 2048'
|
| 987 |
-
value={intermediateSize || ''}
|
| 988 |
-
min={1}
|
| 989 |
-
onChange={(e) => setIntermediateSize(Number(e.target.value))}
|
| 990 |
-
/>
|
| 991 |
-
</div>
|
| 992 |
-
</div>
|
| 993 |
-
)}
|
| 994 |
-
|
| 995 |
-
{/* Charts Section */}
|
| 996 |
{isPrefillChunking ? (
|
| 997 |
<PrefillChunkingCalculator
|
| 998 |
deviceMemory={deviceMemory!}
|
| 999 |
modelParams={modelParams!}
|
| 1000 |
hiddenSize={hiddenSize!}
|
| 1001 |
numLayers={numLayers!}
|
| 1002 |
-
|
| 1003 |
-
seqLength={seqLength}
|
| 1004 |
-
maxChunkSize={maxChunkSize}
|
| 1005 |
-
intermediateSize={intermediateSize}
|
| 1006 |
/>
|
| 1007 |
) : (
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
<div className='chart mb-8'>
|
| 1015 |
-
<div className='text-2xl text-center mb-4'>Model Footprint</div>
|
| 1016 |
-
<div className='space-y-8'>
|
| 1017 |
-
<div className='chart-row'>
|
| 1018 |
-
<div className='chart-row-title'>FP32</div>
|
| 1019 |
-
<ModelSizeBarChart
|
| 1020 |
-
modelSize={calculateMemory(modelParams, 'fp32')}
|
| 1021 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'fp32')}
|
| 1022 |
-
modelPrecision='fp32'
|
| 1023 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 1024 |
-
/>
|
| 1025 |
-
<div className='chart-row-size ml-8'>
|
| 1026 |
-
{calculateMemory(modelParams, 'fp32')}{' '}
|
| 1027 |
-
{deviceMemory ? `/ ${deviceMemory} ` : null}GB
|
| 1028 |
-
</div>
|
| 1029 |
-
</div>
|
| 1030 |
-
|
| 1031 |
-
{/* FP16 */}
|
| 1032 |
-
<div className='chart-row'>
|
| 1033 |
-
<div className='chart-row-title'>FP16</div>
|
| 1034 |
-
<ModelSizeBarChart
|
| 1035 |
-
modelSize={calculateMemory(modelParams, 'fp16')}
|
| 1036 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'fp16')}
|
| 1037 |
-
modelPrecision='fp16'
|
| 1038 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 1039 |
-
/>
|
| 1040 |
-
<div className='chart-row-size ml-8'>
|
| 1041 |
-
{calculateMemory(modelParams, 'fp16')}{' '}
|
| 1042 |
-
{deviceMemory ? `/ ${deviceMemory} ` : null}GB
|
| 1043 |
-
</div>
|
| 1044 |
-
</div>
|
| 1045 |
-
|
| 1046 |
-
{/* INT8 */}
|
| 1047 |
-
<div className='chart-row'>
|
| 1048 |
-
<div className='chart-row-title'>INT8</div>
|
| 1049 |
-
<ModelSizeBarChart
|
| 1050 |
-
modelSize={calculateMemory(modelParams, 'int8')}
|
| 1051 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'int8')}
|
| 1052 |
-
modelPrecision='int8'
|
| 1053 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 1054 |
-
/>
|
| 1055 |
-
<div className='chart-row-size ml-8'>
|
| 1056 |
-
{calculateMemory(modelParams, 'int8')}{' '}
|
| 1057 |
-
{deviceMemory ? `/ ${deviceMemory} ` : null}GB
|
| 1058 |
-
</div>
|
| 1059 |
-
</div>
|
| 1060 |
-
|
| 1061 |
-
{/* INT4 */}
|
| 1062 |
-
<div className='chart-row'>
|
| 1063 |
-
<div className='chart-row-title'>INT4</div>
|
| 1064 |
-
<ModelSizeBarChart
|
| 1065 |
-
modelSize={calculateMemory(modelParams, 'int4')}
|
| 1066 |
-
largestModelSize={deviceMemory || calculateMemory(modelParams, 'int4')}
|
| 1067 |
-
modelPrecision='int4'
|
| 1068 |
-
deviceMemorySet={deviceMemory !== null && deviceMemory > 0}
|
| 1069 |
-
/>
|
| 1070 |
-
<div className='chart-row-size ml-8'>
|
| 1071 |
-
{calculateMemory(modelParams, 'int4')}{' '}
|
| 1072 |
-
{deviceMemory ? `/ ${deviceMemory} ` : null}GB
|
| 1073 |
-
</div>
|
| 1074 |
-
</div>
|
| 1075 |
-
</div>
|
| 1076 |
-
</div>
|
| 1077 |
-
|
| 1078 |
-
{/* Maximum Batch Size / Sequence Length Chart */}
|
| 1079 |
-
<div className='chart mb-8'>
|
| 1080 |
-
<div className='text-2xl text-center mb-4'>
|
| 1081 |
-
Maximum Batch Size / Sequence Length
|
| 1082 |
-
</div>
|
| 1083 |
-
<div className='flex flex-row items-left'>
|
| 1084 |
-
<InferenceRuntimeLineChart
|
| 1085 |
-
availableMemory={{
|
| 1086 |
-
int4: deviceMemory - calculateMemory(modelParams, 'int4'),
|
| 1087 |
-
int8: deviceMemory - calculateMemory(modelParams, 'int8'),
|
| 1088 |
-
fp16: deviceMemory - calculateMemory(modelParams, 'fp16'),
|
| 1089 |
-
fp32: deviceMemory - calculateMemory(modelParams, 'fp32'),
|
| 1090 |
-
}}
|
| 1091 |
-
memoryPerInput={calculateMemoryPerInput(hiddenSize, numLayers)}
|
| 1092 |
-
/>
|
| 1093 |
-
<div className='chart-side-panel ml-4 pt-4'>
|
| 1094 |
-
<div className='mb-2'>
|
| 1095 |
-
Memory/token:{' '}
|
| 1096 |
-
{(calculateMemoryPerInput(hiddenSize, numLayers) * 1_000_000).toFixed(0)} KB
|
| 1097 |
-
</div>
|
| 1098 |
-
<label htmlFor='batchSize'>Batch Size</label>
|
| 1099 |
-
<input
|
| 1100 |
-
type='number'
|
| 1101 |
-
id='batchSize'
|
| 1102 |
-
className='side-panel-input mb-2'
|
| 1103 |
-
value={batchSize || ''}
|
| 1104 |
-
min={1}
|
| 1105 |
-
onChange={(e) => setBatchSize(Number(e.target.value))}
|
| 1106 |
-
/>
|
| 1107 |
-
<label htmlFor='seqLength'>Sequence Length</label>
|
| 1108 |
-
<input
|
| 1109 |
-
type='number'
|
| 1110 |
-
id='seqLength'
|
| 1111 |
-
className='side-panel-input'
|
| 1112 |
-
value={seqLength || ''}
|
| 1113 |
-
min={1}
|
| 1114 |
-
onChange={(e) => setSeqLength(Number(e.target.value))}
|
| 1115 |
-
/>
|
| 1116 |
-
<div className='mt-4'>
|
| 1117 |
-
{!batchSize && !seqLength ? (
|
| 1118 |
-
<div>
|
| 1119 |
-
Input a batch size or sequence length to see the maximum batch size or
|
| 1120 |
-
sequence length you can run on your device.
|
| 1121 |
-
</div>
|
| 1122 |
-
) : null}
|
| 1123 |
-
{batchSize && !seqLength ? (
|
| 1124 |
-
<>
|
| 1125 |
-
<div>Max Sequence Lengths:</div>
|
| 1126 |
-
<div>
|
| 1127 |
-
FP32:{' '}
|
| 1128 |
-
<strong>
|
| 1129 |
-
{calculateMaxInputSize(
|
| 1130 |
-
deviceMemory,
|
| 1131 |
-
modelParams,
|
| 1132 |
-
hiddenSize,
|
| 1133 |
-
numLayers,
|
| 1134 |
-
'fp32',
|
| 1135 |
-
batchSize,
|
| 1136 |
-
) > 0
|
| 1137 |
-
? calculateMaxInputSize(
|
| 1138 |
-
deviceMemory,
|
| 1139 |
-
modelParams,
|
| 1140 |
-
hiddenSize,
|
| 1141 |
-
numLayers,
|
| 1142 |
-
'fp32',
|
| 1143 |
-
batchSize,
|
| 1144 |
-
)
|
| 1145 |
-
: 'Out of Memory'}
|
| 1146 |
-
</strong>
|
| 1147 |
-
</div>
|
| 1148 |
-
<div>
|
| 1149 |
-
FP16:{' '}
|
| 1150 |
-
<strong>
|
| 1151 |
-
{calculateMaxInputSize(
|
| 1152 |
-
deviceMemory,
|
| 1153 |
-
modelParams,
|
| 1154 |
-
hiddenSize,
|
| 1155 |
-
numLayers,
|
| 1156 |
-
'fp16',
|
| 1157 |
-
batchSize,
|
| 1158 |
-
) > 0
|
| 1159 |
-
? calculateMaxInputSize(
|
| 1160 |
-
deviceMemory,
|
| 1161 |
-
modelParams,
|
| 1162 |
-
hiddenSize,
|
| 1163 |
-
numLayers,
|
| 1164 |
-
'fp16',
|
| 1165 |
-
batchSize,
|
| 1166 |
-
)
|
| 1167 |
-
: 'Out of Memory'}
|
| 1168 |
-
</strong>
|
| 1169 |
-
</div>
|
| 1170 |
-
<div>
|
| 1171 |
-
INT8:{' '}
|
| 1172 |
-
<strong>
|
| 1173 |
-
{calculateMaxInputSize(
|
| 1174 |
-
deviceMemory,
|
| 1175 |
-
modelParams,
|
| 1176 |
-
hiddenSize,
|
| 1177 |
-
numLayers,
|
| 1178 |
-
'int8',
|
| 1179 |
-
batchSize,
|
| 1180 |
-
) > 0
|
| 1181 |
-
? calculateMaxInputSize(
|
| 1182 |
-
deviceMemory,
|
| 1183 |
-
modelParams,
|
| 1184 |
-
hiddenSize,
|
| 1185 |
-
numLayers,
|
| 1186 |
-
'int8',
|
| 1187 |
-
batchSize,
|
| 1188 |
-
)
|
| 1189 |
-
: 'Out of Memory'}
|
| 1190 |
-
</strong>
|
| 1191 |
-
</div>
|
| 1192 |
-
<div>
|
| 1193 |
-
INT4:{' '}
|
| 1194 |
-
<strong>
|
| 1195 |
-
{calculateMaxInputSize(
|
| 1196 |
-
deviceMemory,
|
| 1197 |
-
modelParams,
|
| 1198 |
-
hiddenSize,
|
| 1199 |
-
numLayers,
|
| 1200 |
-
'int4',
|
| 1201 |
-
batchSize,
|
| 1202 |
-
) > 0
|
| 1203 |
-
? calculateMaxInputSize(
|
| 1204 |
-
deviceMemory,
|
| 1205 |
-
modelParams,
|
| 1206 |
-
hiddenSize,
|
| 1207 |
-
numLayers,
|
| 1208 |
-
'int4',
|
| 1209 |
-
batchSize,
|
| 1210 |
-
)
|
| 1211 |
-
: 'Out of Memory'}
|
| 1212 |
-
</strong>
|
| 1213 |
-
</div>
|
| 1214 |
-
</>
|
| 1215 |
-
) : null}
|
| 1216 |
-
{!batchSize && seqLength ? (
|
| 1217 |
-
<>
|
| 1218 |
-
<div>Max Batch Sizes:</div>
|
| 1219 |
-
<div>
|
| 1220 |
-
FP32:{' '}
|
| 1221 |
-
<strong>
|
| 1222 |
-
{calculateMaxInputSize(
|
| 1223 |
-
deviceMemory,
|
| 1224 |
-
modelParams,
|
| 1225 |
-
hiddenSize,
|
| 1226 |
-
numLayers,
|
| 1227 |
-
'fp32',
|
| 1228 |
-
seqLength,
|
| 1229 |
-
) > 0
|
| 1230 |
-
? calculateMaxInputSize(
|
| 1231 |
-
deviceMemory,
|
| 1232 |
-
modelParams,
|
| 1233 |
-
hiddenSize,
|
| 1234 |
-
numLayers,
|
| 1235 |
-
'fp32',
|
| 1236 |
-
seqLength,
|
| 1237 |
-
)
|
| 1238 |
-
: 'Out of Memory'}
|
| 1239 |
-
</strong>
|
| 1240 |
-
</div>
|
| 1241 |
-
<div>
|
| 1242 |
-
FP16:{' '}
|
| 1243 |
-
<strong>
|
| 1244 |
-
{calculateMaxInputSize(
|
| 1245 |
-
deviceMemory,
|
| 1246 |
-
modelParams,
|
| 1247 |
-
hiddenSize,
|
| 1248 |
-
numLayers,
|
| 1249 |
-
'fp16',
|
| 1250 |
-
seqLength,
|
| 1251 |
-
) > 0
|
| 1252 |
-
? calculateMaxInputSize(
|
| 1253 |
-
deviceMemory,
|
| 1254 |
-
modelParams,
|
| 1255 |
-
hiddenSize,
|
| 1256 |
-
numLayers,
|
| 1257 |
-
'fp16',
|
| 1258 |
-
seqLength,
|
| 1259 |
-
)
|
| 1260 |
-
: 'Out of Memory'}
|
| 1261 |
-
</strong>
|
| 1262 |
-
</div>
|
| 1263 |
-
<div>
|
| 1264 |
-
INT8:{' '}
|
| 1265 |
-
<strong>
|
| 1266 |
-
{calculateMaxInputSize(
|
| 1267 |
-
deviceMemory,
|
| 1268 |
-
modelParams,
|
| 1269 |
-
hiddenSize,
|
| 1270 |
-
numLayers,
|
| 1271 |
-
'int8',
|
| 1272 |
-
seqLength,
|
| 1273 |
-
) > 0
|
| 1274 |
-
? calculateMaxInputSize(
|
| 1275 |
-
deviceMemory,
|
| 1276 |
-
modelParams,
|
| 1277 |
-
hiddenSize,
|
| 1278 |
-
numLayers,
|
| 1279 |
-
'int8',
|
| 1280 |
-
seqLength,
|
| 1281 |
-
)
|
| 1282 |
-
: 'Out of Memory'}
|
| 1283 |
-
</strong>
|
| 1284 |
-
</div>
|
| 1285 |
-
<div>
|
| 1286 |
-
INT4:{' '}
|
| 1287 |
-
<strong>
|
| 1288 |
-
{calculateMaxInputSize(
|
| 1289 |
-
deviceMemory,
|
| 1290 |
-
modelParams,
|
| 1291 |
-
hiddenSize,
|
| 1292 |
-
numLayers,
|
| 1293 |
-
'int4',
|
| 1294 |
-
seqLength,
|
| 1295 |
-
) > 0
|
| 1296 |
-
? calculateMaxInputSize(
|
| 1297 |
-
deviceMemory,
|
| 1298 |
-
modelParams,
|
| 1299 |
-
hiddenSize,
|
| 1300 |
-
numLayers,
|
| 1301 |
-
'int4',
|
| 1302 |
-
seqLength,
|
| 1303 |
-
)
|
| 1304 |
-
: 'Out of Memory'}
|
| 1305 |
-
</strong>
|
| 1306 |
-
</div>
|
| 1307 |
-
</>
|
| 1308 |
-
) : null}
|
| 1309 |
-
{batchSize && seqLength ? (
|
| 1310 |
-
<>
|
| 1311 |
-
<div>Total Memory Usage:</div>
|
| 1312 |
-
<div>
|
| 1313 |
-
FP32:{' '}
|
| 1314 |
-
<strong>
|
| 1315 |
-
{calculateMemoryValid(
|
| 1316 |
-
deviceMemory,
|
| 1317 |
-
modelParams,
|
| 1318 |
-
hiddenSize,
|
| 1319 |
-
numLayers,
|
| 1320 |
-
'fp32',
|
| 1321 |
-
batchSize,
|
| 1322 |
-
seqLength,
|
| 1323 |
-
)
|
| 1324 |
-
? (
|
| 1325 |
-
calculateMemory(modelParams, 'fp32') +
|
| 1326 |
-
calculateMemoryPerInput(hiddenSize, numLayers) *
|
| 1327 |
-
batchSize *
|
| 1328 |
-
seqLength
|
| 1329 |
-
).toFixed(2) + ' GB'
|
| 1330 |
-
: 'Out of Memory'}
|
| 1331 |
-
</strong>
|
| 1332 |
-
</div>
|
| 1333 |
-
<div>
|
| 1334 |
-
FP16:{' '}
|
| 1335 |
-
<strong>
|
| 1336 |
-
{calculateMemoryValid(
|
| 1337 |
-
deviceMemory,
|
| 1338 |
-
modelParams,
|
| 1339 |
-
hiddenSize,
|
| 1340 |
-
numLayers,
|
| 1341 |
-
'fp16',
|
| 1342 |
-
batchSize,
|
| 1343 |
-
seqLength,
|
| 1344 |
-
)
|
| 1345 |
-
? (
|
| 1346 |
-
calculateMemory(modelParams, 'fp16') +
|
| 1347 |
-
calculateMemoryPerInput(hiddenSize, numLayers) *
|
| 1348 |
-
batchSize *
|
| 1349 |
-
seqLength
|
| 1350 |
-
).toFixed(2) + ' GB'
|
| 1351 |
-
: 'Out of Memory'}
|
| 1352 |
-
</strong>
|
| 1353 |
-
</div>
|
| 1354 |
-
<div>
|
| 1355 |
-
INT8:{' '}
|
| 1356 |
-
<strong>
|
| 1357 |
-
{calculateMemoryValid(
|
| 1358 |
-
deviceMemory,
|
| 1359 |
-
modelParams,
|
| 1360 |
-
hiddenSize,
|
| 1361 |
-
numLayers,
|
| 1362 |
-
'int8',
|
| 1363 |
-
batchSize,
|
| 1364 |
-
seqLength,
|
| 1365 |
-
)
|
| 1366 |
-
? (
|
| 1367 |
-
calculateMemory(modelParams, 'int8') +
|
| 1368 |
-
calculateMemoryPerInput(hiddenSize, numLayers) *
|
| 1369 |
-
batchSize *
|
| 1370 |
-
seqLength
|
| 1371 |
-
).toFixed(2) + ' GB'
|
| 1372 |
-
: 'Out of Memory'}
|
| 1373 |
-
</strong>
|
| 1374 |
-
</div>
|
| 1375 |
-
<div>
|
| 1376 |
-
INT4:{' '}
|
| 1377 |
-
<strong>
|
| 1378 |
-
{calculateMemoryValid(
|
| 1379 |
-
deviceMemory,
|
| 1380 |
-
modelParams,
|
| 1381 |
-
hiddenSize,
|
| 1382 |
-
numLayers,
|
| 1383 |
-
'int4',
|
| 1384 |
-
batchSize,
|
| 1385 |
-
seqLength,
|
| 1386 |
-
)
|
| 1387 |
-
? (
|
| 1388 |
-
calculateMemory(modelParams, 'int4') +
|
| 1389 |
-
calculateMemoryPerInput(hiddenSize, numLayers) *
|
| 1390 |
-
batchSize *
|
| 1391 |
-
seqLength
|
| 1392 |
-
).toFixed(2) + ' GB'
|
| 1393 |
-
: 'Out of Memory'}
|
| 1394 |
-
</strong>
|
| 1395 |
-
</div>
|
| 1396 |
-
</>
|
| 1397 |
-
) : null}
|
| 1398 |
-
</div>
|
| 1399 |
-
</div>
|
| 1400 |
-
</div>
|
| 1401 |
-
</div>
|
| 1402 |
-
</>
|
| 1403 |
-
)
|
| 1404 |
)}
|
| 1405 |
</div>
|
| 1406 |
</div>
|
| 1407 |
-
)
|
| 1408 |
-
}
|
| 1409 |
|
| 1410 |
-
export default Calculator
|
|
|
|
| 1 |
+
import React, { useState, useEffect, useRef } from 'react';
|
| 2 |
+
import * as d3 from 'd3';
|
| 3 |
+
import { useTheme } from '../context/themeContext';
|
| 4 |
|
| 5 |
+
import MODELS from '../utils/models';
|
| 6 |
+
import DEVICES from '../utils/devices';
|
| 7 |
|
| 8 |
+
type Precision = 'fp32' | 'fp16' | 'int8' | 'int4';
|
| 9 |
|
| 10 |
interface ModelSizeBarChartProps {
|
| 11 |
+
modelSize: number; // in GB
|
| 12 |
+
largestModelSize: number; // largest model in full precision (fp32)
|
| 13 |
+
modelPrecision: Precision;
|
| 14 |
+
deviceMemorySet: boolean;
|
| 15 |
+
activationMemorySize?: number; // optional for standard calculator
|
| 16 |
}
|
| 17 |
|
| 18 |
interface InferenceRuntimeLineChartProps {
|
| 19 |
+
availableMemory: AvailableMemory; // in GB
|
| 20 |
+
memoryPerInput: number; // in GB
|
| 21 |
}
|
| 22 |
|
| 23 |
interface LineChartData {
|
| 24 |
+
seqLength: number;
|
| 25 |
+
batchSize: number;
|
| 26 |
}
|
| 27 |
|
| 28 |
interface AvailableMemory {
|
| 29 |
+
int4: number;
|
| 30 |
+
int8: number;
|
| 31 |
+
fp16: number;
|
| 32 |
+
fp32: number;
|
| 33 |
}
|
| 34 |
|
| 35 |
+
// Utility to determine color based on precision
|
| 36 |
+
function chooseColor(precision: Precision) {
|
| 37 |
+
const colors = {
|
| 38 |
+
fp32: '#e45f5b',
|
| 39 |
+
fp16: '#ffc068',
|
| 40 |
+
int8: '#71cce9',
|
| 41 |
+
int4: '#383d95',
|
| 42 |
+
};
|
| 43 |
+
return colors[precision] || 'gray';
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// Utility function to calculate total memory with precision factor for prefill chunking
|
| 47 |
+
function calculateTotalMemory(
|
| 48 |
+
modelParams: number,
|
| 49 |
+
hiddenSize: number,
|
| 50 |
+
numLayers: number,
|
| 51 |
+
intermediateSize: number,
|
| 52 |
+
precision: Precision
|
| 53 |
+
) {
|
| 54 |
+
const precisionFactor = {
|
| 55 |
+
fp32: 4,
|
| 56 |
+
fp16: 2,
|
| 57 |
+
int8: 1,
|
| 58 |
+
int4: 0.5,
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
const memoryPerInput = (4 * hiddenSize * numLayers) / 1_000_000_000; // GB
|
| 62 |
+
const modelMemorySize = modelParams * precisionFactor[precision]; // Adjusted by precision
|
| 63 |
+
const activationMemorySize = Math.max(2 * intermediateSize, 4 * hiddenSize) / 1_000_000_000; // GB
|
| 64 |
+
|
| 65 |
+
return memoryPerInput + modelMemorySize + activationMemorySize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
+
// Bar chart for model footprint (shared by both standard and prefill chunking calculators)
|
| 69 |
function ModelSizeBarChart({
|
| 70 |
modelSize,
|
| 71 |
largestModelSize,
|
| 72 |
modelPrecision,
|
| 73 |
deviceMemorySet,
|
| 74 |
+
activationMemorySize = 0, // default to 0 for standard calculator
|
| 75 |
}: ModelSizeBarChartProps) {
|
| 76 |
+
const { theme } = useTheme();
|
| 77 |
+
const chartRef = useRef<SVGSVGElement>(null);
|
| 78 |
|
| 79 |
+
const width = 600;
|
| 80 |
+
const height = 50;
|
| 81 |
|
| 82 |
useEffect(() => {
|
| 83 |
+
if (modelSize > 0 && largestModelSize > 0) {
|
| 84 |
+
d3.select(chartRef.current).selectAll('*').remove();
|
|
|
|
| 85 |
|
| 86 |
+
const svg = d3.select(chartRef.current).attr('width', width).attr('height', height);
|
| 87 |
|
| 88 |
+
const xScale = d3.scaleLinear().domain([0, largestModelSize]).range([0, width]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
if (modelSize + activationMemorySize > largestModelSize) {
|
| 91 |
svg
|
| 92 |
.append('rect')
|
| 93 |
+
.attr('x', 0)
|
| 94 |
.attr('y', 0)
|
| 95 |
+
.attr('width', width)
|
| 96 |
.attr('height', height)
|
| 97 |
.attr('fill', 'transparent')
|
| 98 |
+
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 99 |
+
.style('stroke-dasharray', '4, 4')
|
| 100 |
+
.style('stroke-width', '2px');
|
| 101 |
+
svg
|
| 102 |
+
.append('text')
|
| 103 |
+
.attr('x', width / 2)
|
| 104 |
+
.attr('y', height / 2)
|
| 105 |
+
.attr('text-anchor', 'middle')
|
| 106 |
+
.attr('alignment-baseline', 'middle')
|
| 107 |
+
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 108 |
+
.text('Out of Memory');
|
| 109 |
+
} else {
|
| 110 |
+
svg
|
| 111 |
+
.append('rect')
|
| 112 |
+
.attr('x', 0)
|
| 113 |
+
.attr('y', 0)
|
| 114 |
+
.attr('width', xScale(modelSize))
|
| 115 |
+
.attr('height', height)
|
| 116 |
+
.attr('fill', chooseColor(modelPrecision));
|
| 117 |
+
|
| 118 |
+
if (activationMemorySize > 0) {
|
| 119 |
+
svg
|
| 120 |
+
.append('rect')
|
| 121 |
+
.attr('x', xScale(modelSize))
|
| 122 |
+
.attr('y', 0)
|
| 123 |
+
.attr('width', xScale(activationMemorySize))
|
| 124 |
+
.attr('height', height)
|
| 125 |
+
.attr('fill', '#a4b8e0');
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
if (deviceMemorySet) {
|
| 129 |
+
svg
|
| 130 |
+
.append('rect')
|
| 131 |
+
.attr('x', xScale(modelSize + activationMemorySize))
|
| 132 |
+
.attr('y', 0)
|
| 133 |
+
.attr('width', xScale(largestModelSize - (modelSize + activationMemorySize)))
|
| 134 |
+
.attr('height', height)
|
| 135 |
+
.attr('fill', 'transparent')
|
| 136 |
+
.style('stroke', chooseColor(modelPrecision))
|
| 137 |
+
.style('stroke-width', '2px');
|
| 138 |
+
}
|
| 139 |
}
|
| 140 |
}
|
| 141 |
+
}, [modelSize, largestModelSize, modelPrecision, deviceMemorySet, activationMemorySize, theme]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
+
return <svg ref={chartRef}></svg>;
|
| 144 |
}
|
| 145 |
|
| 146 |
+
// Line chart for inference runtime (shared by both standard and prefill chunking calculators)
|
| 147 |
function InferenceRuntimeLineChart({
|
| 148 |
availableMemory,
|
| 149 |
memoryPerInput,
|
| 150 |
}: InferenceRuntimeLineChartProps) {
|
| 151 |
+
const { theme } = useTheme();
|
| 152 |
+
const chartRef = useRef(null);
|
| 153 |
+
const maxSeqLength = 4096;
|
| 154 |
+
const maxBatchSize = 128;
|
| 155 |
|
| 156 |
useEffect(() => {
|
| 157 |
+
if (memoryPerInput > 0 && Object.values(availableMemory).some((val) => val > 0)) {
|
| 158 |
+
const margin = { top: 20, right: 20, bottom: 50, left: 50 };
|
| 159 |
+
const width = 600 - margin.left - margin.right;
|
| 160 |
+
const height = 400 - margin.top - margin.bottom;
|
| 161 |
+
const precisions = [
|
| 162 |
+
{ name: 'FP32', color: '#e45f5b' },
|
| 163 |
+
{ name: 'FP16', color: '#ffc068' },
|
| 164 |
+
{ name: 'INT8', color: '#71cce9' },
|
| 165 |
+
{ name: 'INT4', color: '#383d95' },
|
| 166 |
+
];
|
| 167 |
+
|
| 168 |
+
const svg = d3.select(chartRef.current);
|
| 169 |
+
svg.selectAll('*').remove();
|
| 170 |
+
|
| 171 |
+
const xScale = d3.scaleLinear().domain([0, maxSeqLength]).range([0, width]);
|
| 172 |
+
const yScale = d3.scaleLinear().domain([0, maxBatchSize]).range([height, 0]);
|
| 173 |
+
|
| 174 |
+
const xAxis = d3.axisBottom(xScale);
|
| 175 |
+
const yAxis = d3.axisLeft(yScale);
|
| 176 |
+
|
| 177 |
+
const zoom = d3
|
| 178 |
+
.zoom()
|
| 179 |
+
.scaleExtent([0.5, 10])
|
| 180 |
+
.translateExtent([
|
| 181 |
+
[-width, -height],
|
| 182 |
+
[2 * width, 2 * height],
|
| 183 |
+
])
|
| 184 |
+
.on('zoom', (event) => {
|
| 185 |
+
const transform = event.transform;
|
| 186 |
+
svg.select('.x-axis').call(xAxis.scale(transform.rescaleX(xScale)));
|
| 187 |
+
svg.select('.y-axis').call(yAxis.scale(transform.rescaleY(yScale)));
|
| 188 |
+
svg.selectAll('path').attr('transform', transform);
|
| 189 |
+
});
|
| 190 |
|
| 191 |
+
svg
|
| 192 |
+
.attr('width', width + margin.left + margin.right)
|
| 193 |
+
.attr('height', height + margin.top + margin.bottom)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
.append('g')
|
| 195 |
.attr('transform', `translate(${margin.left}, ${margin.top})`)
|
| 196 |
+
.call(zoom);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
svg
|
| 199 |
+
.append('g')
|
| 200 |
+
.attr('class', 'x-axis')
|
| 201 |
+
.attr('transform', `translate(${margin.left}, ${height + margin.top})`)
|
| 202 |
+
.call(xAxis);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
|
|
|
| 204 |
svg
|
| 205 |
+
.append('g')
|
| 206 |
+
.attr('class', 'y-axis')
|
| 207 |
+
.attr('transform', `translate(${margin.left}, ${margin.top})`)
|
| 208 |
+
.call(yAxis);
|
| 209 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
svg
|
| 211 |
.append('text')
|
| 212 |
+
.attr('transform', `translate(${width / 2 + margin.left}, ${height + margin.top + 40})`)
|
| 213 |
+
.style('text-anchor', 'middle')
|
|
|
|
|
|
|
| 214 |
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 215 |
+
.text('Sequence Length');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
svg
|
| 218 |
+
.append('text')
|
| 219 |
+
.attr('transform', `rotate(-90)`)
|
| 220 |
.attr('y', 0)
|
| 221 |
+
.attr('x', 0 - height / 2 - margin.top)
|
| 222 |
+
.attr('dy', '1em')
|
| 223 |
+
.style('text-anchor', 'middle')
|
| 224 |
+
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 225 |
+
.text('Batch Size');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
+
// Adding legend for precisions
|
| 228 |
+
const legend = svg
|
| 229 |
+
.append('g')
|
| 230 |
+
.attr('class', 'legend')
|
| 231 |
+
.attr('transform', `translate(${width - 20}, 20)`);
|
| 232 |
|
| 233 |
+
precisions.forEach((precision, index) => {
|
| 234 |
+
const legendItem = legend.append('g').attr('transform', `translate(0, ${index * 30})`);
|
| 235 |
|
| 236 |
+
legendItem
|
| 237 |
+
.append('rect')
|
| 238 |
+
.attr('x', 10)
|
| 239 |
+
.attr('y', 10)
|
| 240 |
+
.attr('width', 10)
|
| 241 |
+
.attr('height', 10)
|
| 242 |
+
.style('fill', precision.color);
|
| 243 |
+
|
| 244 |
+
legendItem
|
| 245 |
+
.append('text')
|
| 246 |
+
.attr('x', 30)
|
| 247 |
+
.attr('y', 16)
|
| 248 |
+
.text(precision.name)
|
| 249 |
+
.style('font-size', '16px')
|
| 250 |
+
.style('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 251 |
+
.attr('alignment-baseline', 'middle');
|
| 252 |
+
});
|
| 253 |
+
|
| 254 |
+
legend
|
| 255 |
.append('rect')
|
| 256 |
+
.attr('class', 'legend-box')
|
| 257 |
+
.attr('width', 80)
|
| 258 |
+
.attr('height', precisions.length * 30)
|
| 259 |
+
.style('fill', 'none')
|
| 260 |
+
.style('stroke-width', '1px')
|
| 261 |
+
.style('stroke', theme === 'dark' ? '#f9fafb' : '#181f26');
|
| 262 |
+
|
| 263 |
+
const tooltip = d3.select('#tooltip');
|
| 264 |
+
|
| 265 |
+
for (const [precision, memory] of Object.entries(availableMemory)) {
|
| 266 |
+
const sequenceLengths = d3
|
| 267 |
+
.range(1, maxSeqLength, 1)
|
| 268 |
+
.map((seqLength) => ({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
seqLength,
|
| 270 |
+
batchSize: memory / (seqLength * memoryPerInput),
|
| 271 |
+
}))
|
| 272 |
+
.filter((d) => d.batchSize <= maxBatchSize && d.batchSize > 1 && d.seqLength > 1);
|
| 273 |
+
|
| 274 |
+
const lineGroup = svg
|
| 275 |
+
.append('g')
|
| 276 |
+
.attr('transform', `translate(${margin.left}, ${margin.top})`);
|
| 277 |
+
|
| 278 |
+
const line = d3
|
| 279 |
+
.line<LineChartData>()
|
| 280 |
+
.x((d) => xScale(d.seqLength))
|
| 281 |
+
.y((d) => yScale(d.batchSize))
|
| 282 |
+
.curve(d3.curveBasis);
|
| 283 |
+
|
| 284 |
+
lineGroup
|
| 285 |
+
.append('path')
|
| 286 |
+
.datum(sequenceLengths)
|
| 287 |
+
.attr('fill', 'none')
|
| 288 |
+
.attr('stroke', chooseColor(precision as Precision))
|
| 289 |
+
.attr('stroke-width', 4)
|
| 290 |
+
.attr('d', line)
|
| 291 |
+
.on('mouseover', () => {
|
| 292 |
+
tooltip.style('opacity', 1);
|
| 293 |
+
tooltip.style('background-color', theme === 'dark' ? '#181f26' : '#f9fafb');
|
| 294 |
+
})
|
| 295 |
+
.on('mousemove', (event) => {
|
| 296 |
+
tooltip.selectAll('text').remove();
|
| 297 |
+
const [x, y] = d3.pointer(event);
|
| 298 |
+
const xValue = xScale.invert(x);
|
| 299 |
+
const yValue = yScale.invert(y);
|
| 300 |
+
tooltip
|
| 301 |
+
.html(`Sequence Length: ${xValue.toFixed(0)}<br/>Batch Size: ${yValue.toFixed(0)}`)
|
| 302 |
+
.attr('fill', theme === 'dark' ? '#f9fafb' : '#181f26')
|
| 303 |
+
.style('left', event.pageX + 10 + 'px')
|
| 304 |
+
.style('top', event.pageY + 10 + 'px');
|
| 305 |
+
})
|
| 306 |
+
.on('mouseout', () => {
|
| 307 |
+
tooltip.style('opacity', 0);
|
| 308 |
+
});
|
| 309 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
}
|
| 311 |
+
}, [availableMemory, memoryPerInput, theme]);
|
|
|
|
| 312 |
|
| 313 |
return (
|
| 314 |
<>
|
| 315 |
<div id='tooltip'></div>
|
| 316 |
<svg ref={chartRef} width={600} height={400} />
|
| 317 |
</>
|
| 318 |
+
);
|
| 319 |
}
|
| 320 |
|
| 321 |
+
// Prefill Chunking Calculator with Updated Logic and Precision Adjustment
|
| 322 |
+
function PrefillChunkingCalculator({
|
| 323 |
deviceMemory,
|
| 324 |
modelParams,
|
| 325 |
hiddenSize,
|
| 326 |
numLayers,
|
|
|
|
| 327 |
intermediateSize,
|
| 328 |
}: {
|
| 329 |
+
deviceMemory: number;
|
| 330 |
+
modelParams: number;
|
| 331 |
+
hiddenSize: number;
|
| 332 |
+
numLayers: number;
|
| 333 |
+
intermediateSize: number;
|
| 334 |
+
}) {
|
| 335 |
+
if (!deviceMemory || !modelParams || !hiddenSize || !numLayers || !intermediateSize) {
|
| 336 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
}
|
| 338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
return (
|
|
|
|
| 340 |
<>
|
| 341 |
{/* Model Footprint with Prefill Chunking */}
|
| 342 |
+
<div className='chart'>
|
| 343 |
+
<div className='text-2xl text-center mb-4'>Model Footprint with Prefill Chunking</div>
|
| 344 |
+
<div className='space-y-8'>
|
| 345 |
+
{(['fp32', 'fp16', 'int8', 'int4'] as Precision[]).map((precision) => {
|
| 346 |
+
const totalMemory = calculateTotalMemory(
|
| 347 |
+
modelParams,
|
| 348 |
+
hiddenSize,
|
| 349 |
+
numLayers,
|
| 350 |
+
intermediateSize,
|
| 351 |
+
precision
|
| 352 |
+
);
|
| 353 |
+
return (
|
| 354 |
+
<div key={precision} className='chart-row'>
|
| 355 |
+
<div className='chart-row-title'>{precision.toUpperCase()}</div>
|
| 356 |
+
<ModelSizeBarChart
|
| 357 |
+
modelSize={totalMemory}
|
| 358 |
+
largestModelSize={deviceMemory}
|
| 359 |
+
modelPrecision={precision}
|
| 360 |
+
deviceMemorySet={deviceMemory > 0}
|
| 361 |
+
activationMemorySize={
|
| 362 |
+
Math.max(2 * intermediateSize, 4 * hiddenSize) / 1_000_000_000
|
| 363 |
+
}
|
| 364 |
+
/>
|
| 365 |
+
<div className='chart-row-size ml-8'>
|
| 366 |
+
{totalMemory.toFixed(2)} / {deviceMemory} GB
|
| 367 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
</div>
|
| 369 |
+
);
|
| 370 |
+
})}
|
| 371 |
</div>
|
| 372 |
+
</div>
|
| 373 |
+
|
| 374 |
+
{/* Inference Runtime with Prefill Chunking */}
|
| 375 |
+
<div className='chart'>
|
| 376 |
+
<div className='text-2xl text-center mb-4'>
|
| 377 |
+
Maximum Batch Size / Sequence Length with Prefill Chunking
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
</div>
|
| 379 |
+
<InferenceRuntimeLineChart
|
| 380 |
+
availableMemory={{
|
| 381 |
+
int4: deviceMemory - calculateTotalMemory(modelParams, hiddenSize, numLayers, intermediateSize, 'int4'),
|
| 382 |
+
int8: deviceMemory - calculateTotalMemory(modelParams, hiddenSize, numLayers, intermediateSize, 'int8'),
|
| 383 |
+
fp16: deviceMemory - calculateTotalMemory(modelParams, hiddenSize, numLayers, intermediateSize, 'fp16'),
|
| 384 |
+
fp32: deviceMemory - calculateTotalMemory(modelParams, hiddenSize, numLayers, intermediateSize, 'fp32'),
|
| 385 |
+
}}
|
| 386 |
+
memoryPerInput={(4 * hiddenSize * numLayers) / 1_000_000_000}
|
| 387 |
+
/>
|
| 388 |
</div>
|
| 389 |
</>
|
| 390 |
+
);
|
| 391 |
}
|
| 392 |
|
| 393 |
+
// Standard Model Memory Calculator (unchanged)
|
| 394 |
+
function StandardCalculator({
|
| 395 |
+
deviceMemory,
|
| 396 |
+
modelParams,
|
| 397 |
+
hiddenSize,
|
| 398 |
+
numLayers,
|
| 399 |
+
}: {
|
| 400 |
+
deviceMemory: number;
|
| 401 |
+
modelParams: number;
|
| 402 |
+
hiddenSize: number;
|
| 403 |
+
numLayers: number;
|
| 404 |
+
}) {
|
| 405 |
+
if (!deviceMemory || !modelParams || !hiddenSize || !numLayers) {
|
| 406 |
+
return null;
|
| 407 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
|
|
|
|
| 409 |
function calculateMemory(params: number, precision: Precision) {
|
| 410 |
+
const paramSize = { fp32: 4, fp16: 2, int8: 1, int4: 0.5 };
|
| 411 |
+
return params * paramSize[precision]; // in GB
|
| 412 |
}
|
| 413 |
|
|
|
|
| 414 |
function calculateMemoryPerInput(hiddenSize: number, numLayers: number) {
|
| 415 |
+
const memoryPerInput = 4 * hiddenSize * numLayers;
|
| 416 |
+
return memoryPerInput / 1_000_000_000; // in GB
|
| 417 |
}
|
| 418 |
|
|
|
|
| 419 |
function calculateMaxInputSize(
|
| 420 |
deviceMemory: number,
|
| 421 |
modelParams: number,
|
|
|
|
| 424 |
precision: Precision,
|
| 425 |
inputSize: number,
|
| 426 |
) {
|
| 427 |
+
const memoryPerInput = calculateMemoryPerInput(hiddenSize, numLayers);
|
| 428 |
+
const availableMemory = deviceMemory - calculateMemory(modelParams, precision);
|
| 429 |
+
return Math.floor(availableMemory / (memoryPerInput * inputSize));
|
| 430 |
}
|
| 431 |
|
|
|
|
| 432 |
function calculateMemoryValid(
|
| 433 |
deviceMemory: number,
|
| 434 |
modelParams: number,
|
|
|
|
| 438 |
batchSize: number,
|
| 439 |
seqLength: number,
|
| 440 |
) {
|
| 441 |
+
const memoryPerInput = calculateMemoryPerInput(hiddenSize, numLayers);
|
| 442 |
+
const availableMemory = deviceMemory - calculateMemory(modelParams, precision);
|
| 443 |
+
return availableMemory >= memoryPerInput * batchSize * seqLength;
|
| 444 |
}
|
| 445 |
|
| 446 |
+
return (
|
| 447 |
+
<>
|
| 448 |
+
{/* Model Footprint */}
|
| 449 |
+
<div className='chart mb-8'>
|
| 450 |
+
<div className='text-2xl text-center mb-4'>Model Footprint</div>
|
| 451 |
+
<div className='space-y-8'>
|
| 452 |
+
{(['fp32', 'fp16', 'int8', 'int4'] as Precision[]).map((precision) => (
|
| 453 |
+
<div key={precision} className='chart-row'>
|
| 454 |
+
<div className='chart-row-title'>{precision.toUpperCase()}</div>
|
| 455 |
+
<ModelSizeBarChart
|
| 456 |
+
modelSize={calculateMemory(modelParams, precision)}
|
| 457 |
+
largestModelSize={deviceMemory}
|
| 458 |
+
modelPrecision={precision}
|
| 459 |
+
deviceMemorySet={deviceMemory > 0}
|
| 460 |
+
/>
|
| 461 |
+
<div className='chart-row-size ml-8'>
|
| 462 |
+
{calculateMemory(modelParams, precision).toFixed(2)} / {deviceMemory} GB
|
| 463 |
+
</div>
|
| 464 |
+
</div>
|
| 465 |
+
))}
|
| 466 |
+
</div>
|
| 467 |
+
</div>
|
| 468 |
+
|
| 469 |
+
{/* Maximum Batch Size / Sequence Length */}
|
| 470 |
+
<div className='chart'>
|
| 471 |
+
<div className='text-2xl text-center mb-4'>
|
| 472 |
+
Maximum Batch Size / Sequence Length
|
| 473 |
+
</div>
|
| 474 |
+
<InferenceRuntimeLineChart
|
| 475 |
+
availableMemory={{
|
| 476 |
+
int4: deviceMemory - calculateMemory(modelParams, 'int4'),
|
| 477 |
+
int8: deviceMemory - calculateMemory(modelParams, 'int8'),
|
| 478 |
+
fp16: deviceMemory - calculateMemory(modelParams, 'fp16'),
|
| 479 |
+
fp32: deviceMemory - calculateMemory(modelParams, 'fp32'),
|
| 480 |
+
}}
|
| 481 |
+
memoryPerInput={calculateMemoryPerInput(hiddenSize, numLayers)}
|
| 482 |
+
/>
|
| 483 |
+
</div>
|
| 484 |
+
</>
|
| 485 |
+
);
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
// Main Calculator Page
|
| 489 |
+
const Calculator = () => {
|
| 490 |
+
const [modelParams, setModelParams] = useState<number | null>(null);
|
| 491 |
+
const [hiddenSize, setHiddenSize] = useState<number | null>(null);
|
| 492 |
+
const [numLayers, setNumLayers] = useState<number | null>(null);
|
| 493 |
+
const [intermediateSize, setIntermediateSize] = useState<number | null>(null);
|
| 494 |
+
const [deviceMemory, setDeviceMemory] = useState<number | null>(null);
|
| 495 |
+
const [isPrefillChunking, setIsPrefillChunking] = useState<boolean>(false);
|
| 496 |
+
const [modelSelectionTab, setModelSelectionTab] = useState<boolean>(true);
|
| 497 |
+
const [deviceSelectionTab, setDeviceSelectionTab] = useState<boolean>(true);
|
| 498 |
+
|
| 499 |
return (
|
| 500 |
<div className='flex flex-col items-center justify-center min-h-screen px-4'>
|
| 501 |
+
{/* Toggle Between Standard and Prefill Chunking */}
|
| 502 |
<div className='mb-4 flex space-x-4'>
|
| 503 |
<button
|
| 504 |
+
className={`${!isPrefillChunking ? 'calculator-input-tab-active' : 'calculator-input-tab'}`}
|
|
|
|
|
|
|
| 505 |
onClick={() => setIsPrefillChunking(false)}
|
| 506 |
>
|
| 507 |
Standard Calculator
|
| 508 |
</button>
|
| 509 |
<button
|
| 510 |
+
className={`${isPrefillChunking ? 'calculator-input-tab-active' : 'calculator-input-tab'}`}
|
|
|
|
|
|
|
| 511 |
onClick={() => setIsPrefillChunking(true)}
|
| 512 |
>
|
| 513 |
Calculator with Prefill Chunking
|
| 514 |
</button>
|
| 515 |
</div>
|
| 516 |
|
| 517 |
+
{/* Model and Device Selection */}
|
| 518 |
<div className='w-full max-w-4xl'>
|
| 519 |
<div className='text-4xl mb-4 text-center'>Model Memory Calculator</div>
|
| 520 |
<div className='mb-6 text-center'>
|
| 521 |
Use our Model Memory Calculator to help you estimate the memory footprint of your model
|
| 522 |
+
and the maximum batch size/sequence length combination you can run on your device.
|
|
|
|
| 523 |
</div>
|
| 524 |
|
|
|
|
| 525 |
<div className='grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6'>
|
| 526 |
{/* Model Selection */}
|
| 527 |
<div className='calculator-input-box'>
|
|
|
|
| 529 |
<div className='calculator-input-content'>
|
| 530 |
<div className='mb-2'>
|
| 531 |
<button
|
| 532 |
+
className={`${modelSelectionTab ? 'calculator-input-tab-active' : 'calculator-input-tab'}`}
|
|
|
|
|
|
|
| 533 |
onClick={() => setModelSelectionTab(true)}
|
| 534 |
>
|
| 535 |
Model Selection
|
| 536 |
</button>
|
| 537 |
<button
|
| 538 |
+
className={`${modelSelectionTab ? 'calculator-input-tab' : 'calculator-input-tab-active'}`}
|
|
|
|
|
|
|
| 539 |
onClick={() => setModelSelectionTab(false)}
|
| 540 |
>
|
| 541 |
Custom Model
|
|
|
|
| 549 |
id='model'
|
| 550 |
className='calculator-select'
|
| 551 |
onChange={(e) => {
|
| 552 |
+
const selectedModel = MODELS.find(
|
| 553 |
+
(model) => model.params === Number(e.target.value),
|
| 554 |
+
);
|
| 555 |
+
if (selectedModel) {
|
| 556 |
+
setModelParams(selectedModel.params);
|
| 557 |
+
setHiddenSize(selectedModel.hidden_size);
|
| 558 |
+
setNumLayers(selectedModel.num_hidden_layers);
|
| 559 |
+
setIntermediateSize(selectedModel.intermediate_size);
|
| 560 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
}}
|
| 562 |
>
|
| 563 |
<option value=''>None selected</option>
|
|
|
|
| 565 |
<option
|
| 566 |
key={model.name}
|
| 567 |
value={model.params}
|
|
|
|
|
|
|
| 568 |
>
|
| 569 |
{model.name}
|
| 570 |
</option>
|
|
|
|
| 603 |
min={1}
|
| 604 |
onChange={(e) => setNumLayers(Number(e.target.value))}
|
| 605 |
/>
|
| 606 |
+
{isPrefillChunking && (
|
| 607 |
+
<>
|
| 608 |
+
<label htmlFor='intermediateSize'>Intermediate Size</label>
|
| 609 |
+
<input
|
| 610 |
+
type='number'
|
| 611 |
+
id='intermediateSize'
|
| 612 |
+
className='calculator-input'
|
| 613 |
+
placeholder='e.g. 11008 (for LLaMA-7B)'
|
| 614 |
+
value={intermediateSize || ''}
|
| 615 |
+
min={1}
|
| 616 |
+
onChange={(e) => setIntermediateSize(Number(e.target.value))}
|
| 617 |
+
/>
|
| 618 |
+
</>
|
| 619 |
+
)}
|
| 620 |
</>
|
| 621 |
)}
|
| 622 |
</div>
|
|
|
|
| 629 |
<div className='calculator-input-content'>
|
| 630 |
<div className='mb-2'>
|
| 631 |
<button
|
| 632 |
+
className={`${deviceSelectionTab ? 'calculator-input-tab-active' : 'calculator-input-tab'}`}
|
|
|
|
|
|
|
| 633 |
onClick={() => {
|
| 634 |
+
setDeviceSelectionTab(true);
|
| 635 |
+
setDeviceMemory(null);
|
| 636 |
}}
|
| 637 |
>
|
| 638 |
Device Selection
|
| 639 |
</button>
|
| 640 |
<button
|
| 641 |
+
className={`${deviceSelectionTab ? 'calculator-input-tab' : 'calculator-input-tab-active'}`}
|
|
|
|
|
|
|
| 642 |
onClick={() => {
|
| 643 |
+
setDeviceSelectionTab(false);
|
| 644 |
+
setDeviceMemory(null);
|
| 645 |
}}
|
| 646 |
>
|
| 647 |
Custom Device
|
|
|
|
| 683 |
</div>
|
| 684 |
</div>
|
| 685 |
|
| 686 |
+
{/* Render Appropriate Calculator Based on Toggle */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
{isPrefillChunking ? (
|
| 688 |
<PrefillChunkingCalculator
|
| 689 |
deviceMemory={deviceMemory!}
|
| 690 |
modelParams={modelParams!}
|
| 691 |
hiddenSize={hiddenSize!}
|
| 692 |
numLayers={numLayers!}
|
| 693 |
+
intermediateSize={intermediateSize!}
|
|
|
|
|
|
|
|
|
|
| 694 |
/>
|
| 695 |
) : (
|
| 696 |
+
<StandardCalculator
|
| 697 |
+
deviceMemory={deviceMemory!}
|
| 698 |
+
modelParams={modelParams!}
|
| 699 |
+
hiddenSize={hiddenSize!}
|
| 700 |
+
numLayers={numLayers!}
|
| 701 |
+
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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