3

GitHub - go-skynet/LocalAI: Self-hosted, community-driven, local OpenAI-compatib...

 11 months ago
source link: https://github.com/go-skynet/LocalAI
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


233147843-88697415-6dbf-4368-a862-ab217f9f7342.jpeg


LocalAI

LocalAI is a drop-in replacement REST API that’s compatible with OpenAI API specifications for local inferencing. It allows you to run LLMs (and not only) locally or on-prem with consumer grade hardware, supporting multiple model families that are compatible with the ggml format. Does not require GPU.

For a list of the supported model families, please see the model compatibility table.

In a nutshell:

  • Local, OpenAI drop-in alternative REST API. You own your data.
  • NO GPU required. NO Internet access is required either. Optional, GPU Acceleration is available in llama.cpp-compatible LLMs. See building instructions.
  • Supports multiple models, Audio transcription, Text generation with GPTs, Image generation with stable diffusion (experimental)
  • Once loaded the first time, it keep models loaded in memory for faster inference
  • Doesn't shell-out, but uses C++ bindings for a faster inference and better performance.

LocalAI was created by Ettore Di Giacinto and is a community-driven project, focused on making the AI accessible to anyone. Any contribution, feedback and PR is welcome!

ChatGPT OSS alternative Image generation
Screenshot from 2023-04-26 23-59-55

See the Getting started and examples sections to learn how to use LocalAI. For a list of curated models check out the model gallery.

For latest news, follow also on Twitter @LocalAI_API and @mudler_it

Contribute and help

To help the project you can:

  • Upvote the Reddit post about LocalAI.

  • Hacker news post - help us out by voting if you like this project.

  • If you have technological skills and want to contribute to development, have a look at the open issues. If you are new you can have a look at the good-first-issue and help-wanted labels.

  • If you don't have technological skills you can still help improving documentation or add examples or share your user-stories with our community, any help and contribution is welcome!

Usage

Check out the Getting started section. Here below you will find generic, quick instructions to get ready and use LocalAI.

The easiest way to run LocalAI is by using docker-compose (to build locally, see building LocalAI):

git clone https://github.com/go-skynet/LocalAI

cd LocalAI

# (optional) Checkout a specific LocalAI tag
# git checkout -b build <TAG>

# copy your models to models/
cp your-model.bin models/

# (optional) Edit the .env file to set things like context size and threads
# vim .env

# start with docker-compose
docker-compose up -d --pull always
# or you can build the images with:
# docker-compose up -d --build

# Now API is accessible at localhost:8080
curl http://localhost:8080/v1/models
# {"object":"list","data":[{"id":"your-model.bin","object":"model"}]}

curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
     "model": "your-model.bin",            
     "prompt": "A long time ago in a galaxy far, far away",
     "temperature": 0.7
   }'

Example: Use GPT4ALL-J model


git clone https://github.com/go-skynet/LocalAI

 LocalAI





wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j


cp -rf prompt-templates/ggml-gpt4all-j.tmpl models/





docker-compose up -d --pull always



curl http://localhost:8080/v1/models


curl http://localhost:8080/v1/chat/completions -H  -d 





Build locally

See the build section in our documentation for detailed instructions.

Run LocalAI in Kubernetes

LocalAI can be installed inside Kubernetes with helm. See installation instructions.

Supported API endpoints

See the list of the supported API endpoints and how to configure image generation and audio transcription.

Frequently asked questions

See the FAQ section for a list of common questions.

Projects already using LocalAI to run local models

Feel free to open up a PR to get your project listed!

Short-term roadmap

  • Mimic OpenAI API (#10)
  • Binary releases (#6)
  • Upstream our golang bindings to llama.cpp (ggerganov/llama.cpp#351) and gpt4all
  • Multi-model support
  • Have a webUI!
  • Allow configuration of defaults for models.
  • Support for embeddings
  • Support for audio transcription with https://github.com/ggerganov/whisper.cpp
  • GPU/CUDA support ( #69 )
  • Enable automatic downloading of models from a curated gallery, with only free-licensed models, directly from the webui.

Star history

LocalAI Star history Chart

License

LocalAI is a community-driven project created by Ettore Di Giacinto.

Author

Ettore Di Giacinto and others

Acknowledgements

LocalAI couldn't have been built without the help of great software already available from the community. Thank you!

Contributors

68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d676f2d736b796e65742f4c6f63616c4149


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK