Created
March 12, 2018 09:18
-
-
Save bmmalone/4574dc25e358ef0dca7006b6195642db to your computer and use it in GitHub Desktop.
Pickle a stan model file (python3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import argparse | |
import pickle | |
from pystan import StanModel | |
def main(): | |
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, | |
description="This script compiles a stan model and pickles it to disc") | |
parser.add_argument("stan", help="The stan model file") | |
parser.add_argument("out", help="The python3 pickle output file") | |
args = parser.parse_args() | |
sm = StanModel(file=args.stan) | |
with open(args.out, 'wb') as f: | |
pickle.dump(sm, f) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment