Skip to content

Commit bda391f

Browse files
committed
Repro stride issue
1 parent 809a1a5 commit bda391f

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

examples/models/checkpoint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ def get_default_model_resource_dir(model_file_path: str) -> Path:
3131
"""
3232

3333
try:
34+
import importlib
3435
import pkg_resources
3536

3637
# 1st way: If we can import this path, we are running with buck2 and all resources can be accessed with pkg_resources.
3738
# pyre-ignore
39+
model_name = Path(model_file_path).parent.name
3840
from executorch.examples.models.llama import params # noqa
41+
module = importlib.import_module(f"executorch.examples.models.{model_name}.params")
42+
# params = module.params
3943

4044
# Get the model name from the cwd, assuming that this module is called from a path such as
4145
# examples/models/<model_name>/model.py.
42-
model_name = Path(model_file_path).parent.name
4346
resource_dir = Path(
4447
pkg_resources.resource_filename(
4548
f"executorch.examples.models.{model_name}", "params"

examples/models/llama/export_llama_lib.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def build_args_parser() -> argparse.ArgumentParser:
175175
parser.add_argument(
176176
"-c",
177177
"--checkpoint",
178-
default=f"{ckpt_dir}/params/demo_rand_params.pth",
179178
help="checkpoint path",
180179
)
181180

@@ -874,9 +873,9 @@ def _load_llama_model(
874873
An instance of LLMEdgeManager which contains the eager mode model.
875874
"""
876875

877-
assert (
878-
checkpoint or checkpoint_dir
879-
) and params_path, "Both checkpoint/checkpoint_dir and params can't be empty"
876+
# assert (
877+
# checkpoint or checkpoint_dir
878+
# ) and params_path, "Both checkpoint/checkpoint_dir and params can't be empty"
880879
logging.info(
881880
f"Loading model with checkpoint={checkpoint}, params={params_path}, use_kv_cache={use_kv_cache}, weight_type={weight_type}"
882881
)

examples/models/llama3_2_vision/text_decoder/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, **kwargs):
5858

5959
ckpt_dir = get_default_model_resource_dir(__file__)
6060
# Single checkpoint file.
61-
checkpoint_path = kwargs.get("checkpoint", ckpt_dir / "demo_rand_params.pth")
61+
checkpoint_path = kwargs.get("checkpoint") if kwargs.get("checkpoint") else ckpt_dir / "demo_rand_params.pth"
6262
if os.path.isfile(checkpoint_path):
6363
self.use_checkpoint = True
6464

examples/models/llama3_2_vision/text_decoder/params/demo_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"multiple_of": 1024,
77
"n_heads": 32,
88
"n_kv_heads": 8,
9-
"n_layers": 32,
9+
"n_layers": 1,
1010
"n_special_tokens": 8,
1111
"norm_eps": 1e-05,
1212
"rope_theta": 500000.0,

0 commit comments

Comments
 (0)