Nodes/ComfyUI_Llama3_8B/Local_Or_Repo_Choice
ComfyUI Node

Local_Or_Repo_Choice

The Little Router That Feeds Every Other Node in This Pack

By smthemex·Created 2 years ago·Updated 2 years ago· 27
Local_Or_Repo_Choice
    • repo_id
    local_model_path
    repo_idTHUDM/cogvlm2-llama3-chat-19B

    This is the pack's plumbing. It doesn't generate anything - it picks a model and hands the choice to the other three nodes. One dropdown, one text box, one string output. That's the whole job, and it's worth understanding because it solves a real annoyance: deciding between a Llama you've already downloaded and a HuggingFace repo_id, without hardcoding paths into every workflow.

    What it actually does

    The node scans your ComfyUI models/diffusers folder and builds a dropdown of every model directory it finds - specifically, folders containing a model.safetensors.index.json, which is the sharded-safetensors marker. Pick one from the local_model_path dropdown and it resolves the full absolute path for you. Or, leave the dropdown alone and type a repo_id; if the repo_id box has anything in it, that wins and the node just normalizes it (forward slashes on Windows, which this author is clearly fond of).

    The output is a STRING named repo_id, and it's meant to feed the repo_id input on Meta_Llama3_8B, ChatQA_1p5_8b, or MiniCPM_Llama3_V25 - all three declare that input as forceInput, which is ComfyUI's way of inviting exactly this. So the pattern is: router node → model node → your prompt slot.

    There's a genuine gotcha in the default. The repo_id box comes pre-filled with THUDM/cogvlm2-llama3-chat-19B - a 19B vision model that has nothing to do with this pack and isn't in the README's supported list. It's copy-paste leftovers from the author's other work. Change it, or the node will cheerfully route a 19B CogVLM into your 8B pack nodes.

    The inputs, honestly

    • local_model_path - a dropdown of models found in models/diffusers. If that folder's empty or nothing there has the sharded index file, you get a placeholder entry: no llama3 model in default diffusers directory.
    • repo_id - the text fallback. Empty + no local model = error. No / in it = error (that's the node's format check).

    Two error-handling quirks from reading the source. First, those error paths do raise "a string" - which Python 3 refuses, so instead of a clean message you'll get a TypeError: exceptions must derive from BaseException in the console. It's a broken error message, not a broken idea: the fix is just to give it a repo_id or a local model. Second, remember the dropdown only lists models with a sharded index file - a single-file .safetensors plus config in your diffusers folder won't show up. Either shard it or type its repo path manually.

    The rest is pack-level

    Install once for all four nodes: ComfyUI Manager → search ComfyUI_Llama3_8B → install → restart, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/smthemex/ComfyUI_Llama3_8B
    

    No requirements.txt ships, so transformers has to already be in your ComfyUI environment or the whole pack fails to register. If you'd rather skip this node entirely, you can - every generation node takes repo_id directly, and the README's "fill in a local absolute path and go" workflow works fine without the router. This node just saves you from typing X:/meta-llama/Meta-Llama-3-8B-Instruct into four separate workflows. For a 2024 hobbyist pack with no updates since its one commit, that's a thoughtful little convenience.

    CategoryMeta_Llama3

    Inputs (2)

    NameTypeDefaultDescription
    local_model_pathCOMBO1 options: no llama3 model in default diffusers directory
    repo_idSTRINGTHUDM/cogvlm2-llama3-chat-19B

    Outputs (1)

    NameTypeDescription
    repo_idSTRING