mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-09 21:10:56 +00:00
1e77557293
* run the code * update code * remove some redundant code --------- Co-authored-by: xuyang1 <xuyang1@microsoft.com>
23 lines
567 B
Python
23 lines
567 B
Python
from pathlib import Path
|
|
from typing import Dict
|
|
|
|
import yaml
|
|
from rdagent.core.utils import SingletonBaseClass
|
|
|
|
|
|
class Prompts(Dict, SingletonBaseClass):
|
|
def __init__(self, file_path: Path):
|
|
prompt_yaml_dict = yaml.load(
|
|
open(
|
|
file_path,
|
|
encoding="utf8",
|
|
),
|
|
Loader=yaml.FullLoader,
|
|
)
|
|
|
|
if prompt_yaml_dict is None:
|
|
raise ValueError(f"Failed to load prompts from {file_path}")
|
|
|
|
for key, value in prompt_yaml_dict.items():
|
|
self[key] = value
|