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

change CMDSTAN version for Apple M2 #2497

Merged
merged 5 commits into from
Oct 10, 2023
Merged

change CMDSTAN version for Apple M2 #2497

merged 5 commits into from
Oct 10, 2023

Conversation

lucentcosmos
Copy link
Contributor

@lucentcosmos lucentcosmos commented Sep 22, 2023

This is needed to build prophet on Apple M2 Pro.

% pip install prophet -e "git+https://github.com/lucentcosmos/prophet.git@441d77e#egg=prophet&subdirectory=python"

Obtaining prophet from git+https://github.com/lucentcosmos/prophet.git@441d77e#egg=prophet&subdirectory=python

  Cloning https://github.com/lucentcosmos/prophet.git (to revision 441d77e) to .....
  WARNING: Did not find branch or tag '441d77e', assuming revision or ref.
  Running command git checkout -q 441d77e
  Resolved https://github.com/lucentcosmos/prophet.git to commit 441d77e
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Collecting prophet
..........
Building wheels for collected packages: prophet
  Building editable for prophet (pyproject.toml) ... done
  Created wheel for prophet: filename=prophet-1.1.4a0-0.editable-py3-none-macosx_13_0_arm64.whl size=4722 sha256=33ad80ae8bd2993bff5dc775675e3be5ca6797466ee09d7eed7b32b99bbcc122
  Stored in directory: /private/var/folders/d5/wjs2_3q13f31k5xnnc_t_1bc0000gq/T/pip-ephem-wheel-cache-iv4bmayp/wheels/4d/14/7b/6942cc1367b12354825984ff85aacc56d594630a89181f54cb
Successfully built prophet
Installing collected packages: prophet
  Attempting uninstall: prophet
    Found existing installation: prophet 1.1.4a0
    Uninstalling prophet-1.1.4a0:
      Successfully uninstalled prophet-1.1.4a0
Successfully installed prophet-1.1.4a0

@facebook-github-bot
Copy link
Contributor

Hi @lucentcosmos!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@@ -54,7 +54,7 @@ def sampling(self, stan_init, stan_data, samples, **kwargs) -> dict:


class CmdStanPyBackend(IStanBackend):
CMDSTAN_VERSION = "2.31.0"
CMDSTAN_VERSION = "2.33.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated and tested on my M2

@WardBrian
Copy link
Collaborator

Note that 2.32.1 should be good enough: stan-dev/cmdstan#1158

@tcuongd I recommend merging this if CI passes, it should fix the remaining issues in #2503, #2438, and maybe even #2402

@tcuongd
Copy link
Collaborator

tcuongd commented Oct 4, 2023

The RMSE in one of the tests is now a bit off:

FAILED prophet/tests/test_prophet.py::TestProphetFitPredictDefault::test_fit_predict[CMDSTANPY-minmax] - AssertionError: backend: <prophet.models.CmdStanPyBackend object at 0x11dc0e160>
assert 11.917838773340984 == 11.13 ± 2.2e-01
  comparison failed
  Obtained: 11.917838773340984
  Expected: 11.13 ± 2.2e-01

I don't think this is a big deal especially since the other tests have passed, but @lucentcosmos could you do some quick fit / predict runs on your machine and check that the forecasts aren't doing something weird? If it's just down to noise then we can update the expected rmse value in the tests.

@tcuongd
Copy link
Collaborator

tcuongd commented Oct 7, 2023

Actually now that I think about it, it's weird that the test only fails for macOS given that it's seeded. We'd need to put a higher tolerance on the check then, if the fitting is actually working as expected.

@WardBrian
Copy link
Collaborator

I believe this range of updates includes when we updated to Eigen 3.4, which did lead to some numerical changes on some architectures

@tcuongd
Copy link
Collaborator

tcuongd commented Oct 10, 2023

Keen to get this merged, but the test result is still weird to me. Just to correct myself from before, the discrepancy is actually happening on Intel Macs; I tested on my M1 and the result is ~11.04 with the same seeds which is fine. If anyone can test on an Intel that the forecast isn't doing anything silly that would be great. Otherwise I'll increase the tolerance to 0.1 (10% relative) and leave a note to revisit.

@tcuongd tcuongd merged commit 89f30fd into facebook:main Oct 10, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants