Comments (9)
Hi François,
this seems like a pytorch specific problem. Can you please provide more information about your setup (cpu or gpu, torch version ($conda info))? If you have installed sjSDM via conda (or install_sjSDM()), you can use the new function install_diagnostic(), which I pushed today (which means you have to fetch the latest version and re-install sjSDM).
Best wishes,
Max
from s-jsdm.
Hello Max,
Thank you for your answer!
I have defined a cpu setup.
Here is the output of install_diagnostic() on my machine:
active environment : None
user config file : C:\Users\admmunoz\Documents.condarc
populated config files :
conda version : 4.8.3
conda-build version : 3.18.9
python version : 3.7.4.final.0
virtual packages : __cuda=10.1
base environment : C:\PROGRA3\ANACON1 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\PROGRA3\ANACON1\pkgs
C:\Users\admmunoz\Documents.conda\pkgs
C:\Users\admmunoz\AppData\Local\conda\conda\pkgs
envs directories : C:\PROGRA3\ANACON1\envs
C:\Users\admmunoz\Documents.conda\envs
C:\Users\admmunoz\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.3 requests/2.22.0 CPython/3.7.4 Windows/10 Windows/10.0.18362
administrator : True
netrc file : None
offline mode : False
Best wishes,
François
from s-jsdm.
Hi François,
unfortunately, at the moment the automatic pytorch installation is still unstable but I am actively working on this.
I committed today a few installation updates, that's why I suggest the following procedure (I hope that a re-installation solves your problem):
Update 1:
Florian is right, I was able to reproduce the error with anaconda 4.8.3... (I thought it is a MacOS related issue because the MacOS anaconda does not even allow you to install torch).
You have to uninstall anaconda 4.8.3 and install 4.8.2: https://repo.anaconda.com/miniconda/
Cheers,
Max
from s-jsdm.
I'm surprised that this ran at all, because I thought conda 4.8.3 can't install pytorch - did the install really work, or did it not, in which case the error message should be improved.
from s-jsdm.
This is a significant issue. I will report this to the pytorch community and we have to update our installation instructions... install_sjSDM() installs now automatically conda 4.8.2 so it affects only people who install anaconda themselves
from s-jsdm.
Okay, I found the source of this warning. There seems to be no issue with conda 4.8.3 on Linux/Windows but with PyTorch 1.5 and reticulate:
- reticulate translates R matrices to non writeable numpy arrays:
(reticulate::r_to_py(matrix(0.0))$flags
) - With 1.5 the pytorch team implemented a warning when a non-writeable numpy array is transformed to a tensor (in our case that happens when the env and occ matrices (X, Y) are transformed to torch tensors.
- It does not influence the model's behavior, performance, or results (see PyTorch commit: Warns on read-only Numpy array->tensor conversion (#33615))
- For now, I create copies of the actual data, which is not optimal but at least the data is still on the cpu (under the assumption that the cpu memory is not the bottleneck)
s-jSDM/sjSDM/inst/python/sjSDM_py/model_new.py
Lines 119 to 125 in cc66b35
from s-jsdm.
Thank you very much for your answers and update of the package.
I can run now the model, but my dataset is too large for the memory I have on my PC... I will try to find a different way.
FYI, here is the new diagnostic I get with the lastest version,
active environment : None
user config file : C:\Users\admmunoz\Documents\.condarc
populated config files :
conda version : 4.8.3
conda-build version : 3.18.9
python version : 3.7.4.final.0
virtual packages : __cuda=10.1
base environment : C:\PROGRA3\ANACON1 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\PROGRA3\ANACON1\pkgs
C:\Users\admmunoz\Documents.conda\pkgs
C:\Users\admmunoz\AppData\Local\conda\conda\pkgs
envs directories : C:\PROGRA3\ANACON1\envs
C:\Users\admmunoz\Documents.conda\envs
C:\Users\admmunoz\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.3 requests/2.22.0 CPython/3.7.4 Windows/10 Windows/10.0.18362
administrator : True
netrc file : None
offline mode : False
from s-jsdm.
There are two ways to reduce the memory strain:
- step_size (in sjSDM(...step_size=): By default it is set to 10% of your number sites, which is high if you have hundreds/thousands of sites or species. Maybe setting it to 1 - 20 could resolve this.
- Setting manually the "df" option in biotic=bioticStruct(df = XX). df controls the rank of the sigma matrix. By default it is set to (number of species/2) and by reducing it you lose degree of freedoms for the covariance matrix but you also reduce the memory strain
from s-jsdm.
I will keep this open... something in the code still causes the warning to appear (it appears after the tests... but I'm unable to track it down, 384 tests and the msg only appears once a session).
For now, the work-around is to use reticulate::r_to_py(matrix)$copy() i
nstead of the R-matrix when calling a python function.
from s-jsdm.
Related Issues (20)
- Shared contributions in ANOVA HOT 4
- Error when predicting to new data - error: Error : torch._C._LinAlgError: linalg.inv: The diagonal element 3 is zero HOT 4
- offset
- plotInternalStructure error HOT 4
- Species-level predictors? HOT 4
- Installation on hpc HOT 6
- Negative Binomial Throws an error in tuning HOT 1
- Question about bioticStruct() and generating Single Species SDMs from sjSDM HOT 4
- CRAN Issue
- VENN diagram Anova HOT 1
- Problem with installation HOT 1
- Error in sjSDM_cv HOT 8
- PyTorch not installed HOT 13
- Is there a way to assess the significance (p-value?) of pairwise relationships in species associations? HOT 2
- ValueError: Expected parameter rate HOT 4
- Random factors HOT 19
- ValueError: Expected value argument HOT 3
- vp codist
- sjSDM on a remote server HOT 3
- sjSDM - memory issues of anova() HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from s-jsdm.