Nodes/Comfyui-Yolov8-JSON/Load Yolov8 Model From Path
ComfyUI Node

Load Yolov8 Model From Path

Load your own fine-tuned YOLO weights instead of the stock dropdown

By prodogape·Created 2 years ago·Updated 2 years ago· 27
Load Yolov8 Model From Path
    • YOLOV8_MODEL
    model_path/ComfyUI/models/yolov8/yolov8l.pt

    Load Yolov8 Model is great until it isn't - and it stops being great the moment you fine-tune a model for your own classes, because its dropdown only knows the ten stock COCO weights. Load Yolov8 Model From Path is the escape hatch: give it a path to any .pt checkpoint and it loads it the same way, letting you run the pack's Apply nodes with a custom-trained detector.

    It's a one-input node. model_path takes a string pointing at a YOLOv8 .pt file. The default is /ComfyUI/models/yolov8/yolov8l.pt, but you can point anywhere - the validation only insists it's an existing .pt file. One subtlety: it also accepts http(s):// URLs, so you can load a checkpoint straight from a download link if you want. And it resolves ComfyUI's path shortcuts through get_annotated_filepath, which is a fancy way of saying you can use the same relative path tricks you'd use in other loaders.

    On Windows, don't blindly keep the leading-slash default - type the full path like D:\ComfyUI\models\yolov8\my-custom.pt. It strips quotes if you wrap the path in them, and it'll raise a clear "not a valid path" error if you typo it, which is friendlier than the average ComfyUI node failure.

    A detail worth knowing

    The node hashes the file's modification time as its change signature (IS_CHANGED). Practical upshot: if you drop a new version of the checkpoint over the same path, ComfyUI re-runs the graph on the next prompt - no cache-stale surprise where you're looking at old detections. If you copy your fine-tune in place of an existing file, the graph just picks it up. That's thoughtful behavior for the iteration loop of "train, test, tweak, retest."

    When to use it

    • You trained a custom model and its weights live somewhere unusual.
    • You want to A/B two checkpoints without copying files into models/yolov8/.
    • The stock dropdown's class list doesn't match your classes.

    Otherwise, the dropdown loader is the better default - it handles the model download for you. This node assumes the file already exists, and it needs a valid path every run.

    Same install as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/prodogape/Comfyui-Yolov8-JSON
    

    plus pip install -r requirements.txt (which brings in ultralytics) and a restart. One thing to keep in mind whether you load stock or custom weights: Ultralytics is AGPL, and that license is generally read as reaching YOLO weights too - fine for personal fine-tuning, worth thinking about before commercial distribution.

    CategoryComfyui-Yolov8-JSON

    Inputs (1)

    NameTypeDefaultDescription
    model_pathSTRING/ComfyUI/models/yolov8/yolov8l.pt

    Outputs (1)

    NameTypeDescription
    YOLOV8_MODELYOLOV8_MODEL