Skip to main content

RefConfig

Powered by SmartDict.

Usage

  • Configure with references

Install

pip install refconfig

Description

# ./data/zhihu.yaml

dataset: zhihu
store:
  data_dir: data/FANS/${config.dataset}
  save_dir: saving/${config.dataset}/${exp.model}-E${config.model_config.hidden_size}/
model_config:
  hidden_size: 64
  num_hidden_layers: 3
  num_attention_heads: 8
# ./exp/train.yaml

exp: step-${exp.tasks.0.params.steps}
model: bert
mode: train
freeze_emb: false
tasks:
  -
    name: mlm
    params:
      steps: 5
store:
  interval: 10
policy:
  epoch: 200
import refconfig

config = refconfig.parse_yaml(
    exp='./exp/train.yaml',
    config='./data/zhihu.yaml',
)

print(config['config']['store']['data_dir'])  # => data/FANS/zhihu
print(config['config']['store']['save_dir'])  # => saving/zhihu/bert-E64/
print(config['exp']['exp'])  # => step-5

# use with the Oba library to achieve a smoother effect

from oba import Obj

config = Obj(config)
config, exp = config.config, config.exp
print(config.store.data_dir)  # => data/FANS/zhihu
print(config.store.save_dir)  # => saving/zhihu/bert-E64/
print(exp.exp)  # => step-5
# ./data/any.yaml

store:
  data_dir: data/FANS/${dataset}
  save_dir: saving/${dataset}/${exp.model}-E${config.model_config.hidden_size}/
model_config:
  hidden_size: 64
  num_hidden_layers: 3
  num_attention_heads: 8
from refconfig import RefConfig

config = RefConfig().add_yaml(
    exp='./exp/train.yaml',
    config='./data/any.yaml',
).add_raw(
    dataset='youtube',
).parse()

from oba import Obj

config = Obj(config)
config, exp = config.config, config.exp
print(config.store.data_dir)  # => data/FANS/youtube
print(config.store.save_dir)  # => saving/youtube/bert-E64/
print(exp.exp)  # => step-5

Metadata

Release files for refconfig 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for refconfig 0.1.2
File Size Uploaded
refconfig-0.1.2.tar.gz 3.8 kB Details

Release files / refconfig-0.1.2.tar.gz

Download URL refconfig-0.1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fe6106edea1b7e3d560f89563575173bb1cc638c286f08ccb1d7e66751bc24ce
BLAKE2b-256 checksum
How to use checksums
ce995929601e5a870ea70ef5847b99fac01c6a11ce0880047825f8fdea212d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page