Git Product home page Git Product logo

comfyui-llama's Introduction

Llama for ComfyUI

Description

What This Is

Llama for ComfyUI is a tool that allows you to run language learning models (LLMs) within ComfyUI. Sort of a glue to take a cool AI tool from one place and let us use it somewhere else.

Where This Fits

  • LLMs are files that store an AI that can read and write text.
  • llama-cpp is a command line program that lets us use LLMs that are stored in the GGUF file format from huggingface.co
  • llama-cpp-python lets us use llama.cpp in Python.
  • stable diffusion is a command line program that lets us use image generation AI models.
  • ComfyUI-Manager lets us use Stable Diffusion using a flow graph layout.
  • So ComfyUI-Llama (that's us!)lets us use LLMs in ComfyUI.

Why I Made This

  • I wanted to integrate text generation and image generation AI in one interface and see what other people can come up with to use them.

Features:

  • Currently let's you easily load GGUF models in a consistent fashion with other ComfyUI models and can use them to generate strings of output text with seemingly correct seeding and temperature.

  • Works well with ComfyUI-Custom-Scripts and using the ShowText Node to get output from the LLM.

Upcoming Features:

  • Intend to discover how to improve interactivity so you can get a dialogue going

Installation

What you need first:

Highly Recommended

Steps if using Comfy Manager:

  1. Visit your Install Custom Nodes page, and search for ComfyUI-Llama.
  2. Hit Install and restart when prompted.
  3. Copy your GGUF files into ./ComfyUI/custom_nodes/ComfyUI-Llama/models/*
  4. Hit Ctrl+F5 to hard reload the browser window.
  5. The nodes should be in the LLM menu.

Steps if installing manually:

  1. Clone this repo into custom_nodes folder.
  2. Install llama-cpp-python.
  3. Copy your GGUF files into ./ComfyUI/custom_nodes/ComfyUI-Llama/models/*
  4. Hit Ctrl+F5 to hard reload the browser window.
  5. The nodes should be in the LLM menu.

If you can't install:

Either post an issue on github, or ask on Element in Comfy's channel

Usage

Instructions:

  1. Download GGUF language learning models, which can be found on HuggingFace. You will need at least 1. Different models produce different results.

  2. Place models in ComfyUI/custom_nodes/ComfyUI-Llama/models. They can be renamed if you want.

  3. Fire up/Restart ComfyUI and allow it to finish restarting.

  4. Hit Ctrl+F5 to ensure the browser is refreshed.

  5. Check your ComfyUI available nodes and find the LLM menu.

  6. Load LLM Model Basic

This is a simplified call of this: llama-cpp-python's init method

  1. Call LLM Model Basic

This is a simplified call of this:

llama-cpp-python's call method

If you get errors:

Either post an issue on github, or ask on Element in Comfy's channel

Examples

Example 1 shows the two most basic nodes in their simplest setup. The call node will output the results as a string. You would have to use a custom node to show text. If you don't have one, I would suggest using ComfyUI-Custom-Script's ShowText node.

image

Example 2 shows a slightly more advanced configuration that suggests changes to human written python code. This is just one of several workflow tools that I have at my disposal.

image

See the documentation for llama-cpp-python on that interface

For Possible Contributors

Known Issues

  • Load Model Advanced's kwargs, and chathandler are disabled

  • Call Advanced's stream, logprobs, stop, stopping_criteria, logits_processor, logits_bias, grammar are disabled

  • Create Completion's stream, logprobs, stop, stopping_criteria, logits_processor, logits_bias, grammar are disabled

  • Create Embedding method is disabled

  • Generate is disabled

  • Create Chat Completion is disabled

  • Llava has not been implemented yet

  • No known way to loopback output from an LLM model repeatedly.

    This may be resolved by using ComfyUI-Custom-Scripts and using the Repeater Node, but it's as of yet a WIP.

  • Haven't widely tested strange abuses of inputs.

  • Error handling and logging is still not mature.

Conclusion

We appreciate your interest in Llama for ComfyUI. Feel free to explore and provide feedback or report any issues you encounter. Your contributions and suggestions are valuable to the project.

comfyui-llama's People

Contributors

daniel-lewis-ab avatar comfy-pr-bot avatar

Stargazers

 avatar Sunder Jagannathan avatar Markus Rauhalahti avatar  avatar Amit Karamchandani Batra avatar  avatar Sam avatar  avatar Nguyễn Lê Minh avatar Jefferson Phillips avatar  avatar Alexander Solsmed avatar Jean-Philippe Deblonde avatar  avatar Taylor Sly avatar Magnus Rasmussen avatar  avatar another-ai avatar hua(Kungfu) avatar  avatar  avatar  avatar  avatar Jiahao Wu avatar K Mills avatar Martin avatar  avatar  avatar  avatar  avatar Shmuel Ronen avatar VALADI K JAGANATHAN avatar Cesarkon avatar  avatar  avatar Lennart Isaksson avatar Paragoner avatar sudo avatar POM avatar  avatar

Watchers

Rahul Y Gupta avatar Omar B9 avatar  avatar Kostas Georgiou avatar Lennart Isaksson avatar

comfyui-llama's Issues

The GPU is not working when processing

Thank you very much for this important development that makes it possible to create a conversation from ComfyUI with LLM's locally. I really appreciate it.

I made some test that work fine. But the response time is relatively long, and the GPU is not activated during processing.
Is there a reason for this?

Llama.generate: prefix-match hit

llama_print_timings: load time = 26092.83 ms
llama_print_timings: sample time = 7.91 ms / 60 runs ( 0.13 ms per token, 7588.21 tokens per second)
llama_print_timings: prompt eval time = 0.00 ms / 1 tokens ( 0.00 ms per token, inf tokens per second)
llama_print_timings: eval time = 10629.36 ms / 60 runs ( 177.16 ms per token, 5.64 tokens per second)
llama_print_timings: total time = 10785.96 ms / 61 tokens
100%|████████████████████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00, 3.85it/s]
Prompt executed in 16.62 seconds

The model: mistral-7b-instruct-v0.2.Q8_0.gguf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.