← Back to context

Comment by jart

18 days ago

It would be more accurate to say I packaged it. llamafile is a project I did for Mozilla Builders where we compiled llama.cpp with cosmopolitan libc so that LLMs can be portable binaries. https://builders.mozilla.org/ Last year I concatenated the Gemma weights onto llamafile and called it gemmafile and it got hundreds of thousands of downloads. https://x.com/JustineTunney/status/1808165898743878108 I currently work at Google on Gemini improving TPU performance. The point is that if you want to run this stuff 100% locally, you can. Myself and others did a lot of work to make that possible.

I keep meaning to investigate how I can use your tools to create single-file executables for Python projects, so thanks for posting and reminding me.

  • My early contributions to https://github.com/jart/cosmopolitan were focused towards getting a single-file Python executable. I wanted my Python scripts to run on both Windows and Linux, and now they do. To try out Python, you can:

        wget https://cosmo.zip/pub/cosmos/bin/python -qO python.com
        chmod +x python.com
        ./python.com
    

    Adding pure-Python libraries just means downloading the wheel and adding files to the binary using the zip command:

        ./python.com -m pip download Click
        mkdir -p Lib && cd Lib
        unzip ../click*.whl
        cd ..
        zip -qr ./python.com Lib/
        ./python.com # can now import click
    

    Cosmopolitan Libc provides some nice APIs to load arguments at startup, like cosmo_args() [1], if you'd like to run the Python binary as a specific program. For example, you could set the startup arguments to `-m datasette`.

    [1]: https://github.com/jart/cosmopolitan/commit/4e9566cd3328626d...