[Bugfix] Ensure embeding model compilation on CPU (#42709)
Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
@@ -213,10 +213,13 @@ class CPUWorker(Worker):
|
|||||||
return kv_cache_size
|
return kv_cache_size
|
||||||
|
|
||||||
def compile_or_warm_up_model(self) -> CompilationTimes:
|
def compile_or_warm_up_model(self) -> CompilationTimes:
|
||||||
|
# Note: the model has been compiled in determine_available_memory(),
|
||||||
|
# Only compile here for models without kv cache
|
||||||
|
if len(self.model_runner.kv_caches) == 0:
|
||||||
|
self.model_runner.warming_up_model()
|
||||||
# Reset the seed to ensure that the random state is not affected by
|
# Reset the seed to ensure that the random state is not affected by
|
||||||
# the model initialization and profiling.
|
# the model initialization and profiling.
|
||||||
set_random_seed(self.model_config.seed)
|
set_random_seed(self.model_config.seed)
|
||||||
# Note: the model has been compiled in determine_available_memory()
|
|
||||||
return CompilationTimes(
|
return CompilationTimes(
|
||||||
language_model=self.compilation_config.compilation_time,
|
language_model=self.compilation_config.compilation_time,
|
||||||
encoder=self.compilation_config.encoder_compilation_time,
|
encoder=self.compilation_config.encoder_compilation_time,
|
||||||
|
|||||||
Reference in New Issue
Block a user