Remove more files no longer needed in main

This commit is contained in:
Brandon Rising 2023-07-27 10:49:43 -04:00
parent 57271ad125
commit f7bb4c3f05
13 changed files with 67 additions and 74 deletions

View File

@ -222,9 +222,6 @@ class LoraLoaderInvocation(BaseInvocation):
base_model = self.lora.base_model base_model = self.lora.base_model
lora_name = self.lora.model_name lora_name = self.lora.model_name
# TODO: ui rewrite
base_model = BaseModelType.StableDiffusion1
if not context.services.model_manager.model_exists( if not context.services.model_manager.model_exists(
base_model=base_model, base_model=base_model,
model_name=lora_name, model_name=lora_name,

View File

@ -275,8 +275,8 @@ class DiffusersModel(ModelBase):
) )
break break
except Exception as e: except Exception as e:
# print("====ERR LOAD====") #print("====ERR LOAD====")
# print(f"{variant}: {e}") #print(f"{variant}: {e}")
pass pass
else: else:
raise Exception(f"Failed to load {self.base_model}:{self.model_type}:{child_type} model") raise Exception(f"Failed to load {self.base_model}:{self.model_type}:{child_type} model")

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import{A as m,fT as Ze,z as y,a4 as Xa,fU as Ya,af as va,aj as d,fV as b,fW as t,fX as Ka,fY as h,fZ as ua,f_ as Za,f$ as Ja,aI as Qa,g0 as et,ad as rt,g1 as at}from"./index-a692ba97.js";import{s as fa,n as o,t as tt,o as ha,p as ot,q as ma,v as ga,w as ya,x as it,y as Sa,z as pa,A as xr,B as nt,D as lt,E as st,F as xa,G as $a,H as ka,J as dt,K as _a,L as ct,M as bt,N as vt,O as ut,Q as wa,R as ft,S as ht,T as mt,U as gt,V as yt,W as St,e as pt,X as xt}from"./MantineProvider-2dec55af.js";var za=String.raw,Ca=za` import{A as m,fT as Ze,z as y,a4 as Xa,fU as Ya,af as va,aj as d,fV as b,fW as t,fX as Ka,fY as h,fZ as ua,f_ as Za,f$ as Ja,aI as Qa,g0 as et,ad as rt,g1 as at}from"./index-b3976531.js";import{s as fa,n as o,t as tt,o as ha,p as ot,q as ma,v as ga,w as ya,x as it,y as Sa,z as pa,A as xr,B as nt,D as lt,E as st,F as xa,G as $a,H as ka,J as dt,K as _a,L as ct,M as bt,N as vt,O as ut,Q as wa,R as ft,S as ht,T as mt,U as gt,V as yt,W as St,e as pt,X as xt}from"./MantineProvider-7778b895.js";var za=String.raw,Ca=za`
:root, :root,
:host { :host {
--chakra-vh: 100vh; --chakra-vh: 100vh;

View File

@ -12,7 +12,7 @@
margin: 0; margin: 0;
} }
</style> </style>
<script type="module" crossorigin src="./assets/index-a692ba97.js"></script> <script type="module" crossorigin src="./assets/index-b3976531.js"></script>
</head> </head>
<body dir="ltr"> <body dir="ltr">

View File

@ -1,17 +0,0 @@
import { BaseModelType, MainModelField, ModelType } from 'services/api/types';
/**
* Crudely converts a model id to a main model field
* TODO: Make better
*/
export const modelIdToMainModelField = (modelId: string): MainModelField => {
const [base_model, model_type, model_name] = modelId.split('/');
const field: MainModelField = {
base_model: base_model as BaseModelType,
model_type: model_type as ModelType,
model_name,
};
return field;
};

View File

@ -1,17 +0,0 @@
import { BaseModelType, OnnxModelField, ModelType } from 'services/api/types';
/**
* Crudely converts a model id to a main model field
* TODO: Make better
*/
export const modelIdToOnnxModelField = (modelId: string): OnnxModelField => {
const [base_model, model_type, model_name] = modelId.split('/');
const field: OnnxModelField = {
base_model: base_model as BaseModelType,
model_name,
model_type: model_type as ModelType,
};
return field;
};

View File

@ -19,7 +19,6 @@ import {
useGetMainModelsQuery, useGetMainModelsQuery,
useGetOnnxModelsQuery, useGetOnnxModelsQuery,
} from 'services/api/endpoints/models'; } from 'services/api/endpoints/models';
import { modelIdToOnnxModelField } from 'features/nodes/util/modelIdToOnnxModelField';
import { NON_REFINER_BASE_MODELS } from 'services/api/constants'; import { NON_REFINER_BASE_MODELS } from 'services/api/constants';
import { useFeatureStatus } from '../../../../system/hooks/useFeatureStatus'; import { useFeatureStatus } from '../../../../system/hooks/useFeatureStatus';
@ -39,7 +38,9 @@ const ParamMainModelSelect = () => {
const { data: mainModels, isLoading } = useGetMainModelsQuery( const { data: mainModels, isLoading } = useGetMainModelsQuery(
NON_REFINER_BASE_MODELS NON_REFINER_BASE_MODELS
); );
const { data: onnxModels, isLoading: onnxLoading } = useGetOnnxModelsQuery(); const { data: onnxModels, isLoading: onnxLoading } = useGetOnnxModelsQuery(
NON_REFINER_BASE_MODELS
);
const activeTabName = useAppSelector(activeTabNameSelector); const activeTabName = useAppSelector(activeTabNameSelector);
@ -101,11 +102,7 @@ const ParamMainModelSelect = () => {
return; return;
} }
let newModel = modelIdToMainModelParam(v); const newModel = modelIdToMainModelParam(v);
if (v.includes('onnx')) {
newModel = modelIdToOnnxModelField(v);
}
if (!newModel) { if (!newModel) {
return; return;

View File

@ -229,10 +229,7 @@ export const generationSlice = createSlice({
const { image_name, width, height } = action.payload; const { image_name, width, height } = action.payload;
state.initialImage = { imageName: image_name, width, height }; state.initialImage = { imageName: image_name, width, height };
}, },
modelChanged: ( modelChanged: (state, action: PayloadAction<MainModelParam | null>) => {
state,
action: PayloadAction<MainModelParam | OnnxModelField | null>
) => {
state.model = action.payload; state.model = action.payload;
if (state.model === null) { if (state.model === null) {

View File

@ -236,6 +236,11 @@ export const zMainModel = z.object({
* Type alias for model parameter, inferred from its zod schema * Type alias for model parameter, inferred from its zod schema
*/ */
export type MainModelParam = z.infer<typeof zMainModel>; export type MainModelParam = z.infer<typeof zMainModel>;
/**
* Type alias for model parameter, inferred from its zod schema
*/
export type OnnxModelParam = z.infer<typeof zMainModel>;
/** /**
* Validates/type-guards a value as a model parameter * Validates/type-guards a value as a model parameter
*/ */

View File

@ -0,0 +1,31 @@
import { logger } from 'app/logging/logger';
import {
OnnxModelParam,
zMainModel,
} from 'features/parameters/types/parameterSchemas';
export const modelIdToOnnxModelParam = (
mainModelId: string
): OnnxModelParam | undefined => {
const log = logger('models');
const [base_model, model_type, model_name] = mainModelId.split('/');
const result = zMainModel.safeParse({
base_model,
model_name,
model_type,
});
if (!result.success) {
log.error(
{
mainModelId,
errors: result.error.format(),
},
'Failed to parse main model id'
);
return;
}
return result.data;
};