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

force_compile in CmdStanModel Does Not Work #773

Open
brucejwittmann opened this issue Dec 11, 2024 · 2 comments
Open

force_compile in CmdStanModel Does Not Work #773

brucejwittmann opened this issue Dec 11, 2024 · 2 comments

Comments

@brucejwittmann
Copy link

Summary:

Title describes the problem :)

Description:

I believe the problem comes from this line. Shouldn't it read if compile or self._exe_file is None instead of the current if compile and self._exe_file is None? As written, force_compile will only actually force compilation if no exe file is provided, which kind of defeats the point IMO. Changing the "and" to an "or" results in a compilation if force_compile = True OR if force_compile = False and no executable was provided.

Current Version:

The referenced code issue is in the main branch. Probably not helpful, but here's the info for what I'm working with:

INSTALLED VERSIONS

python: 3.12.5 | packaged by conda-forge | (main, Aug 8 2024, 18:36:51) [GCC 12.4.0]
python-bits: 64
OS: Linux
OS-release: 6.5.0-35-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
cmdstan_folder: /home/bwittmann/micromamba/envs/dms_stan/bin/cmdstan
cmdstan: (2, 33)
cmdstanpy: 1.2.4
pandas: 2.2.2
xarray: 2023.6.0
tqdm: 4.66.4
numpy: 1.26.4

' '

@WardBrian
Copy link
Member

Why are you providing a path to the exe file if you don't want it to use that file? I think it would be reasonable to make the change you suggest, but I'd also be tempted to make this combination of arguments raise an exception.

Note that we will (eventually) have a breaking change to the model class constructor which will likely end up fixing this by accident, c.f. #695

@brucejwittmann
Copy link
Author

I have a child class of CmdStanModel that looks for an executable file of the same name as the stan file and passes it in as the exe argument if it finds one. I can certainly work around this with minor changes to the child class, but the documentation for CmdStanModel states for force_compile, "If True, always compile, even if there is an existing executable file for this model." To me, this means that force_compile = True will override all other arguments to CmdStanModel and force creation of a new executable from the passed stan file. Perhaps I'm just misinterpreting the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants