Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
3cbb7c6
1
Parent(s):
90fd5d4
Rename all instances of PyJulia to juliacall in docs
Browse files- docs/backend.md +1 -1
- docs/examples.md +1 -1
- examples/pysr_demo.ipynb +4 -4
docs/backend.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
If you have explored the [options](options.md) and [PySRRegressor reference](api.md), and still haven't figured out how to specify a constraint or objective required for your problem, you might consider editing the backend.
|
4 |
The backend of PySR is written as a pure Julia package under the name [SymbolicRegression.jl](https://github.com/MilesCranmer/SymbolicRegression.jl).
|
5 |
-
This package is accessed with [`
|
6 |
|
7 |
PySR gives you access to everything in SymbolicRegression.jl, but there are some specific use-cases which require modifications to the backend itself.
|
8 |
Generally you can do this as follows:
|
|
|
2 |
|
3 |
If you have explored the [options](options.md) and [PySRRegressor reference](api.md), and still haven't figured out how to specify a constraint or objective required for your problem, you might consider editing the backend.
|
4 |
The backend of PySR is written as a pure Julia package under the name [SymbolicRegression.jl](https://github.com/MilesCranmer/SymbolicRegression.jl).
|
5 |
+
This package is accessed with [`juliacall`](https://github.com/JuliaPy/PythonCall.jl), which allows us to transfer objects back and forth between the Python and Julia runtimes.
|
6 |
|
7 |
PySR gives you access to everything in SymbolicRegression.jl, but there are some specific use-cases which require modifications to the backend itself.
|
8 |
Generally you can do this as follows:
|
docs/examples.md
CHANGED
@@ -235,7 +235,7 @@ If in-bounds, it rounds it to the nearest integer, compures the corresponding pr
|
|
235 |
converts it to the same type as input.
|
236 |
|
237 |
Next, let's generate a list of primes for our test dataset.
|
238 |
-
Since we are using
|
239 |
|
240 |
```python
|
241 |
primes = {i: jl.p(i*1.0) for i in range(1, 999)}
|
|
|
235 |
converts it to the same type as input.
|
236 |
|
237 |
Next, let's generate a list of primes for our test dataset.
|
238 |
+
Since we are using juliacall, we can just call `p` directly to do this:
|
239 |
|
240 |
```python
|
241 |
primes = {i: jl.p(i*1.0) for i in range(1, 999)}
|
examples/pysr_demo.ipynb
CHANGED
@@ -858,7 +858,7 @@
|
|
858 |
"(However, note that this version assumes 64-bit float input, rather than any input type `T`)\n",
|
859 |
"\n",
|
860 |
"Next, let's generate a list of primes for our test dataset.\n",
|
861 |
-
"Since we are using
|
862 |
]
|
863 |
},
|
864 |
{
|
@@ -1293,7 +1293,7 @@
|
|
1293 |
"\n",
|
1294 |
"> **Warning**\n",
|
1295 |
">\n",
|
1296 |
-
"> First, let's save the data, because sometimes PyTorch and
|
1297 |
]
|
1298 |
},
|
1299 |
{
|
@@ -1324,7 +1324,7 @@
|
|
1324 |
"id": "krhaNlwFG-KT"
|
1325 |
},
|
1326 |
"source": [
|
1327 |
-
"We can now load the data, including after a crash (be sure to re-run the import cells at the top of this notebook, including the one that starts
|
1328 |
]
|
1329 |
},
|
1330 |
{
|
@@ -1378,7 +1378,7 @@
|
|
1378 |
"id": "1a738a33"
|
1379 |
},
|
1380 |
"source": [
|
1381 |
-
"If this segfaults, restart the notebook, and run the initial imports and
|
1382 |
]
|
1383 |
},
|
1384 |
{
|
|
|
858 |
"(However, note that this version assumes 64-bit float input, rather than any input type `T`)\n",
|
859 |
"\n",
|
860 |
"Next, let's generate a list of primes for our test dataset.\n",
|
861 |
+
"Since we are using juliacall, we can just call `p` directly to do this:\n"
|
862 |
]
|
863 |
},
|
864 |
{
|
|
|
1293 |
"\n",
|
1294 |
"> **Warning**\n",
|
1295 |
">\n",
|
1296 |
+
"> First, let's save the data, because sometimes PyTorch and juliacall's C bindings interfere and cause the colab kernel to crash. If we need to restart, we can just load the data without having to retrain the network:"
|
1297 |
]
|
1298 |
},
|
1299 |
{
|
|
|
1324 |
"id": "krhaNlwFG-KT"
|
1325 |
},
|
1326 |
"source": [
|
1327 |
+
"We can now load the data, including after a crash (be sure to re-run the import cells at the top of this notebook, including the one that starts juliacall)."
|
1328 |
]
|
1329 |
},
|
1330 |
{
|
|
|
1378 |
"id": "1a738a33"
|
1379 |
},
|
1380 |
"source": [
|
1381 |
+
"If this segfaults, restart the notebook, and run the initial imports and juliacall part, but skip the PyTorch training. This is because PyTorch's C binding tends to interefere with juliacall. You can then re-run the `pkl.load` cell to import the data."
|
1382 |
]
|
1383 |
},
|
1384 |
{
|