causal-text icon indicating copy to clipboard operation
causal-text copied to clipboard

Specify versions in requirements & IndexError: Target 94205689867520 is out of bounds.

Open Bryan2Chow opened this issue 3 years ago • 4 comments

Hi Reid,

Thanks for your nice work! According to the requirement.txt you have provided, there is an indication of incompatibility. So I have tried to execute "pip install -r requirement.txt" with another version number.

Could you specify the version numbers in requirements.txt?

Unfortualnately, when running python main.py --run_cb I get errors like:

Downloading: 100% 442/442 [00:00<00:00, 449kB/s] Downloading: 100% 268M/268M [00:06<00:00, 42.1MB/s] Downloading: 100% 232k/232k [00:00<00:00, 18.8MB/s] 0% 0/666 [00:10<?, ?it/s] Traceback (most recent call last): File "main.py", line 265, in result = run_experiment(args) File "main.py", line 201, in run_experiment cbw.train(df['text'], df.C_true, df.T_proxy, df.Y_sim, epochs=3) File "/content/drive/MyDrive/Colab Notebooks/causal-text/src/CausalBert.py", line 219, in train g, Q0, Q1, g_loss, Q_loss, mlm_loss = self.model(W_ids, W_len, W_mask, C, T, Y) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/content/drive/MyDrive/Colab Notebooks/causal-text/src/CausalBert.py", line 161, in forward Q_logits_T1.view(-1, self.num_labels), Y_T1_labels) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/loss.py", line 1152, in forward label_smoothing=self.label_smoothing) File "/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py", line 2846, in cross_entropy return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing) IndexError: Target 94205689867520 is out of bounds.

I have tried to solve the problem, but it still doesn’t work.

I would greatly appreciate it if you could please take a moment to help me with this issue!

Sincerely

Thanks, Bin

Bryan2Chow avatar Dec 16 '21 10:12 Bryan2Chow

Thanks for reaching out Bin!

Hmm this looks like an issue with the data instead of a version issue?

The error is torch trying to take the loss with a ground truth label having index 94205689867520.

I would reccomend checking your dataset -- could you give me the command you used to run this?

rpryzant avatar Dec 30 '21 22:12 rpryzant

Closing

rpryzant avatar Apr 14 '22 18:04 rpryzant

Dear Pryzant, I also encountered the same issue as Bin's. I am using the dataset you provided in Github. I am using the 1.10.0+cu111 version of torch.

Can you specify the version of your torch when uploading the code?

xubingze avatar Apr 17 '22 00:04 xubingze

I was able to get it to run with torch==1.6.0.

Let me know if that works for you and I will update the requirements.txt

Thanks!

rpryzant avatar Apr 18 '22 21:04 rpryzant