thuiar / TEXTOIR

TEXTOIR is the first opensource toolkit for text open intent recognition. (ACL 2021)
https://github.com/thuiar/TEXTOIR
MIT License
195 stars 30 forks source link

Trouble using TEXTOIR #53

Open IskanderW opened 8 months ago

IskanderW commented 8 months ago

Hi,

I'm trying to use your code for some time but I keep running into issues. I was wondering whether is was doing something wrong and if you could help me.

The main error I run into now is that when I try to run sh examples/run_unsup_usnid.sh

it give me the error: File "/TEXTOIR/open_intent_discovery/backbones/bert.py", line 341, in forward if not self.args.wo_ce: AttributeError: 'EasyDict' object has no attribute 'wo_ce'

But since I keep running into problems, I was wondering whether I was doing something wrong. Here is a overview of the steps I took: Based on the requirements.txt I changed conda create --name textoir python=3.6 to conda create --name textoir python=3.8.13

I ran the rest of the code:

conda` activate textoir
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch -c conda-forge  
git clone git@github.com:thuiar/TEXTOIR.git
cd TEXTOIR
cd open_intent_discovery
pip install -r requirements.txt

However based on the following series of errors:

ERROR: Could not find a version that satisfies the requirement python==3.8.13 (from versions: none)
ERROR: No matching distribution found for python==3.8.13
ERROR: Could not find a version that satisfies the requirement faiss==1.7.2 (from versions: none)
ERROR: No matching distribution found for faiss==1.7.2

ERROR: Cannot install scikit-learn==0.24.1 and scikit_learn==1.2.0 because these package versions have conflicting dependencies. ERROR: Cannot install -r requirements.txt (line 13) and Keras==2.4.3 because these package versions have conflicting dependencies. ERROR: Cannot install -r requirements.txt (line 10), -r requirements.txt (line 11), -r requirements.txt (line 12), -r requirements.txt (line 14), -r requirements.txt (line 5), -r requirements.txt (line 6), -r requirements.txt (line 9) and numpy==1.23.1 because these package versions have conflicting dependencies.

I changed the requirements.txt to:

# python>=3.8.13
easydict>=1
# faiss
# faiss_gpu>=1
Keras>=2
matplotlib>=3
nltk>=3
numpy>=1
pandas>=2
scikit_learn>=1
scipy>=1
sentence_transformers>=2
tensorflow>=2
# tensorflow_gpu>=2
torch>=1
tqdm>=4
transformers>=4
scikit-learn>=1

Next i ran sh examples/run_unsup_usnid.sh which gave me the following error:

Traceback (most recent call last):
  File "run.py", line 3, in <module>
    from backbones.base import ModelManager
  File "/TEXTOIR2/open_intent_discovery/backbones/__init__.py", line 5, in <module>
    from .sae import get_stacked_autoencoder
  File "/TEXTOIR/open_intent_discovery/backbones/sae.py", line 5, in <module>
    from keras.engine.topology import Layer, InputSpec

So in /TEXTOIR/open_intent_discovery/backbones/sae.py i changed from keras.engine.topology import Layer, InputSpec to from tensorflow.keras.layers import Layer, InputSpec

I got this error:

Traceback (most recent call last):
  File "/home/iskander/miniforge3/envs/textoir2/lib/python3.8/site-packages/transformers/utils/hub.py", line 385, in cached_file
    resolved_file = hf_hub_download(
  File "/home/iskander/miniforge3/envs/textoir2/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 110, in _inner_fn
    validate_repo_id(arg_value)
  File "/home/iskander/miniforge3/envs/textoir2/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 158, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/sharing/disk1/pretrained_embedding/bert/uncased_L-12_H-768_A-12/'. Use `repo_type` argument if needed.

/home/sharing/disk1/pretrained_embedding/bert/uncased_L-12_H-768_A-12/ seems to be hard coded somewhere. I don't remember nor can I find how i fixed it.

Anyway after fixing that I got the main error I am asking you about: File "/TEXTOIR/open_intent_discovery/backbones/bert.py", line 341, in forward if not self.args.wo_ce: AttributeError: 'EasyDict' object has no attribute 'wo_ce'

Again I cannot find any mentions of this argument anywhere.

Anyway thanks for composing TEXTOIR. I would greatly appreciate it if you could help me.

mrFocusXin commented 8 months ago

Hello, thank you very much for your attention to our work, we have updated the codes to avoid the issue, please use the latest version