this post was submitted on 08 Feb 2024
40 points (97.6% liked)

Linux

48051 readers
838 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

With modern CPU's supposedly shipping with 'AI cores': How long do you think it will take for a proper opensource, privacy respecting productivity tools(Something like whatever M$ copilot is supposed to be?) to be available?

Personally, i would love to see something like 'Passive' OCR integrated with the display server: the ability to pause any video and just select whatever text(even handwritten) there is naturally like it was a text document without any additional hassle will be really useful
Also useful in circumventing any blocks certain websites put on articles to prevent text from being copied

Or an AI grammar checker running natively for LibreOffice.

What are some AI tools you think should be developed for desktop Linux?

top 15 comments
sorted by: hot top controversial new old
[–] savvywolf@pawb.social 16 points 9 months ago (1 children)

Hasn't OCR been around for ages now, and doesn't need dedicated hardware? I think the main limitation is putting the infrastructure in place to allow a browser to speak to an accessibility tool (because this is an accessibility issue) and say "give me all the text on screen which is embedded in images".

Personally, I don't really want any AI tools. I don't want my system trying to preempt what I want to do and half arse it, when I could always just do it myself. I want to know exactly what my system is doing and not have it "helpfully" do or change things it thinks I might want it to.

[–] Artemis_Mystique@lemmy.ml 10 points 9 months ago

I was thinking more along the lines of something that is application agnostic i.e If it is on your display, the tool can grab it

[–] 0x0@social.rocketsfall.net 9 points 9 months ago
[–] sbv@sh.itjust.works 6 points 9 months ago (1 children)

Android's task switcher does this, and it's amazing. I find myself using it all the time.

Meanwhile, OSX has something similar, but it involves more work, so I can't be bothered.

[–] 2xsaiko@discuss.tchncs.de 2 points 9 months ago

Meanwhile, OSX has something similar, but it involves more work, so I can’t be bothered.

