MilesCranmer commited on
Commit
5ffac80
1 Parent(s): 4abcbfe

Switch order of torch depending on operating system

Browse files
Files changed (1) hide show
  1. test/test_torch.py +9 -3
test/test_torch.py CHANGED
@@ -3,9 +3,15 @@ import numpy as np
3
  import pandas as pd
4
  from pysr import sympy2torch, PySRRegressor
5
  # Need to initialize Julia before importing torch...
6
- from pysr.julia_helpers import init_julia
7
- Main = init_julia()
8
- import torch
 
 
 
 
 
 
9
  import sympy
10
 
11
 
 
3
  import pandas as pd
4
  from pysr import sympy2torch, PySRRegressor
5
  # Need to initialize Julia before importing torch...
6
+ import platform
7
+ if platform.system() == "Darwin":
8
+ from pysr.julia_helpers import init_julia
9
+ Main = init_julia()
10
+ import torch
11
+ else:
12
+ # Switch order of imports.
13
+ # https://github.com/pytorch/pytorch/issues/78829
14
+ import torch
15
  import sympy
16
 
17