Skip to content

No hardcoded default checkpoints #2708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions examples/models/llama2/export_llama_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import argparse
import copy
import logging
import os
import shlex
from dataclasses import dataclass

from functools import partial
from pathlib import Path
from typing import List, Optional
from typing import List, Optional, Union

import pkg_resources
import torch
Expand Down Expand Up @@ -237,8 +238,12 @@ def quantize(
else:
torch_dtype = torch.float16

if checkpoint_path is None:
checkpoint_path = Path("checkpoints/meta-llama/Llama-2-7b-chat-hf/model.pth")
assert checkpoint_path, "Need to specify a checkpoint"
assert os.path.isfile(
canonical_path(checkpoint_path)
), f"{checkpoint_path} does not exist"
# if checkpoint_path is None:
# checkpoint_path = Path("checkpoints/meta-llama/Llama-2-7b-chat-hf/model.pth")

if calibration_tasks is None:
calibration_tasks = ["wikitext"]
Expand Down Expand Up @@ -457,7 +462,9 @@ def build_args_parser() -> argparse.ArgumentParser:
return parser


def canonical_path(path: str, *, dir: bool = False) -> str:
def canonical_path(path: Union[str, Path], *, dir: bool = False) -> str:

path = str(path)

if verbose_export():
print(f"creating canonical path for {path}")
Expand Down