-
Notifications
You must be signed in to change notification settings - Fork 523
/
Copy pathconverter.py
27 lines (21 loc) · 969 Bytes
/
converter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from executorch.extension.gguf_util.load_gguf import GGUFModelArgs, GGUFWeights
def convert_to_pte(model_args: GGUFModelArgs, weights: GGUFWeights) -> None:
"""Convert a GGUF model into a PTE file, an ExecuTorch program.
Args:
model_args: The arguments for the GGUF model.
weights: The weights of the GGUF model.
"""
# Switch statement based on the architecture enum.
# Each enum has its own converter function.
if model_args.arch == "llama":
from executorch.extension.gguf_util.converters.llama_converter import (
convert_to_pte as llama_convert_to_pte,
)
return llama_convert_to_pte(model_args, weights)
else:
raise NotImplementedError("Unsupported architecture.")