Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway to load a variable in a config file as a list? #883

Closed
sizhky opened this issue Jul 17, 2023 · 3 comments
Closed

Is there anyway to load a variable in a config file as a list? #883

sizhky opened this issue Jul 17, 2023 · 3 comments
Labels
feat / config Configuration system and config files usage General Thinc usage

Comments

@sizhky
Copy link

sizhky commented Jul 17, 2023

I'm training a huggingface code but this is a generic query

[TrainingConfig]
learning_rate=3e-5
max_steps=50
output_dir="./results",
per_device_train_batch_size=64
per_device_eval_batch_size=${per_device_train_batch_size}
evaluation_strategy="steps"
eval_steps=10
logging_strategy=${evaluation_strategy}
logging_steps=${eval_steps}
save_strategy=${evaluation_strategy}
save_steps=${eval_steps}
save_total_limit=1
seed=${ModelConfig.seed}
label_names=['x']

The label_names at the bottom is being parsed as a string "['x']" is there a way to read it as a list when parsing?

@rmitsch rmitsch added usage General Thinc usage feat / config Configuration system and config files labels Jul 18, 2023
@rmitsch
Copy link
Contributor

rmitsch commented Jul 18, 2023

Hi @sizhky, try label_names=["x"] instead (" instead of ').

@sizhky
Copy link
Author

sizhky commented Jul 24, 2023

Yes, this works. Thank you. Is there any page in documentation that describes this?

You can point me to what could be the best place to add this in docs otherwise.

Another parallel request - Is there a way to add multiline strings in the file? This will be best useful for comments/descriptions/changelog type of fields

@sizhky sizhky closed this as completed Jul 24, 2023
@rmitsch
Copy link
Contributor

rmitsch commented Jul 25, 2023

Yes, this works. Thank you. Is there any page in documentation that describes this?

You can point me to what could be the best place to add this in docs otherwise.

This is not in the docs, AFAIK. Towards the end of the usage section would probably be a good idea. Happy to look at the PR if you want to do this!

Another parallel request - Is there a way to add multiline strings in the file? This will be best useful for comments/descriptions/changelog type of fields

Yes, like this:

[TrainingConfig]
label_names=["x"]
test = """
    this is a
    test"""

The resulting dict is {'TrainingConfig': {'label_names': ['x'], 'test': '"""\nthis is a\ntest"""'}}. In general we are congruent with the CFG format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / config Configuration system and config files usage General Thinc usage
Projects
None yet
Development

No branches or pull requests

2 participants