1
0
Fork 0

feat(api): add section to extras file for additional networks

This commit is contained in:
Sean Sube 2023-03-18 07:40:57 -05:00
parent c3979246df
commit e3bf04ab8f
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 63 additions and 9 deletions

View File

@ -208,6 +208,23 @@ def convert_models(ctx: ConversionContext, args, models: Models):
except Exception:
logger.exception("error fetching source %s", name)
if args.networks and "networks" in models:
for network in models.get("networks"):
name = network["name"]
if name in args.skip:
logger.info("skipping network: %s", name)
else:
network_format = source_format(network)
network_type = network["type"]
source = network["source"]
try:
dest = fetch_model(ctx, name, source, dest=path.join(ctx.model_path, network_type), format=network_format)
logger.info("finished downloading network: %s -> %s", source, dest)
except Exception:
logger.exception("error fetching network %s", name)
if args.diffusion and "diffusion" in models:
for model in models.get("diffusion"):
model = tuple_to_diffusion(model)

View File

@ -13,7 +13,7 @@ from logging import getLogger
from os import mkdir, path
from pathlib import Path
from shutil import rmtree
from typing import Dict
from typing import Dict, Tuple
import torch
from diffusers import (

View File

@ -10,7 +10,20 @@ $defs:
- type: number
- type: string
textual_inversion:
lora_network:
type: object
required: [name, source]
properties:
name:
type: string
source:
type: string
label:
type: string
weight:
type: number
textual_inversion_network:
type: object
required: [name, source]
properties:
@ -25,6 +38,8 @@ $defs:
type: string
token:
type: string
weight:
type: number
base_model:
type: object
@ -58,7 +73,11 @@ $defs:
inversions:
type: array
items:
$ref: "#/$defs/textual_inversion"
$ref: "#/$defs/textual_inversion_network"
loras:
type: array
items:
$ref: "#/$defs/lora_network"
vae:
type: string
@ -82,6 +101,21 @@ $defs:
source:
type: string
source_network:
type: object
required: [name, source, type]
properties:
format:
type: string
enum: [ckpt, safetensors]
name:
type: string
source:
type: string
type:
type: string
enum: [inversion, lora]
translation:
type: object
additionalProperties: False
@ -106,12 +140,9 @@ properties:
oneOf:
- $ref: "#/$defs/legacy_tuple"
- $ref: "#/$defs/correction_model"
upscaling:
networks:
type: array
items:
oneOf:
- $ref: "#/$defs/legacy_tuple"
- $ref: "#/$defs/upscaling_model"
items: "#/$defs/source_network"
sources:
type: array
items:
@ -123,4 +154,10 @@ properties:
additionalProperties: False
patternProperties:
"^\\w\\w$":
$ref: "#/$defs/translation"
$ref: "#/$defs/translation"
upscaling:
type: array
items:
oneOf:
- $ref: "#/$defs/legacy_tuple"
- $ref: "#/$defs/upscaling_model"