orasanen / ALICE

Automatic LInguistic Unit Count Estimator (ALICE)
44 stars 11 forks source link

Demo run gives an error " Something went wrong when applying the model Aborting". #21

Closed AnishaKarthyedath closed 2 years ago

AnishaKarthyedath commented 3 years ago

I tried the tutorial given on GitHub. I am not able to run the demo without error. Running the command ./run_ALICE.sh demo/ROS_5271_20_01_03600_snippet_mono.wav gives the error

_"Test set: 0it [00:00, ?it/s]/Users/karthyedath.1/ALICE/voice-type-classifier/apply.sh: line 145: 80104 Segmentation fault: 11 pyannote-audio mlt apply --$DEVICE --batch=$BATCH --subset=test --parallel=8 $VALDIR $bn.SpeakerDiarization.All Something went wrong when applying the model Aborting".

I am using MacOS Attaching the error. Could anyone please help me to resolve this issue?

Screen Shot 2021-08-06 at 4 31 17 PM
choward232 commented 3 years ago

I'm also facing this issue!

orasanen commented 2 years ago

I can confirm that I also now get this error when applying ALICE, and I'm looking into this.

./run_ALICE.sh demo/ROS_5271_20_01_03600_snippet_mono.wav Creating config for pyannote. Done creating config for pyannote. Test set: 0it [00:00, ?it/s]/Users/rasaneno/Documents/koodit/dists/ALICE_newdiar/ALICE/voice-type-classifier/apply.sh: line 145: 26226 Segmentation fault: 11 pyannote-audio mlt apply --$DEVICE --batch=$BATCH --subset=test --parallel=8 $VAL_DIR $bn.SpeakerDiarization.All Something went wrong when applying the model Aborting.

Edit: this seems to relate to voice-type-classifier, as direct call of apply.sh also fails

cd voice-type-classifier sh apply.sh /Users/rasaneno/Documents/koodit/dists/ALICE/demo/ Creating config for pyannote. Done creating config for pyannote. Test set: 0it [00:00, ?it/s]apply.sh: line 145: 30068 Segmentation fault: 11 pyannote-audio mlt apply --$DEVICE --batch=$BATCH --subset=test --parallel=8 $VAL_DIR $bn.SpeakerDiarization.All Something went wrong when applying the model Aborting.

MarvinLvn commented 2 years ago

Arg, so annoying !!!

Unfortunately, I'm not able to reproduce this error :/

Screenshot from 2021-10-04 14-10-51

So it might be a MAC-specific problem... At this point, I think it would be useful to compare our dependencies. Could you please give me the output of :

conda activate ALICE
pip list

Also attaching mine :

marvin_alice_dependencies.txt

orasanen commented 2 years ago

Here's my list. The problem appeared after my MacOS (11.16) was re-installed from scratch, and as a part of that, I installed newest anaconda as well.

Package Version


