Add option to use unbacked, and backed size obl dynamic shapes for more sounds compilation. (#26199)
Signed-off-by: Laith Sakka <lsakka@meta.com>
This commit is contained in:
@@ -354,7 +354,17 @@ class LlamaDecoderLayer(nn.Module):
|
||||
return vllm_config.quant_config
|
||||
|
||||
|
||||
@support_torch_compile
|
||||
def llama_model_invariants(
|
||||
input_ids, positions, intermediate_tensors=None, inputs_embeds=None
|
||||
):
|
||||
"""Shape invariants for Llama model compilation, those are translated to
|
||||
runtime assertions for unbacked dynamic shapes and are compiled away for
|
||||
backed"""
|
||||
if input_ids is not None:
|
||||
torch._check(positions.size()[0] == input_ids.size()[0])
|
||||
|
||||
|
||||
@support_torch_compile(shape_invariants=llama_model_invariants)
|
||||
class LlamaModel(nn.Module):
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user