[{"data":1,"prerenderedAt":594},["ShallowReactive",2],{"docs-navigation":3,"docs:\u002Fdocs\u002Fself-hosting\u002Fgpu":235,"docs-surround:\u002Fdocs\u002Fself-hosting\u002Fgpu":589},[4],{"title":5,"path":6,"stem":7,"children":8},"Docs","\u002Fdocs","docs",[9,13,37,55,70,128,146,191,217],{"title":10,"path":6,"stem":11,"icon":12},"Hubstruct documentation","docs\u002Findex","book-open",{"title":14,"icon":15,"path":16,"stem":17,"children":18,"page":36},"Getting started","rocket","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started",[19,24,28,32],{"title":20,"path":21,"stem":22,"icon":23},"Introduction","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",null,{"title":25,"path":26,"stem":27,"icon":23},"Requirements","\u002Fdocs\u002Fgetting-started\u002Frequirements","docs\u002F1.getting-started\u002F2.requirements",{"title":29,"path":30,"stem":31,"icon":23},"Quick start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F3.quick-start",{"title":33,"path":34,"stem":35,"icon":23},"First steps","\u002Fdocs\u002Fgetting-started\u002Ffirst-steps","docs\u002F1.getting-started\u002F4.first-steps",false,{"title":38,"icon":39,"path":40,"stem":41,"children":42,"page":36},"Concepts","lightbulb","\u002Fdocs\u002Fconcepts","docs\u002F2.concepts",[43,47,51],{"title":44,"path":45,"stem":46,"icon":23},"How it works","\u002Fdocs\u002Fconcepts\u002Fhow-it-works","docs\u002F2.concepts\u002F1.how-it-works",{"title":48,"path":49,"stem":50,"icon":23},"Processing steps","\u002Fdocs\u002Fconcepts\u002Fprocessing","docs\u002F2.concepts\u002F2.processing",{"title":52,"path":53,"stem":54,"icon":23},"Media","\u002Fdocs\u002Fconcepts\u002Fmedia","docs\u002F2.concepts\u002F3.media",{"title":56,"path":57,"stem":58,"children":59,"icon":69},"Libraries","\u002Fdocs\u002Flibraries","docs\u002F3.libraries\u002F1.index",[60,61,65],{"title":56,"path":57,"stem":58,"icon":23},{"title":62,"path":63,"stem":64,"icon":23},"Storage","\u002Fdocs\u002Flibraries\u002Fs3","docs\u002F3.libraries\u002F3.s3",{"title":66,"path":67,"stem":68,"icon":23},"Uploading","\u002Fdocs\u002Flibraries\u002Fuploading","docs\u002F3.libraries\u002F4.uploading","layer-group",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":36},"Features","wand-magic-sparkles","\u002Fdocs\u002Ffeatures","docs\u002F4.features",[76,80,84,88,92,96,100,104,108,112,116,120,124],{"title":77,"path":78,"stem":79,"icon":23},"Browsing","\u002Fdocs\u002Ffeatures\u002Fbrowsing","docs\u002F4.features\u002F01.browsing",{"title":81,"path":82,"stem":83,"icon":23},"Search","\u002Fdocs\u002Ffeatures\u002Fsearch","docs\u002F4.features\u002F02.search",{"title":85,"path":86,"stem":87,"icon":23},"Tags","\u002Fdocs\u002Ffeatures\u002Ftags","docs\u002F4.features\u002F03.tags",{"title":89,"path":90,"stem":91,"icon":23},"Albums","\u002Fdocs\u002Ffeatures\u002Falbums","docs\u002F4.features\u002F04.albums",{"title":93,"path":94,"stem":95,"icon":23},"People and faces","\u002Fdocs\u002Ffeatures\u002Fpeople","docs\u002F4.features\u002F05.people",{"title":97,"path":98,"stem":99,"icon":23},"Groups","\u002Fdocs\u002Ffeatures\u002Fgroups","docs\u002F4.features\u002F06.groups",{"title":101,"path":102,"stem":103,"icon":23},"Duplicates and stacks","\u002Fdocs\u002Ffeatures\u002Fduplicates-and-stacks","docs\u002F4.features\u002F07.duplicates-and-stacks",{"title":105,"path":106,"stem":107,"icon":23},"NSFW","\u002Fdocs\u002Ffeatures\u002Fnsfw","docs\u002F4.features\u002F08.nsfw",{"title":109,"path":110,"stem":111,"icon":23},"Trash","\u002Fdocs\u002Ffeatures\u002Ftrash","docs\u002F4.features\u002F09.trash",{"title":113,"path":114,"stem":115,"icon":23},"Home and the dashboard","\u002Fdocs\u002Ffeatures\u002Fhome-and-dashboard","docs\u002F4.features\u002F10.home-and-dashboard",{"title":117,"path":118,"stem":119,"icon":23},"Live updates and offline","\u002Fdocs\u002Ffeatures\u002Flive-updates","docs\u002F4.features\u002F11.live-updates",{"title":121,"path":122,"stem":123,"icon":23},"Appearance and the app","\u002Fdocs\u002Ffeatures\u002Fappearance","docs\u002F4.features\u002F12.appearance",{"title":125,"path":126,"stem":127,"icon":23},"Places","\u002Fdocs\u002Ffeatures\u002Fplaces","docs\u002F4.features\u002F13.places",{"title":129,"icon":130,"path":131,"stem":132,"children":133,"page":36},"Administration","sliders","\u002Fdocs\u002Fadministration","docs\u002F5.administration",[134,138,142],{"title":135,"path":136,"stem":137,"icon":23},"Users and sign-in","\u002Fdocs\u002Fadministration\u002Fusers-and-sign-in","docs\u002F5.administration\u002F1.users-and-sign-in",{"title":139,"path":140,"stem":141,"icon":23},"API keys","\u002Fdocs\u002Fadministration\u002Fapi-keys","docs\u002F5.administration\u002F2.api-keys",{"title":143,"path":144,"stem":145,"icon":23},"Processing settings","\u002Fdocs\u002Fadministration\u002Fprocessing-settings","docs\u002F5.administration\u002F3.processing-settings",{"title":147,"icon":148,"path":149,"stem":150,"children":151,"page":36},"Self-hosting","server","\u002Fdocs\u002Fself-hosting","docs\u002F6.self-hosting",[152,156,160,164,167,171,175,179,183,187],{"title":153,"path":154,"stem":155,"icon":23},"Architecture","\u002Fdocs\u002Fself-hosting\u002Farchitecture","docs\u002F6.self-hosting\u002F1.architecture",{"title":157,"path":158,"stem":159,"icon":23},"Telemetry","\u002Fdocs\u002Fself-hosting\u002Ftelemetry","docs\u002F6.self-hosting\u002F10.telemetry",{"title":161,"path":162,"stem":163,"icon":23},"Sharing one GPU","\u002Fdocs\u002Fself-hosting\u002Fgpu","docs\u002F6.self-hosting\u002F2.gpu",{"title":62,"path":165,"stem":166,"icon":23},"\u002Fdocs\u002Fself-hosting\u002Fstorage","docs\u002F6.self-hosting\u002F3.storage",{"title":168,"path":169,"stem":170,"icon":23},"Backups","\u002Fdocs\u002Fself-hosting\u002Fbackups","docs\u002F6.self-hosting\u002F4.backups",{"title":172,"path":173,"stem":174,"icon":23},"Updating","\u002Fdocs\u002Fself-hosting\u002Fupdating","docs\u002F6.self-hosting\u002F5.updating",{"title":176,"path":177,"stem":178,"icon":23},"Scaling","\u002Fdocs\u002Fself-hosting\u002Fscaling","docs\u002F6.self-hosting\u002F6.scaling",{"title":180,"path":181,"stem":182,"icon":23},"HTTPS and a domain","\u002Fdocs\u002Fself-hosting\u002Freverse-proxy","docs\u002F6.self-hosting\u002F7.reverse-proxy",{"title":184,"path":185,"stem":186,"icon":23},"Troubleshooting","\u002Fdocs\u002Fself-hosting\u002Ftroubleshooting","docs\u002F6.self-hosting\u002F8.troubleshooting",{"title":188,"path":189,"stem":190,"icon":23},"The config file","\u002Fdocs\u002Fself-hosting\u002Fconfig-file","docs\u002F6.self-hosting\u002F9.config-file",{"title":192,"icon":193,"path":194,"stem":195,"children":196,"page":36},"Reference","book","\u002Fdocs\u002Freference","docs\u002F7.reference",[197,201,205,209,213],{"title":198,"path":199,"stem":200,"icon":23},"Environment variables","\u002Fdocs\u002Freference\u002Fenvironment","docs\u002F7.reference\u002F1.environment",{"title":202,"path":203,"stem":204,"icon":23},"Worker roles","\u002Fdocs\u002Freference\u002Fworker-roles","docs\u002F7.reference\u002F2.worker-roles",{"title":206,"path":207,"stem":208,"icon":23},"API","\u002Fdocs\u002Freference\u002Fapi","docs\u002F7.reference\u002F3.api",{"title":210,"path":211,"stem":212,"icon":23},"Keyboard shortcuts","\u002Fdocs\u002Freference\u002Fkeyboard-shortcuts","docs\u002F7.reference\u002F4.keyboard-shortcuts",{"title":214,"path":215,"stem":216,"icon":23},"Models","\u002Fdocs\u002Freference\u002Fmodels","docs\u002F7.reference\u002F5.models",{"title":218,"icon":219,"path":220,"stem":221,"children":222,"page":36},"Hubstruct Cloud","cloud","\u002Fdocs\u002Fcloud","docs\u002F8.cloud",[223,227,231],{"title":224,"path":225,"stem":226,"icon":23},"Getting started with the cloud","\u002Fdocs\u002Fcloud\u002Fgetting-started","docs\u002F8.cloud\u002F1.getting-started",{"title":228,"path":229,"stem":230,"icon":23},"Plans and billing","\u002Fdocs\u002Fcloud\u002Fplans-and-billing","docs\u002F8.cloud\u002F2.plans-and-billing",{"title":232,"path":233,"stem":234,"icon":23},"Moving between cloud and self-hosted","\u002Fdocs\u002Fcloud\u002Fmoving","docs\u002F8.cloud\u002F3.moving",{"id":236,"title":161,"body":237,"description":583,"extension":584,"eyebrow":147,"icon":23,"meta":585,"navigation":586,"path":162,"seo":587,"stem":163,"__hash__":588},"docs\u002Fdocs\u002F6.self-hosting\u002F2.gpu.md",{"type":238,"value":239,"toc":574},"minimark",[240,244,321,326,346,349,399,407,422,430,434,452,456,563,567],[241,242,243],"p",{},"Hubstruct's models run on the GPU in two containers:",[245,246,247,262],"table",{},[248,249,250],"thead",{},[251,252,253,257,259],"tr",{},[254,255,256],"th",{},"Container",[254,258,214],{},[254,260,261],{},"Steps",[263,264,265,303],"tbody",{},[251,266,267,274,277],{},[268,269,270],"td",{},[271,272,273],"code",{},"models",[268,275,276],{},"Gemma 4, EmbeddingGemma, d1",[268,278,279,282,283,286,287,282,290,282,293,282,296,282,299,302],{},[271,280,281],{},"description",", ",[271,284,285],{},"title",", reading ",[271,288,289],{},"text",[271,291,292],{},"visual",[271,294,295],{},"embedding",[271,297,298],{},"tagging",[271,300,301],{},"nsfw",", and search queries",[251,304,305,310,313],{},[268,306,307],{},[271,308,309],{},"vision",[268,311,312],{},"Face and text detectors",[268,314,315,318,319],{},[271,316,317],{},"faces",", finding ",[271,320,289],{},[322,323,325],"h2",{"id":324},"the-models-server-fits-the-models-to-the-card","The models server fits the models to the card",[241,327,328,329,331,332,339,340,345],{},"The ",[271,330,273],{}," container is ",[333,334,338],"a",{"href":335,"rel":336},"https:\u002F\u002Fgithub.com\u002Fmostlygeek\u002Fllama-swap",[337],"nofollow","llama-swap"," in front of ",[333,341,344],{"href":342,"rel":343},"https:\u002F\u002Fgithub.com\u002Fggml-org\u002Fllama.cpp",[337],"llama.cpp",": one llama.cpp server per model, started when a step first asks for it and stopped after 10 minutes without use, or when another model needs the room. You don't switch anything by hand: all the steps run, and one whose model isn't loaded yet waits a few seconds for it.",[241,347,348],{},"On a 12 GB card, with the default models:",[245,350,351,364],{},[248,352,353],{},[251,354,355,358,361],{},[254,356,357],{},"Model",[254,359,360],{},"Video memory",[254,362,363],{},"Used for",[263,365,366,377,388],{},[251,367,368,371,374],{},[268,369,370],{},"Gemma 4 E2B",[268,372,373],{},"about 4 GB",[268,375,376],{},"descriptions, titles, reading text",[251,378,379,382,385],{},[268,380,381],{},"d1 2B",[268,383,384],{},"about 3.3 GB",[268,386,387],{},"smart tags and NSFW",[251,389,390,393,396],{},[268,391,392],{},"EmbeddingGemma 2",[268,394,395],{},"about 2 GB",[268,397,398],{},"search, and finding look-alikes",[241,400,401,402,406],{},"All three fit at once, beside the vision service's models (about 1.7 GB together once warm, given back after 10 minutes without use). The bigger describing model, Gemma 4 E4B (about 6.8 GB, chosen in ",[403,404,405],"strong",{},"Settings → Processing","), doesn't fit beside d1, so the two take turns: while descriptions run, tagging waits for the model to be swapped, and back. That's slower, as each swap takes a few seconds, but nothing fails.",[241,408,409,410,413,414,417,418,421],{},"Which models may run together, and how much context each gets, is in the server's configuration, ",[271,411,412],{},"src\u002Fservices\u002Fmodels\u002Fconfig.yaml"," (in the ",[271,415,416],{},"ghcr.io\u002Fhubstruct\u002Fmodels"," image at ",[271,419,420],{},"\u002Fetc\u002Fllama-swap\u002Fconfig\u002Fconfig.yaml","). On a bigger card, mount your own copy there with every model in one set.",[423,424,427],"callout",{"title":425,"type":426},"Search needs the models server","warning",[241,428,429],{},"Searching by meaning embeds your search with EmbeddingGemma. While the models server is stopped, search still works by words, tags and file names, but not by meaning, image or similarity.",[322,431,433],{"id":432},"several-gpus","Several GPUs",[241,435,436,437,440,441,444,445,282,448,451],{},"Each GPU service asks Docker for ",[271,438,439],{},"count: all"," GPUs by default. To pin each to its own card, change its ",[271,442,443],{},"deploy.resources.reservations.devices"," in the Compose file to ",[271,446,447],{},"device_ids: [\"0\"]",[271,449,450],{},"[\"1\"]"," and so on. llama.cpp spreads a model that doesn't fit on one card across the cards it's given.",[322,453,455],{"id":454},"the-vision-services-settings","The vision service's settings",[245,457,458,471],{},[248,459,460],{},[251,461,462,465,468],{},[254,463,464],{},"Variable",[254,466,467],{},"Default",[254,469,470],{},"Means",[263,472,473,495,510,528,548],{},[251,474,475,480,485],{},[268,476,477],{},[271,478,479],{},"VISION_TEXT_DEVICE",[268,481,482],{},[271,483,484],{},"cuda",[268,486,487,488,490,491,494],{},"Run the text detector on ",[271,489,484],{}," or ",[271,492,493],{},"cpu",".",[251,496,497,502,507],{},[268,498,499],{},[271,500,501],{},"VISION_CONCURRENCY",[268,503,504],{},[271,505,506],{},"1",[268,508,509],{},"How many requests it handles at once.",[251,511,512,517,521],{},[268,513,514],{},[271,515,516],{},"VISION_FACES_DEVICE",[268,518,519],{},[271,520,484],{},[268,522,523,524,490,526,494],{},"Run the face models on ",[271,525,484],{},[271,527,493],{},[251,529,530,535,541],{},[268,531,532],{},[271,533,534],{},"VISION_IDLE_MS",[268,536,537,540],{},[271,538,539],{},"600000"," (10 min)",[268,542,543,544,547],{},"Close the models after this long without a request, giving their GPU memory back. The next request opens them again (a few seconds). ",[271,545,546],{},"0"," keeps them open.",[251,549,550,555,560],{},[268,551,552],{},[271,553,554],{},"VISION_CPUS",[268,556,557],{},[271,558,559],{},"8",[268,561,562],{},"Its CPU limit, and its threads per model.",[322,564,566],{"id":565},"without-a-gpu","Without a GPU",[241,568,569,570,573],{},"The models server's image is built for NVIDIA cards (CUDA 12: Pascal through Ada). Without one, the steps that need a model show as waiting on the dashboard; everything else works. Running the models on the CPU needs llama-swap's CPU image and a configuration without ",[271,571,572],{},"-ngl","; we haven't measured how slow that is yet.",{"title":575,"searchDepth":576,"depth":576,"links":577},"",3,[578,580,581,582],{"id":324,"depth":579,"text":325},2,{"id":432,"depth":579,"text":433},{"id":454,"depth":579,"text":455},{"id":565,"depth":579,"text":566},"How the models server and the vision service share a GPU, what fits on a 12 GB card, and running on bigger or several cards.","md",{},true,{"title":161,"description":583},"U40huX92AfuvlGQMlMlKKzddE9jh7q7-3EDFyHGolYE",[590,592],{"title":157,"path":158,"stem":159,"description":591,"children":-1},"[object Object]",{"title":62,"path":165,"stem":166,"description":593,"children":-1},"The storage service (Garage), where its files live on the host, its keys, and getting files out of it.",1795744072957]