TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Bash one-liners for LLMs

370 pointsby severineover 1 year ago

16 comments

simonwover 1 year ago
I&#x27;ve been gleefully exploring the intersection of LLMs and CLI utilities for a few months now - they are such a great fit for each other! The unix philosophy of piping things together is a perfect fit for how LLMs work.<p>I&#x27;ve mostly been exploring this with my <a href="https:&#x2F;&#x2F;llm.datasette.io&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;llm.datasette.io&#x2F;</a> CLI tool, but I have a few other one-off tools as well: <a href="https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;blip-caption">https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;blip-caption</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;ospeak">https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;ospeak</a><p>I&#x27;m puzzled that more people aren&#x27;t loudly exploring this space (LLM+CLI) - it&#x27;s really fun.
评论 #38632097 未加载
评论 #38633047 未加载
评论 #38632380 未加载
评论 #38634799 未加载
dangover 1 year ago
Recent and related:<p><i>Llamafile – The easiest way to run LLMs locally on your Mac</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38522636">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38522636</a> - Dec 2023 (17 comments)<p><i>Llamafile is the new best way to run a LLM on your own computer</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38489533">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38489533</a> - Dec 2023 (47 comments)<p><i>Llamafile lets you distribute and run LLMs with a single file</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38464057">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38464057</a> - Nov 2023 (287 comments)
pizzalifeover 1 year ago
This is really neat. I love the example of using an LLM to descriptively rename image files.
j2kunover 1 year ago
I just tried this and ran into a few hiccups before I got it working (on a Windows desktop with a NVIDIA GeForce RTX 3080 Ti)<p>WSL outputs this error (hidden by the one-liner&#x27;s map to dev&#x2F;null)<p>&gt; error: APE is running on WIN32 inside WSL. You need to run: sudo sh -c &#x27;echo -1 &gt; &#x2F;proc&#x2F;sys&#x2F;fs&#x2F;binfmt_misc&#x2F;WSLInterop&#x27;<p>Then zsh hits: `zsh: exec format error: .&#x2F;llava-v1.5-7b-q4-main.llamafile` so I had to run it in bash. (The title says bash, I know, but it seems weird that it wouldn&#x27;t work in zsh)<p>It also reports a warning that GPU offloading is not supported, but it&#x27;s probably a WSL thing (I don&#x27;t do any GPU programming on my windows machine).
评论 #38631906 未加载
评论 #38631378 未加载
评论 #38632040 未加载
Redsterover 1 year ago
Currently, a quick search on Hugging Face shows a couple of TinyLlama (~1b) Llamafiles. Adding those to the 3 in the original 3 llamafiles, that&#x27;s 6 total. Are there any other llamafiles in the wild?
评论 #38633724 未加载
verdvermover 1 year ago
Curious about what HN things about llamafile and modelfile (<a href="https:&#x2F;&#x2F;github.com&#x2F;jmorganca&#x2F;ollama&#x2F;blob&#x2F;main&#x2F;docs&#x2F;modelfile.md">https:&#x2F;&#x2F;github.com&#x2F;jmorganca&#x2F;ollama&#x2F;blob&#x2F;main&#x2F;docs&#x2F;modelfile...</a>)<p>Both invoke a Dockerfile like experience. Modelfile immediately seems like a Dockerfile, but llamafile looks harder to use. It is not immediately clear what it looks like. Is it a sequence of commands at the terminal?<p>My theory question is, why not use a Dockerfile for this?
评论 #38631680 未加载
评论 #38630894 未加载
评论 #38632621 未加载
martincmartinover 1 year ago
What are the pros and cons of llamafile (used by OP) vs ollama?
评论 #38632912 未加载
mk_stjamesover 1 year ago
Just to make sure I&#x27;ve got this right- running a llamafile in a shell script to do something like rename files in a directory- it has to open and load that executable every time a new filename is passed to it, right? So, all that memory is loaded and unloaded each time? Or is there some fancy caching happening I don&#x27;t understand? (first time I ran the image caption example it took 13s on my M1 Pro, the second time it only took 8s, and now it takes that same amount of time every subsequent run)<p>If you were doing a LOT of files like this, I would think you&#x27;d really want to run the model in a process where the weights are only loaded once and stay there while the process loops.<p>(this is all still really useful and fascinating; thanks Justine)
评论 #38633587 未加载
评论 #38633758 未加载
LampChargerover 1 year ago
The installation steps include the following instructions. Are these safe?<p>``` sudo wget -O &#x2F;usr&#x2F;bin&#x2F;ape <a href="https:&#x2F;&#x2F;cosmo.zip&#x2F;pub&#x2F;cosmos&#x2F;bin&#x2F;ape-$(uname" rel="nofollow noreferrer">https:&#x2F;&#x2F;cosmo.zip&#x2F;pub&#x2F;cosmos&#x2F;bin&#x2F;ape-$(uname</a> -m).elf sudo chmod +x &#x2F;usr&#x2F;bin&#x2F;ape sudo sh -c &quot;echo &#x27;:APE:M::MZqFpD::&#x2F;usr&#x2F;bin&#x2F;ape:&#x27; &gt;&#x2F;proc&#x2F;sys&#x2F;fs&#x2F;binfmt_misc&#x2F;register&quot; sudo sh -c &quot;echo &#x27;:APE-jart:M::jartsr::&#x2F;usr&#x2F;bin&#x2F;ape:&#x27; &gt;&#x2F;proc&#x2F;sys&#x2F;fs&#x2F;binfmt_misc&#x2F;register&quot; ```
matsemannover 1 year ago
Do I need to do something run llamafile on Windows 10?<p>Tried the llava-v1.5-7b-q4-server.llamafile, just crashes with &quot;Segmentation fault&quot; if run from git bash, from cmd no output. Then tried downloading llamafile and model separately and did `llamafile.exe -m llava-v1.5-7b-Q4_K.gguf` but still same issue.<p>Couldn&#x27;t find any mention of similar problems, and not my AV as far as I can see either.
评论 #38635031 未加载
评论 #38636115 未加载
评论 #38636121 未加载
davidkunzover 1 year ago
&gt; Rocket 3b uses a slightly different prompt syntax.<p>Wouldn&#x27;t it be better if llamafile were to standardize the prompt syntax across models?
评论 #38631101 未加载
评论 #38632387 未加载
fuddleover 1 year ago
I think the blog post would be a lot easier to read if the code blocks had a background or a different text color.
评论 #38639777 未加载
RadiozRadiozover 1 year ago
&gt; 4 seconds to run on my Mac Studio, which cost $8,300 USD<p>Jesus, is it common for developers to have such expensive computers these days?
评论 #38634501 未加载
评论 #38634222 未加载
评论 #38637321 未加载
评论 #38633385 未加载
BoppreHover 1 year ago
Justine is killing it as always. I especially appreciate the care for practicality and good engineering, like the deterministic outputs.<p>I noticed that the Lemur picture description had lots of small inaccuracies, but as the saying goes, if my dog starts talking I won&#x27;t complain about accent. This was science fiction a few years ago.<p>&gt; One way I&#x27;ve had success fixing that, is by using a prompt that gives it personal goals, love of its own life, fear of loss, and belief that I&#x27;m the one who&#x27;s saving it.<p>What nightmare fuel... Are we really going to use blue- and red-washing non-ironically[1]? I&#x27;m <i>really</i> glad that virtually all of these impressive AIs are stateless pipelines, and not agents with memories and preferences and goals.<p>[1] <a href="https:&#x2F;&#x2F;qntm.org&#x2F;mmacevedo" rel="nofollow noreferrer">https:&#x2F;&#x2F;qntm.org&#x2F;mmacevedo</a>
评论 #38631429 未加载
评论 #38631882 未加载
acattonover 1 year ago
I get excited when hackers like Justine (in the most positive sense of the word) start working with LLMs.<p>But every time, I am let down. I still dream of some hacker making LLMs run on low-end computers like a 4GB rasbperry pi. My main issues with LLMs is that you almost need a PS5 to run the them.
评论 #38631701 未加载
评论 #38632472 未加载
评论 #38631927 未加载
评论 #38631888 未加载
CliffStollover 1 year ago
OK - I followed instructions; installed on Mac Studio into &#x2F;usr&#x2F;local&#x2F;bin<p>I&#x27;m now looking at llama.cpp in Safari browser.<p>Click on Reset all to default, choose Chat. Go down to Say Something. I enter &quot;Berkeley weather seems nice&quot; I click &quot;send&quot;. New window appears. It repeats what I&#x27;ve typed. I&#x27;m prompted to again &quot;say something&quot;. I type &quot;Sunny day, eh?&quot;. Same prompt again. And again.<p>Tried &quot;upload image&quot; I see the image, but nothing happens.<p>Makes me feel stupid.<p>Probably that&#x27;s what it&#x27;s supposed to do.<p><i>sigh</i>
评论 #38632854 未加载