mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-12 11:56:36 +00:00
refactor: split generation pipeline out of stable-diffusion.cpp (#1957)
This commit is contained in:
1 parent
469fc49bb7
commit
14eddb32b1
13 files changed
+6798
-6345
No files matched your search
@@ -0,0 +1,63 @@
|
||||
#ifndef __SD_PIPELINE_MODEL_BUILDERS_H__
|
||||
#define __SD_PIPELINE_MODEL_BUILDERS_H__
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "model.h"
|
||||
#include "stable-diffusion.h"
|
||||
|
||||
class SDBackendManager;
|
||||
struct DeviceResidencyManager;
|
||||
struct Conditioner;
|
||||
struct FrozenCLIPVisionEmbedder;
|
||||
struct DiffusionModelRunner;
|
||||
struct VAE;
|
||||
struct AudioVAERunner;
|
||||
struct ControlNet;
|
||||
struct GenerationExtension;
|
||||
struct GenerationExtensionInitContext;
|
||||
namespace IPAdapter {
|
||||
struct IPAdapterRunner;
|
||||
}
|
||||
|
||||
namespace sd::model_builders {
|
||||
|
||||
struct Context {
|
||||
const sd_ctx_params_t& params;
|
||||
SDVersion version;
|
||||
const String2TensorStorage& tensor_storage_map;
|
||||
SDBackendManager& backends;
|
||||
std::shared_ptr<DeviceResidencyManager> weight_manager;
|
||||
};
|
||||
|
||||
struct CoreRunners {
|
||||
std::shared_ptr<Conditioner> conditioner;
|
||||
std::shared_ptr<DiffusionModelRunner> diffusion;
|
||||
std::shared_ptr<DiffusionModelRunner> high_noise_diffusion;
|
||||
std::shared_ptr<FrozenCLIPVisionEmbedder> clip_vision;
|
||||
std::shared_ptr<IPAdapter::IPAdapterRunner> ip_adapter;
|
||||
};
|
||||
|
||||
struct VAEOptions {
|
||||
bool use_tae = false;
|
||||
bool tae_preview_only = false;
|
||||
bool use_audio_vae = false;
|
||||
bool external_vae_is_invalid = false;
|
||||
};
|
||||
|
||||
struct VAERunners {
|
||||
std::shared_ptr<VAE> vae;
|
||||
std::shared_ptr<VAE> preview;
|
||||
std::shared_ptr<AudioVAERunner> audio;
|
||||
};
|
||||
|
||||
bool build_core_runners(const Context& ctx, CoreRunners& runners);
|
||||
bool build_vae_runners(const Context& ctx, const VAEOptions& options, VAERunners& runners);
|
||||
bool build_control_net_runner(const Context& ctx, std::shared_ptr<ControlNet>& runner);
|
||||
bool build_extension_runners(const GenerationExtensionInitContext& ctx,
|
||||
std::vector<std::shared_ptr<GenerationExtension>>& extensions);
|
||||
|
||||
} // namespace sd::model_builders
|
||||
|
||||
#endif // __SD_PIPELINE_MODEL_BUILDERS_H__
|
||||
Reference in new issue
Block a user