@@ -133,8 +133,9 @@ struct FluxModel : public DiffusionModel {
133133
134134 FluxModel (ggml_backend_t backend,
135135 std::map<std::string, enum ggml_type>& tensor_types,
136- bool flash_attn = false )
137- : flux(backend, tensor_types, " model.diffusion_model" , flash_attn) {
136+ SDVersion version = VERSION_FLUX,
137+ bool flash_attn = false )
138+ : flux(backend, tensor_types, " model.diffusion_model" , version, flash_attn) {
138139 }
139140
140141 void alloc_params_buffer () {
@@ -178,4 +179,54 @@ struct FluxModel : public DiffusionModel {
178179 }
179180};
180181
182+ struct LTXModel : public DiffusionModel {
183+ Ltx::LTXRunner ltx;
184+
185+ LTXModel (ggml_backend_t backend,
186+ std::map<std::string, enum ggml_type>& tensor_types,
187+ bool flash_attn = false )
188+ : ltx(backend, tensor_types, " model.diffusion_model" ) {
189+ }
190+
191+ void alloc_params_buffer () {
192+ ltx.alloc_params_buffer ();
193+ }
194+
195+ void free_params_buffer () {
196+ ltx.free_params_buffer ();
197+ }
198+
199+ void free_compute_buffer () {
200+ ltx.free_compute_buffer ();
201+ }
202+
203+ void get_param_tensors (std::map<std::string, struct ggml_tensor *>& tensors) {
204+ ltx.get_param_tensors (tensors, " model.diffusion_model" );
205+ }
206+
207+ size_t get_params_buffer_size () {
208+ return ltx.get_params_buffer_size ();
209+ }
210+
211+ int64_t get_adm_in_channels () {
212+ return 768 ;
213+ }
214+
215+ void compute (int n_threads,
216+ struct ggml_tensor * x,
217+ struct ggml_tensor * timesteps,
218+ struct ggml_tensor * context,
219+ struct ggml_tensor * c_concat,
220+ struct ggml_tensor * y,
221+ struct ggml_tensor * guidance,
222+ int num_video_frames = -1 ,
223+ std::vector<struct ggml_tensor *> controls = {},
224+ float control_strength = 0 .f,
225+ struct ggml_tensor ** output = NULL ,
226+ struct ggml_context * output_ctx = NULL ,
227+ std::vector<int > skip_layers = std::vector<int >()) {
228+ return ltx.compute (n_threads, x, timesteps, context, y, output, output_ctx, skip_layers);
229+ }
230+ };
231+
181232#endif
0 commit comments