Open 0xdevalias opened 3 months ago
I can see that the instructions are in the README here:
Which suggests I need to run humanify download 2b
first.
I wonder if it might make more sense to have the local model download as a sub-command of humanify local
, as that's where I was first looking for help for how to download the models, and it didn't even occur to me to check the root level command, since things local things seemed to be 'scoped' under the local
command:
⇒ npx humanifyjs local -h
(node:97623) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Usage: humanify local [options] <input>
Use a local LLM to unminify code
Arguments:
input The input minified Javascript file
Options:
-m, --model <model> The model to use (default: "2b")
-o, --outputDir <output> The output directory (default: "output")
-s, --seed <seed> Seed for the model to get reproduceable results (leave out for random seed)
--disableGpu Disable GPU acceleration
--verbose Show verbose output
-h, --help display help for command
There also seems to be very minimal information output during the download. It might be nice to know a bit more about which model is being downloaded, from where, where it's being saved, how large it is, etc:
⇒ npx humanifyjs download 2b
(node:97932) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Downloaded 1.63 GB
I guess it does provide slightly more info when the download is completed:
⇒ npx humanifyjs download 2b
(node:97932) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Model "2b" downloaded to /Users/devalias/.humanifyjs/models/Phi-3.1-mini-4k-instruct-Q4_K_M.gguf
I can see it's downloaded here:
⇒ ls ~/.humanifyjs/models
Phi-3.1-mini-4k-instruct-Q4_K_M.gguf
And the code for that is here:
I also notice that MODEL_DIRECTORY
is hardcoded currently. I wonder if that would be something useful to be able to specify/customize via a CLI arg/env variable/etc.
It seems the humanify local
command uses getModelPath
:
Which only seems to work for model aliases defined in MODELS
:
Even though the error text for humanify download
sounds as though it would be capable of downloading any named model:
And usually for LLM apps, the --model
param would let us specify arbitrary models from huggingface or similar.
Edit: Created a new issue related to the download progress/etc:
Currently when trying to run with a local model that isn't downloaded, the app crashes with an error such as the following:
It might be useful to give a more user friendly error that explains how to resolve the issue.
I ran into this while trying to test/replicate the following: