Skip to content

Commit 2b7384d

Browse files
yiming-l21xiao-yu-chen
authored andcommitted
feat: implement initial flux pipeline.
1 parent f146f9a commit 2b7384d

34 files changed

+2333
-397
lines changed

xllm/api_service/image_generation_service_impl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,16 @@ void ImageGenerationServiceImpl::process_async(
8888
request_id = request_params.request_id,
8989
created_time = absl::ToUnixSeconds(absl::Now())](
9090
const DiTRequestOutput& req_output) -> bool {
91+
LOG(INFO) << "into callback before request finished";
92+
LOG(INFO) << req_output.outputs.size();
93+
LOG(INFO) << req_output.outputs[0].image_tensor;
9194
if (req_output.status.has_value()) {
9295
const auto& status = req_output.status.value();
9396
if (!status.ok()) {
9497
return call->finish_with_error(status.code(), status.message());
9598
}
9699
}
97-
100+
LOG(INFO) << "into callback after request finished";
98101
return send_result_to_client_brpc(
99102
call, request_id, created_time, model, req_output);
100103
});

xllm/core/framework/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ cc_library(
5353
model_loader
5454
HDRS
5555
hf_model_loader.h
56+
dit_model_loader.h
5657
model_loader.h
5758
SRCS
5859
hf_model_loader.cpp
60+
dit_model_loader.cpp
5961
model_loader.cpp
6062
DEPS
6163
:common

xllm/core/framework/batch/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ cc_library(
66
NAME
77
batch
88
HDRS
9+
dit_batch.h
910
batch.h
1011
batch_factory.h
1112
batch_input_builder.h
1213
mposition.h
1314
SRCS
15+
dit_batch.cpp
1416
batch.cpp
1517
batch_factory.cpp
1618
batch_input_builder.cpp
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* Copyright 2025 The xLLM Authors. All Rights Reserved.
2+
Copyright 2024 The ScaleLLM Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://github.com/jd-opensource/xllm/blob/main/LICENSE
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
==============================================================================*/
16+
17+
#include "dit_batch.h"
18+
19+
#include <c10/core/DeviceType.h>
20+
#include <torch/torch.h>
21+
22+
#include <vector>
23+
24+
namespace xllm {
25+
26+
DiTForwardInput xllm::DiTBatch::prepare_forward_input() {
27+
DiTForwardInput forward_input;
28+
if (dit_request_data_vec_.empty()) {
29+
return forward_input;
30+
}
31+
forward_input.input_params = dit_request_data_vec_[0].input_params;
32+
forward_input.generation_params = dit_request_data_vec_[0].generation_params;
33+
return forward_input;
34+
}
35+
36+
} // namespace xllm
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* Copyright 2025 The xLLM Authors. All Rights Reserved.
2+
Copyright 2024 The ScaleLLM Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://github.com/jd-opensource/xllm/blob/main/LICENSE
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
==============================================================================*/
16+
17+
#pragma once
18+
19+
#include <torch/torch.h>
20+
21+
#include <limits>
22+
#include <vector>
23+
24+
#include "framework/request/dit_request_params.h"
25+
#include "runtime/dit_forward_params.h"
26+
27+
namespace xllm {
28+
29+
struct DiTBatch {
30+
public:
31+
DiTBatch() = default;
32+
void add(const DiTRequestParams& dit_request_state) {
33+
dit_request_data_vec_.emplace_back(dit_request_state);
34+
}
35+
size_t size() const { return dit_request_data_vec_.size(); }
36+
bool empty() const { return dit_request_data_vec_.empty(); }
37+
38+
// prepare forward input
39+
DiTForwardInput prepare_forward_input();
40+
41+
private:
42+
std::vector<DiTRequestParams> dit_request_data_vec_;
43+
};
44+
45+
} // namespace xllm

0 commit comments

Comments
 (0)