Skip to content

Commit

Permalink
update demos
Browse files Browse the repository at this point in the history
  • Loading branch information
drcege committed Sep 25, 2024
1 parent 718bf0b commit a7484af
Show file tree
Hide file tree
Showing 9 changed files with 552 additions and 819 deletions.
10 changes: 4 additions & 6 deletions data_juicer/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def update_ds_cache_dir_and_related_vars(new_ds_cache_path):
config.DEFAULT_EXTRACTED_DATASETS_PATH)


def init_setup_from_cfg(cfg):
def init_setup_from_cfg(cfg: Namespace):
"""
Do some extra setup tasks after parsing config file or command line.
Expand Down Expand Up @@ -628,7 +628,7 @@ def namespace_to_arg_list(namespace, prefix='', includes=None, excludes=None):
return arg_list


def config_backup(cfg):
def config_backup(cfg: Namespace):
cfg_path = cfg.config[0].absolute
work_dir = cfg.work_dir
target_path = os.path.join(work_dir, os.path.basename(cfg_path))
Expand All @@ -638,7 +638,7 @@ def config_backup(cfg):
shutil.copyfile(cfg_path, target_path)


def display_config(cfg):
def display_config(cfg: Namespace):
import pprint

from tabulate import tabulate
Expand Down Expand Up @@ -790,14 +790,12 @@ def prepare_side_configs(ori_config: Union[str, Namespace, Dict]):
return config


def get_init_configs(cfg):
def get_init_configs(cfg: Union[Namespace, Dict]):
"""
set init configs of datajucer for cfg
"""
temp_dir = tempfile.gettempdir()
temp_file = os.path.join(temp_dir, 'job_dj_config.json')
if type(cfg) == str:
cfg = json.loads(cfg)
if isinstance(cfg, Namespace):
cfg = namespace_to_dict(cfg)
# create an temp config file
Expand Down
13 changes: 0 additions & 13 deletions demos/api_service/configs/dj_default_configs.yaml

This file was deleted.

16 changes: 3 additions & 13 deletions demos/api_service/configs/model_configs.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
[
{
"config_name": "gpt-3.5-turbo",
"model_type": "openai-chat",
"model_name": "gpt-3.5-turbo",
"api_key": "xxx",
"organization": "xxx",
"generate_args": {
"temperature": 0.0
}
},
{
"config_name": "gpt-4",
"model_type": "openai-chat",
"model_name": "gpt-4",
"api_key": "xxx",
"organization": "xxx",
"api_key": "your API key",
"organization": "your organization name",
"generate_args": {
"temperature": 0.5
}
Expand All @@ -23,7 +13,7 @@
"config_name": "dashscope_chat-qwen-max",
"model_type": "dashscope_chat",
"model_name": "qwen-max",
"api_key": "xxx",
"api_key": "your API key",
"generate_args": {
"temperature": 0.0
}
Expand Down
Loading

0 comments on commit a7484af

Please sign in to comment.