If the application behaves, you can directly select text in images. Preview does it, Safari does it (in videos too), Photos does it, the window that comes up after you take a screenshot does it (I guess that's closest to what Android does, in which way is it more work?), to name a few. I'd love this to become a standard on Linux, it's so very useful.

[–] utopiah@lemmy.ml 2 points 9 months ago (2 children)

Like... now? Here are my notes about it https://fabien.benetou.fr/Content/SelfHostingArtificialIntelligence

You don't even need to wait for "AI" chips, "just" a high-end GPU will do.

Sure they are very very large models like Mistral or BLOOM you won't be able to run even on a 4090 (highest end gaming card right now) but there usually have lower quality versions that might give usable result.

IMHO though what I realized while testing all that at home is... it's rarely worth it. It's absolutely fun to play with, even interesting to learn about it all, but in terms of time/energy/ecology/costs versus result, so far it's been "meh". A cool experiment, like locally get transcript for my PeerTube server from the audio of my videos, but something that in fine I always end up not relying on.

It also allows me to do cool prototype, like code generation in XR, but again that's something I'd qualify as fun, not as productive.

TL;DR: it's feasible today but IMHO not worth it.

PS: best example would be Immich with it's optional ML, locally or not (as in serving content on a small Pi but doing the ML inference on your desktop)

[–] Artemis_Mystique@lemmy.ml 2 points 9 months ago (1 children)

you don’t even need to wait for “AI” chips, “just” a high-end GPU will do

Not everyone wants or can afford an expensive GPU, meanwhile the new AMD 8000G series looks highly compelling and I was just curious whether there are any roadmaps to productively incorporate their use on the Linux desktop in a similar way to what M$ is pushing with co-pilot(Obviously without the corporate surveillance)

If your Cool AI tool requires me to always connect to the internet and agree to a concerning EULA and privacy policies; i think i can live without it

[–] savvywolf@pawb.social 1 points 9 months ago

If I were AMD or Intel I'd absolutely reserve the fancy new buzzword tech for only the highest spec cpus in order to give people a reason to overspend.

I expect only decently high end cpus would have this fancy "AI" tech.

[–] Atemu@lemmy.ml 1 points 9 months ago

You don't even need to wait for "AI" chips, "just" a high-end GPU will do.

You don't even need that. A decently high-end CPU will also work, just a good bit slower of course.

[–] garrett@lemm.ee 2 points 9 months ago

FOSS apps (all on Flathub)

Some of the AI related apps I've been using that are both Free Software and offline (where it runs on your computer without using network services in the cloud) are:

  • OCR: "Frog" can take screenshots, select images, accept drag and drop, and you can paste an image from the clipboard. It'll read the text on the images and immediately have a text area with the result. https://flathub.org/apps/com.github.tenderowl.frog — it's powered by Tesseract. Note: The completely optional text-to-speech that Frog has does use an online service. But the rest is offline.

  • Speech to text: "Speech Note" does text to speech, speech to text, and translations... all locally on your computer, and it supports GPU acceleration (which isn't needed, but it makes it a little faster). https://flathub.org/apps/net.mkiol.SpeechNote — This is basically the all-in-one "Swiss army knife" of ML text processing. Thanks to being a Flatpak, you don't have to do anything special for the dependencies. It's all taken care of for you. It also has tons of different models (for different voices, different backends) all available from within the UI, which just needs a click for downloading.

  • Upscaling images: There are two that do something similar, using some of the same backends. A nice and simple one is "Upscaler". https://flathub.org/apps/io.gitlab.theevilskeleton.Upscaler Another one that's cross platform is "Upscayl" https://flathub.org/apps/org.upscayl.Upscayl — these both use ESRGAN and Waifu2x in the background.

  • Closed captioning: "Live Captions" uses an ML model to transcribe text realtime. It's wonderful for when a video doesn't have subtitles, or when you're participating in a video call (which might also not have CC). There's also a toggle mode that will transcribe based on microphone input. The default is to use system audio. https://flathub.org/apps/net.sapples.LiveCaptions

  • Web page translations: Firefox, for the past few releases, has the ability to translate web pages completely local in-browser. It does need to download a small model file (a quantized one around 20 megabytes per language pair), but this happens automatically on first use. All you need to do is click the translate icon (when it's auto-detected) or go to the menu and select "Translate page...". Firefox is located in your distribution already (and is usually installed by default in most Linux distributions) and is available as an official package from Mozilla on Flathub as well. Newer versions keep improving on this, improving speed (it's pretty quick already), improving accuracy, improving reliability (sometimes you have to try to translate a couple of times on some pages), and adding languages. But what's there in the release of Firefox is already great.

Chat and image generation (more advanced)

While all the above are graphical apps and on Flathub (some may have distro packages too), there are some additional AI/ML things you can run on Linux as well:

  • Chat ML: "Ollama" (https://ollama.ai/) is a friendlier wrapper around llama.cpp and lets you run a variety of models (some FOSS, some just source-available-and-gratis, some not at all).

You can run Ollama in a container to make it even easier. Even a Podman container on your user account works. (You don't need to set it up as a system container.) The instructions for Docker work on Podman (just swap the docker command for podman instead).

While the official instructions only list CPU (which is fine for some of the smaller models) and NVidia, it's also possible to use an AMD GPU too:

# Enable device as user (run once per boot)
sudo setsebool container_use_devices=true

# Set up the ollama server for AMD acceleration (run once per session)
podman run --pull=always --replace --detach --device /dev/kfd --device /dev/dri --group-add video -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:0.1.22-rocm

# Command-line interaction (run any time you want to use it — the last part is which model you want to use)
podman exec -it ollama ollama run llama2

llama2 is the default ML; there are so many others available. Mixtral is a good one if you have enough vram on your GPU. Whatever you specify, it will auto-download and set it up for you. You only need to wait the first time. (The ROCm version of takes a while to download. Each model varies. The good thing is, it's all cached for subsequent uses.)

If you want a web UI like ChatGPT, then you could also run this instead of the command line interaction command:

podman run -d --replace -p 3000:8080 --add-host=host.docker.internal:host-gateway -v ollama-webui:/app/backend/data --name ollama-webui ghcr.io/ollama-webui/ollama-webui:main

...and visit http://localhost:3000/

When done, run podman stop ollama and podman stop ollama-webui to free up resources from your GPU.

There are also integrations for text editors and IDEs, similar to GitHub's CoPilot. Neovim has a few already. VS Code (or VS Codium) has some too (like twinny and privy).

  • Image generation: "Stable Diffusion" is the go-to here. There are a bunch of forks. Some of the better ones are:

Krita, GIMP, and Blender all have plugins that can interface with some of these too (usually using a SD Automatic111 API).

For Stable Diffusion on AMD, you need to have ROCm installed and might need to set or use an environment variable to make it work with your card. Something like: HSA_OVERRIDE_GFX_VERSION=11.0.0 or HSA_OVERRIDE_GFX_VERSION=10.3.0 (depending on your GPU). Prefixing means just putting that at the beginning of the the command with a space and then the rest of the command. Setting it as a variable depends on your shell. You might need to export it for some (like for bash). Prefixing it is fine though, especially when you use ctrl+r to do a substrang search in your shell history (so you don't need to retype it or remember silly-long commands).

As using these image generating apps pulls down a lot of Python libraries, I'd suggest considering setting up a separate user account instead of using your own, so the app doesn't have access to your local files (like stuff in ~/.ssh/, ~/.local/, your documents, etc.). Setting up containers for these is not so easy (yet), sadly. Some people have done it. And they do run in a toolbox or distrobox podman container... but toolbox and distrobox containers don't really contain so much, so you're better off using podman (with a "docker" container) directly or running it as a separate account for some type of isolation from your user account files.

Everything else above is at least contained (via containers or Flatpak) to some degree... but stuff locally via pip installs can do anything. And it's not just hypothetical either, for example: PyTorch nightly was compromised for a few days on Christmas of 2022.

There are some graphical apps on Flathub for connecting to Stable Diffusion and a ChatGPT AI (which ollama now has)... but in the course of setting them up, you basically have a web and/or text-based UI to interact with.

[–] vintageballs@feddit.de 2 points 9 months ago

An all-encompassing assistant will probably be a ways off. But LLM-based tools that can process visual inputs are already available to the general customer, e.g. LLava.

[–] TheEntity@kbin.social 2 points 9 months ago (1 children)

You can already use Tesseract to run OCR on any image. It's a matter of tying it together with a screenshot tool with cropping capabilities and it should be very easy to use.

[–] utopiah@lemmy.ml 2 points 9 months ago (1 children)

I've done a bash script and a KDE shortcut for that a while ago. I didn't even remember it until now. It's useful sometimes.

[–] utopiah@lemmy.ml 2 points 9 months ago* (last edited 9 months ago)

FWIW :

fabien@fabien-CORSAIR-ONE-i160:~$ cat /home/fabien/bin/screenocr #!/bin/bash

spectacle -r -nb -o /tmp/test.png
tesseract -l eng /tmp/test.png /tmp/ocr
#date +%s >> ~/grab_timed
#cat /tmp/ocr.txt >> ~/grab_timed
firefox --new-tab --url https://duckduckgo.com/?q="$(cat /tmp/ocr.txt)"

PS: was curious about it, done that in August 2022

[–] bionicjoey@lemmy.ca 1 points 9 months ago

AI chips are optimized for running large models right? They aren't needed to do simple stuff if you have a decent CPU/GPU.