absl-py 0.8.1
alembic 1.3.3
astor 0.8.0
audioread 2.1.8
cachetools 4.2.4
certifi 2019.11.28
cffi 1.13.2
charset-normalizer 2.0.6
cliff 2.18.0
cmaes 0.8.2
cmd2 0.8.9
colorlog 4.1.0
cycler 0.10.0
dataclasses 0.7
decorator 4.4.1
dlib 19.19.0
docopt 0.6.2
filelock 3.0.12
gast 0.5.2
google-auth 1.35.0
google-auth-oauthlib 0.4.6
google-pasta 0.1.8
grpcio 1.41.0
h5py 2.10.0
idna 3.2
joblib 0.14.1
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
librosa 0.7.2
llvmlite 0.31.0
Mako 1.1.1
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.2
mpmath 1.1.0
munkres 1.1.2
networkx 2.4
numba 0.48.0
numpy 1.17.5
oauthlib 3.1.1
opt-einsum 0+untagged.49.gdbede45.dirty optuna 2.10.0
packaging 21.0
pandas 1.1.5
pbr 5.4.4
pescador 2.1.0
Pillow 8.3.2
pip 20.0.2
prettytable 0.7.2
protobuf 3.11.2
pyannote.audio 0+unknown
pyannote.core 3.7.1
pyannote.database 3.0.1
pyannote.metrics 2.3
pyannote.pipeline 1.5
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.19
pyparsing 2.4.6
pyperclip 1.7.0
python-dateutil 2.8.1
python-editor 1.0.4
python-speech-features 0.6
pytz 2019.3
PyYAML 5.4.1
pyzmq 22.3.0
requests 2.26.0
requests-oauthlib 1.3.0
resampy 0.2.2
rsa 4.7.2
scikit-learn 0.24.2
scipy 1.4.1
setuptools 45.1.0.post20200119
simplejson 3.17.0
six 1.14.0
sortedcollections 2.1.0
sortedcontainers 2.4.0
SoundFile 0.10.3.post1
SQLAlchemy 1.3.13
stevedore 1.31.0
sympy 1.5.1
tabulate 0.8.6
tensorboard 2.6.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorboardX 2.0
tensorflow 1.10.1
termcolor 1.1.0
threadpoolctl 3.0.0
torch 1.4.0
tqdm 4.62.3
typing 3.7.4.1
typing-extensions 3.10.0.2
urllib3 1.26.7
wcwidth 0.1.8
webencodings 0.5.1
Werkzeug 0.16.1
wheel 0.34.1
wrapt 1.11.2
xarray 0.11.0

MarvinLvn commented 2 years ago

Ok, we have the exact same dependencies then.

When I'm running ALICE on a very long audio file (+10 hours) on CPU, it takes forever, but it doesn't throw any error. So the problem doesn't seem to come from the quantity of memory the program is using.

The Segmentation Fault seems to indicate that the program is trying to access a memory location it is not allowed to access. What seems very strange, is that the demo used to work in the past, right Okko ?

It would be very useful to know which line from pyannote throws this segmentation fault ...

I'm just trying to think, but to be honest, I'm a little lost on that one ... Here are some ideas we may investigate :

1) Does python -c "import dlib" throw an error ? See https://github.com/pyannote/pyannote-audio/issues/142

2) Does uninstalling/installing matplotlib solve the issue ? See this stackoverflow post That seems very unlikely, but authors of this post are facing a very similar situation : their code used to work, but after an upgrade, a 'Segmentation Fault 11' is thrown

Trying to think of more ideas ... (need a coffee refill :))

hbredin commented 2 years ago

My two cents: recent Python on recent macOS broke a few things. Can you try updating pyannote.metrics to the latest version? pip install pyannote.metrics==3.1

MarvinLvn commented 2 years ago

The master comes to the rescue *_*

hadware commented 2 years ago

I ran pip install pyannote.metrics==3.1, and now it seems to be working, my soundcard's driver is fixed, my PC runs twice as fast, and my dog doesn't chase his tail anymore. All hail.

orasanen commented 2 years ago

After the pyannote metrics 3.1 install, I now get this:

Creating config for pyannote. Done creating config for pyannote. Traceback (most recent call last): File "/opt/anaconda3/envs/alice/bin/pyannote-audio", line 8, in sys.exit(main()) File "/opt/anaconda3/envs/ALICE/lib/python3.6/site-packages/pyannote/audio/applications/pyannote_audio.py", line 452, in main Application.apply_pretrained(validate_dir, protocol, **params) File "/opt/anaconda3/envs/ALICE/lib/python3.6/site-packages/pyannote/audio/applications/labels_detection.py", line 450, in apply_pretrained preprocessors=preprocessors) TypeError: get_protocol() got an unexpected keyword argument 'progress' Something went wrong when applying the model Aborting.

MarvinLvn commented 2 years ago

My two cents: recent Python on recent macOS broke a few things. Can you try updating pyannote.metrics to the latest version? pip install pyannote.metrics==3.1

This has for side effect to :

I'm not 100% sure we want to go down that road ... This causes many little bugs in the inference code as the update changed the way we load the data. I could probably fix all of them, but that means fixing all the little issues in the code responsible for training the model too (this would probably take much more time, and @hadware is currently working on integrating the vtc in the newest pyannote). + I'm a little bit scared that it would break the reproducibility of the results. That's also why we first chose to freeze all dependencies, at this time I naively thought it would ensure minimal issues during installation.

