Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disabling GPU use #56

Merged
merged 2 commits into from
Aug 24, 2024
Merged

Fix disabling GPU use #56

merged 2 commits into from
Aug 24, 2024

Conversation

jehna
Copy link
Owner

@jehna jehna commented Aug 24, 2024

Fixes #55

Need to check what happens to test run times if e161521 is applied, best case they stay at ~5min

This made the local inference try to use the GPU even when the user
provided the `--disableGpu` flag.
Setting the layers to 0 seemed to do most of the work, but it still used
some of the available GPU. Which was weird. Let's see if this messes up
the CI test times.
@jehna
Copy link
Owner Author

jehna commented Aug 24, 2024

No effect in CI test runs, this is good to go 🚀

@jehna jehna merged commit 14e4ae5 into main Aug 24, 2024
3 checks passed
@jehna jehna deleted the fix/nogputypo branch August 24, 2024 13:26
Comment on lines -30 to +32
disableGPU: opts.disableGPU,
disableGpu: opts.disableGpu,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the TypeScript typing have pointed out this issue earlier?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but unfortunately the commander package just passes any as the options. yargs was better in making the options strongly typed, although I found the commander package a bit more ergonomic to use. I'm thinking about changing away from commander though, exactly because this should have been a compiler-caught bug.

Copy link

@0xdevalias 0xdevalias Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah true; yeah, that makes sense.

Does commander let you override the options type? It still could have let the bug through if you made the bug in those types as well, but at least it would stop the 'any' propagating further.

modelPath: getModelPath(opts?.model),
gpuLayers: (opts?.disableGPU ?? IS_CI) ? 0 : undefined
});
gpuLayers: disableGpu ? 0 : undefined
Copy link

@0xdevalias 0xdevalias Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, if GPU is disabled in the call to getLlama now, do you actually need to set gpuLayers to 0 here? Or is this just leftover from your previous attempted approach to disable GPU?

@neoOpus
Copy link

neoOpus commented Sep 11, 2024

Right now without GPU it just do not work at all

humanify local --verbose -m 2b --disableGpu .\arkose.js
[2024-09-11 19:12:07]  Starting local inference with options:  { model: '2b', outputDir: 'output', verbose: true, disableGpu: true }
[2024-09-11 19:12:07]  Loading model with options {
  modelPath: 'C:\\Users\\neoop\\.humanifyjs\\models/Phi-3.1-mini-4k-instruct-Q4_K_M.gguf',
  gpuLayers: 0
}

@jehna
Copy link
Owner Author

jehna commented Sep 11, 2024

That's weird. I do run CI tests without GPU and they seem to be working fine. Do you get any errors? Running even a small model on a mid renage CPU is super slow though.

@neoOpus
Copy link

neoOpus commented Sep 11, 2024

Maybe because I am using an old laptop, I don't have access to another for the moment...

No, I didn't get any error... I would like to know what is the problem in order to try to fix it.

Yes, I am aware of LLM being extremely slow as I try to use AnythingLLM to try some uncensored models...

@jehna
Copy link
Owner Author

jehna commented Sep 12, 2024

Does the program exit by itself or does it just seem to hang forever? If it exits, what's the exit code?

@neoOpus
Copy link

neoOpus commented Sep 12, 2024

Does the program exit by itself or does it just seem to hang forever? If it exits, what's the exit code?

Yes it exists just after I launch it... Do you want a video?

@neoOpus
Copy link

neoOpus commented Sep 12, 2024

I managed to make this work via WSL by installing all the required components (I have to write a tutorial about this, but I need to setup another machine to start from scratch and take note of all steps)... So for the moment you can just forget about this issue...

Side note : I will add support in the code "disableGPU" as well as I think it is more appropriate to write it and do PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--disableGpu not working
3 participants