Skip to content

Commit 09cccec

Browse files
committed
Rebase
1 parent 48370c6 commit 09cccec

File tree

3 files changed

+15
-69
lines changed

3 files changed

+15
-69
lines changed

CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,6 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM)
650650
list(APPEND _executorch_extensions tokenizers)
651651
endif()
652652

653-
<<<<<<< HEAD
654-
=======
655-
if(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
656-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/apple)
657-
endif()
658-
659-
>>>>>>> 13d8d946c0edc7e0f8df38194406c874f4e2fbbb
660653
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)
661654
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner_util)
662655
install(
@@ -907,13 +900,10 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
907900
list(APPEND _executorch_extensions extension_llm_runner)
908901
endif()
909902

910-
<<<<<<< HEAD
911903
if(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
912904
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/apple)
913905
endif()
914906

915-
=======
916-
>>>>>>> 13d8d946c0edc7e0f8df38194406c874f4e2fbbb
917907
if(EXECUTORCH_BUILD_KERNELS_LLM)
918908
# TODO: move all custom kernels to ${CMAKE_CURRENT_SOURCE_DIR}/kernels/custom
919909
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/custom_ops)

extension/llm/runner/_llm_runner.pyi

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class GenerationConfig:
3434
num_eos: int
3535
"""Number of EOS tokens to add to the prompt."""
3636

37-
<<<<<<< HEAD
3837
def __init__(
3938
self,
4039
*,
@@ -47,10 +46,6 @@ class GenerationConfig:
4746
num_eos: int = 0,
4847
) -> None:
4948
"""Initialize GenerationConfig with optional keyword arguments for all fields."""
50-
=======
51-
def __init__(self) -> None:
52-
"""Initialize GenerationConfig with default values."""
53-
>>>>>>> 13d8d946c0edc7e0f8df38194406c874f4e2fbbb
5449
...
5550

5651
def resolve_max_new_tokens(
@@ -373,32 +368,6 @@ class MultimodalRunner:
373368
Raises:
374369
RuntimeError: If generation fails
375370
"""
376-
<<<<<<< HEAD
377-
...
378-
379-
def generate(
380-
self,
381-
inputs: dict,
382-
config: GenerationConfig,
383-
token_callback: Optional[Callable[[str], None]] = None,
384-
stats_callback: Optional[Callable[[Stats], None]] = None,
385-
) -> None:
386-
"""
387-
Generate text directly from a HuggingFace processor dict.
388-
389-
Expects at least 'input_ids' (torch.Tensor). If 'pixel_values' is provided,
390-
an 'image_token_id' (or 'image_token_index') must also be present to locate
391-
the image position(s) in input_ids.
392-
393-
Args:
394-
inputs: HF processor outputs (e.g., from AutoProcessor.apply_chat_template)
395-
config: Generation configuration
396-
token_callback: Optional per-token callback
397-
stats_callback: Optional stats callback
398-
399-
Raises:
400-
RuntimeError: If required keys are missing, shapes are invalid, or generation fails
401-
"""
402371
...
403372

404373
def prefill(self, inputs: List[MultimodalInput]) -> None:
@@ -412,8 +381,6 @@ class MultimodalRunner:
412381
Raises:
413382
RuntimeError: If prefill fails
414383
"""
415-
=======
416-
>>>>>>> 13d8d946c0edc7e0f8df38194406c874f4e2fbbb
417384
...
418385

419386
def generate_text(
@@ -432,17 +399,6 @@ class MultimodalRunner:
432399
Raises:
433400
RuntimeError: If generation fails
434401
"""
435-
<<<<<<< HEAD
436-
...
437-
438-
def generate_text(self, inputs: dict, config: GenerationConfig) -> str:
439-
"""
440-
Generate text directly from a HuggingFace processor dict and return as string.
441-
442-
See generate(inputs: dict, ...) for expected keys and constraints.
443-
"""
444-
=======
445-
>>>>>>> 13d8d946c0edc7e0f8df38194406c874f4e2fbbb
446402
...
447403

448404
def stop(self) -> None:

extension/llm/runner/pybindings.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ PYBIND11_MODULE(_llm_runner, m) {
172172
float temperature,
173173
int32_t num_bos,
174174
int32_t num_eos) {
175-
GenerationConfig cfg;
176-
cfg.echo = echo;
177-
cfg.max_new_tokens = max_new_tokens;
178-
cfg.warming = warming;
179-
cfg.seq_len = seq_len;
180-
cfg.temperature = temperature;
181-
cfg.num_bos = num_bos;
182-
cfg.num_eos = num_eos;
183-
return cfg;
175+
GenerationConfig cfg;
176+
cfg.echo = echo;
177+
cfg.max_new_tokens = max_new_tokens;
178+
cfg.warming = warming;
179+
cfg.seq_len = seq_len;
180+
cfg.temperature = temperature;
181+
cfg.num_bos = num_bos;
182+
cfg.num_eos = num_eos;
183+
return cfg;
184184
}),
185185
py::arg("echo") = true,
186186
py::arg("max_new_tokens") = -1,
@@ -200,12 +200,12 @@ PYBIND11_MODULE(_llm_runner, m) {
200200
py::arg("num_prompt_tokens"),
201201
"Resolve the maximum number of new tokens to generate based on constraints")
202202
.def("__repr__", [](const GenerationConfig& config) {
203-
return "<GenerationConfig max_new_tokens=" +
204-
std::to_string(config.max_new_tokens) +
205-
" seq_len=" + std::to_string(config.seq_len) +
206-
" temperature=" + std::to_string(config.temperature) +
207-
" echo=" + (config.echo ? "True" : "False") +
208-
" warming=" + (config.warming ? "True" : "False") + ">";
203+
return "<GenerationConfig max_new_tokens=" +
204+
std::to_string(config.max_new_tokens) +
205+
" seq_len=" + std::to_string(config.seq_len) +
206+
" temperature=" + std::to_string(config.temperature) +
207+
" echo=" + (config.echo ? "True" : "False") +
208+
" warming=" + (config.warming ? "True" : "False") + ">";
209209
});
210210

211211
// Bind Stats

0 commit comments

Comments
 (0)