@hbredin could you let me know your thoughts please ? Maybe another workaround would consist in deactivating pyannote-metrics ? Not 100% ideal neither but the code is just supposed to generate the prediction of the pretrained model.

orasanen commented 2 years ago

As said, pyannote.metrics==3.1 does not fix the problem, but changes the error a bit.

I noticed that ALICE.yml has this as the last entry (for pip installs): " - voice-type-classifier/pyannote-audio/"

i.e., it doesn't have any version specification. I wonder if that can cause some problem here?

hbredin commented 2 years ago

@hbredin could you let me know your thoughts please ? Maybe another workaround would consist in deactivating pyannote-metrics ? Not 100% ideal neither but the code is just supposed to generate the prediction of the pretrained model.

If you do not use pyannote.metrics at all in ALICE, the safest and most perennial way is indeed to not import it :-)

hbredin commented 2 years ago

As said, pyannote.metrics==3.1 does not fix the problem, but changes the error a bit.

What @MarvinLvn meant is that updating pyannote.metrics to 3.1 leads to a cascade of other updates. In particular, it also updates pyannote.database that now gives you this error.

So +1 for not importing pyannote.metrics at all @MarvinLvn

MarvinLvn commented 2 years ago

Thanks a lot for your help @hbredin ! Taking care of that as soon as possible :)

orasanen commented 2 years ago

Right, is there a way to not to install pyannote.metrics when creating the conda env from .yml? I tried to remove pyannote.metrics from the .yml completely, but it apparently gets installed as a dependency for some other package of pyannote automatically. I then also removed the whole pyannote from the .yml and tried to install just pyannote.audio==1.1 with pip. But as a result, I still get this:

pyannote-audio --version pyannote-audio 2.0

and pip list says that pyannote.metrics is also 3.1.

MarvinLvn commented 2 years ago

I noticed that ALICE.yml has this as the last entry (for pip installs): " - voice-type-classifier/pyannote-audio/"

The pyannote-audio library is installed from source (you have access to the code locally in ALICE/voice-type-classifier/pyannote-audio), that is why there's no version specification.

Right, is there a way to not to install pyannote.metrics when creating the conda env from .yml? I tried to remove pyannote.metrics from the .yml completely, but it apparently gets installed as a dependency for some other package of pyannote automatically. I then also removed the whole pyannote from the .yml and tried to install just pyannote.audio==1.1 with pip.

You have import statements in the code like from pyannote.metrics.detection import DetectionPrecision. Not installing pyannote.metrics would break these dependencies.

Anyway, I checked and the code doesn't call any metrics, so I don't think the problem comes from pyannote.metrics

Okko, line 120 of voice-type-classifier/apply.sh, there's a line that looks like :

pyannote-audio mlt apply --$DEVICE --batch=$BATCH --subset=test --parallel=8 $VAL_DIR $bn.SpeakerDiarization.All

From a fresh install (the kind of install that returns you the segmentation fault :)), could you please try to directly modify apply.sh with --parallel=1 ?

hbredin commented 2 years ago

Anyway, I checked and the code doesn't call any metrics, so I don't think the problem comes from pyannote.metrics

It does not call any metric but just importing it raises the error in recent macOS

MarvinLvn commented 2 years ago

Oh, alright. Thanks for the info. How strange! Please @orasanen, ignore my message above :)

hbredin commented 2 years ago

Not that strange if you look at pyannote/metrics/init.py

MarvinLvn commented 2 years ago

Thanks a lot @hbredin :) Indeed, not that strange :) @orasanen hopefull the pull request https://github.com/orasanen/ALICE/pull/23 will solve this issue !

orasanen commented 2 years ago

This issue is now resolved by adding separate conda envs for macOS and Linux. Please re-install ALICE with the new environment. Let me know if there are still issues.

Tested for macOS 10.13.6 (High Sierra) and 11.6 (Big Sur).