mirror of
https://github.com/jehna/humanify.git
synced 2026-04-27 09:35:58 +03:00
[GH-ISSUE #351] How can I determine if Humanify is using CUDA or CPU locally? #71
Labels
No labels
bug
enhancement
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/humanify#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GermanKousal on GitHub (Mar 2, 2025).
Original GitHub issue: https://github.com/jehna/humanify/issues/351
Hello everyone,
I'm currently using humanify to process a 4MB obfuscated file. After several hours, the progress still shows 0%, which leads me to suspect that the tool might be running on CPU instead of utilizing CUDA acceleration.
Is there a way to verify whether humanify is using CUDA or CPU on my system? Additionally, is it possible to force the tool to use CUDA, and if CUDA is not available, have it fail immediately?
Any help or suggestions would be greatly appreciated. Thank you!
Forgot to say Im using HumanifyJS through WSL.
@KyleSau commented on GitHub (Mar 12, 2025):
This as well
@0xdevalias commented on GitHub (Mar 24, 2025):
@GermanKousal / @KyleSau Do you have any logs from running it? Looking at some older issues (eg. https://github.com/jehna/humanify/issues/50) it seems to print details about the GPU being used.
Following along a similar path of debugging that I did in the past (https://github.com/jehna/humanify/issues/53#issuecomment-2306107630):
The main part of the CLI is set up in
src/index.ts, and then loads thelocalcommand fromsrc/commands/local.ts:github.com/jehna/humanify@ad3a03301e/src/index.ts (L4-L13)Among other things, the
localcommand has--disableGpu/--contextSizeargs:github.com/jehna/humanify@ad3a03301e/src/commands/local.ts (L22-L28)Which are passed in to
llama(src/plugins/local-llm-rename/llama.ts), and thenunminify(src/unminify.ts):github.com/jehna/humanify@ad3a03301e/src/commands/local.ts (L2)github.com/jehna/humanify@ad3a03301e/src/commands/local.ts (L4)github.com/jehna/humanify@ad3a03301e/src/commands/local.ts (L37-L47)The
llamafunction usesnode-llama-cpp'sgetLlama, and then callsloadModel,createContext, etc (passing indisableGpu, etc):github.com/jehna/humanify@ad3a03301e/src/plugins/local-llm-rename/llama.ts (L1-L6)github.com/jehna/humanify@ad3a03301e/src/plugins/local-llm-rename/llama.ts (L19-L33)Skimming through the
node-llama-cppdocs for those sorts of functions and similar:type LlamaGpuType = "metal" | "cuda" | "vulkan" | false;Based on that, it seems that
node-llama-cppgives us a whole bunch of options for controlling if/what GPU aspects are used, and inspecting that later on.Looking back at
humanify's implementation with this new knowledge, we can see that when--disableGpuis passed (or ifIS_CI), thengetLlama'sgpuoption is set toauto:github.com/jehna/humanify@ad3a03301e/src/plugins/local-llm-rename/llama.ts (L24-L25)I would need to run
humanify localand look more specifically at what it currently logs + what it logs in--verbose/ any debug modes / etc to know if it's possible to see when running on GPU / CPU in its current form; and I suspect based on the above that code changes would be required to implement a 'force GPU' mode.When I get a chance, I'll try running things locally and debugging further as to what is available, and think more about which of the above features would make sense to combine to improve the current state of
humanify; though obviously if you get a chance to do similar before me, I would love to hear any insights/experiments/etc you discover.This older issue sounds like it might be a little bit similar to the root issue you seem to be observing.. so it might be useful knowledge as well:
@0xdevalias commented on GitHub (Mar 24, 2025):
Another thing worth noting, that may or may not be relevant here, relating to the
node-llama-cppbuild options and whether it was built for CUDA/etc... I'm thinking maybe for some of the other issues we've seen related to Windows, where it seems to work when run through WSL, but not when run natively, or vice versa.. I wonder ifnode-llama-cppis getting built for eg. Windows WSL, but then doesn't have the right binaries available for Windows native or similar (I don't really use windows these days, but wanted to capture the thought while I was having it)I don't remember where I saw this (assuming I am remembering correctly), but I think I saw something related to builds somewhere in
humanify's source.. maybe in apostinstall, or within one of the commands or similar.. I'd need to dig deeper to figure out if I am remembering correctly and if so, where it was.Edit: I think this was my previous deep dive into this, and it looks as though it may happen as a
postinstallonnode-llama-cppitself:@0xdevalias commented on GitHub (Mar 24, 2025):
There are some notes in here that might also be relevant:
Random pondering: I wonder what sort of output
humanify/node-llama-cppwould show if it was having to compile a new version; and whether that would look as though it was hanging on 0% during that process.This also looks like a good standalone test to help get some more info:
There's also some further notes a little later on about how to configure the GPU type from code (and recommends to leave it as the default
auto), including a check withconsole.log("GPU type:", llama.gpu):@0xdevalias commented on GitHub (Mar 24, 2025):
These commands might also be useful in debugging if/how well certain models might run on your system:
@0xdevalias commented on GitHub (Mar 24, 2025):
Here's a debug patch I put together to get a bit more info about the various extra bits of info we could inspect:
And then I was running like this:
But on my Intel mac it doesn't register a GPU, so hard to debug much further: