File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -869,13 +869,6 @@ def _gen_model_input(
869
869
max_new_tokens : Optional [int ] = None ,
870
870
max_seq_len : Optional [int ] = 2048 ,
871
871
) -> Tuple [torch .Tensor , Optional [Dict [str , Any ]]]:
872
- # torchtune model definition dependencies
873
- from torchtune .data import Message , padded_collate_tiled_images_and_mask
874
- from torchtune .models .llama3_2_vision ._model_builders import (
875
- llama3_2_vision_transform ,
876
- )
877
- from torchtune .training import set_default_dtype
878
-
879
872
"""
880
873
Convert prompt and image prompts into consumable model input args.
881
874
@@ -911,6 +904,14 @@ def _gen_model_input(
911
904
return encoded , None
912
905
913
906
# Llama 3.2 11B
907
+
908
+ # torchtune model definition dependencies
909
+ from torchtune .data import Message , padded_collate_tiled_images_and_mask
910
+ from torchtune .models .llama3_2_vision ._model_builders import (
911
+ llama3_2_vision_transform ,
912
+ )
913
+ from torchtune .training import set_default_dtype
914
+
914
915
assert (
915
916
image_prompts is None or len (image_prompts ) == 1
916
917
), "At most one image is supported at the moment"
Original file line number Diff line number Diff line change @@ -1054,13 +1054,13 @@ def apply_rotary_emb(x: Tensor, freqs_cis: Tensor) -> Tensor:
1054
1054
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1055
1055
1056
1056
try :
1057
- # For llama::sdpa_with_kv_cache.out, preprocess ops
1058
- from executorch .extension .llm .custom_ops import custom_ops # no-qa
1059
1057
from executorch .extension .pybindings import portable_lib as exec_lib
1060
1058
1061
1059
# ET changed the way it's loading the custom ops so it's not included in portable_lib but has to be loaded separately.
1062
1060
# For quantized_decomposed ops
1063
1061
from executorch .kernels import quantized # no-qa
1062
+ # For llama::sdpa_with_kv_cache.out, preprocess ops
1063
+ from executorch .extension .llm .custom_ops import custom_ops # no-qa
1064
1064
1065
1065
class PTEModel (nn .Module ):
1066
1066
def __init__ (self , config , path ) -> None :
You can’t perform that action at this time.
0 commit comments