Skip to content

Commit 18d803a

Browse files
Michael Gschwindfacebook-github-bot
authored andcommitted
Support metadata input file
Summary: Support metadata input file Differential Revision: D54525165
1 parent a3a525a commit 18d803a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/models/llama2/builder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ def __init__(
144144
self.export_program = None
145145
self.output_dir = "."
146146

147-
def set_metadata(self, metadata: Optional[dict]) -> "LlamaEdgeManager":
147+
def set_metadata(self, metadata: Optional[Union[dict, str]]) -> "LlamaEdgeManager":
148148
"""
149149
Set the metadata that will be serialized into .pte file.
150150
Args:
151151
metadata (Optional[dict]): Metadata for the model.
152152
"""
153+
if isinstance(metadata, str):
154+
with open(metadata, "r") as f:
155+
metadata = json.load(f)
153156
self.metadata = metadata
154157
return self
155158

0 commit comments

Comments
 (0)