mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-09-01 12:49:50 +08:00
black format
This commit is contained in:
@@ -30,7 +30,7 @@ if __name__ == "__main__":
|
||||
torch_path = Path(args.torch_model)
|
||||
if not os.path.exists(args.mlx_model):
|
||||
os.makedirs(args.mlx_model)
|
||||
mlx_path = Path(args.mlx_model)
|
||||
mlx_path = Path(args.mlx_model)
|
||||
|
||||
state = torch.load(str(torch_path / "consolidated.00.pth"))
|
||||
np.savez(
|
||||
@@ -57,5 +57,3 @@ if __name__ == "__main__":
|
||||
config["hidden_dim"] = state["layers.0.feed_forward.w1.weight"].shape
|
||||
with open(mlx_path / "params.json", "w") as outfile:
|
||||
json.dump(config, outfile)
|
||||
|
||||
|
||||
|
@@ -20,9 +20,13 @@ import wikisql
|
||||
|
||||
|
||||
def build_parser():
|
||||
parser = argparse.ArgumentParser(description="LoRA finetuning with Llama or Mistral")
|
||||
parser = argparse.ArgumentParser(
|
||||
description="LoRA finetuning with Llama or Mistral"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--model", required=True, help="A path to the model files containing the tokenizer, weights, config."
|
||||
"--model",
|
||||
required=True,
|
||||
help="A path to the model files containing the tokenizer, weights, config.",
|
||||
)
|
||||
# Generation args
|
||||
parser.add_argument(
|
||||
@@ -227,6 +231,7 @@ def generate(model, prompt, tokenizer, args):
|
||||
|
||||
def generate_step():
|
||||
temp = args.temp
|
||||
|
||||
def sample(logits):
|
||||
if temp == 0:
|
||||
return mx.argmax(logits, axis=-1)
|
||||
|
Reference in New Issue
Block a user