question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using sacred without the CLI?

See original GitHub issue

I really love the idea of sacred, but I already have a CLI interface for my application, which I’m unwilling to change. Would it be possible to disentangle the guts of Experiment from the main-hijacking semantics?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
JarnoRFBcommented, Jan 16, 2019

I think what you can do is just define your experiment in a separate file. There you might just declare the function that runs your experiment as a command.

experiment.py

exp = Experiment()

@exp.command
def conduct():
    # do fancy experiment

Then in the file that contains the cli you can import the experiment object and update the config that you parsed with your cli parser. For example assuming that you get the number of epochs from your cli, it could look something like this

cli.py

from experiment import exp

epochs = parse_cli()
exp.run('conduct', config_updates={'epochs': epochs})

Then you can run this from the command line just as usual, e.g. python cli.py --epoch 5

You probably don’t even have to use a separate command. Using

exp = Experiment()

@exp.main
def run():
    # do fancy experiment
from experiment import exp

epochs = parse_cli()
exp.run(config_updates={'epochs': epochs})

should work equally well. Hope that helps!

0reactions
stale[bot]commented, Aug 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command-Line Interface — Sacred 0.8.3 documentation
Sacred provides a powerful command-line interface for every experiment out of box. All you have to do to use it is to either...
Read more >
Experiencing Shiva with A Sacred Fire
Importantly, there was to be no small talk around the sacred fire, ... The fire resonated with the divinity that our tradition teaches...
Read more >
Sacred - neptune.ai documentation
Sacred is a tool to configure, organize, log, and reproduce computational experiments. With the Neptune–Sacred integration, you can log the following metadata ...
Read more >
Nothing that is not sacred - eJewish Philanthropy
CLI is directed by Rabbi Sid Schwarz and is fiscally sponsored by Hazon ... It was the anchoring element of the Judaism I...
Read more >
1.7 Integration with Sacred - signac documentation
Here we demonstrate how to integrate a sacred experiment with signac-flow. Assuming the following sacred experiment defined in a experiment.py module:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found