-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
train error #22
Comments
This is my script: `import gzip import numpy as np from long_net.model import LongNetTransformer, AutoregressiveWrapper constantsNUM_BATCHES = int(1e5) helpersdef cycle(loader): def decode_token(token): def decode_tokens(tokens): instantiate GPT-like decoder modelmodel = LongNetTransformer(num_tokens=256, dim=512, depth=8) model = AutoregressiveWrapper(model, max_seq_len=SEQ_LEN) model.cuda()prepare enwik8 datawith open("./MGYG000002546-uvig-560334.txt") as file: class TextSamplerDataset(Dataset):
train_dataset = TextSamplerDataset(data_train, SEQ_LEN) optimizeroptim = StableAdamWUnfused(model.parameters(), lr=LEARNING_RATE) trainingfor i in tqdm.tqdm(range(NUM_BATCHES), mininterval=10.0, desc="training"):
|
The error is in model.cuda you can take that off or say model.to("cpu") |
Thank you, but I try both and got the same error. |
@ZTYyy can you please show me the stack trace |
Sorry, I don't know how to give you more trace. 2023-12-24 12:16:41,972 - root - ERROR - forward() takes 2 positional arguments but 4 were given |
I want to try using my genomic data to train this model, because it is the only model I have found that allows for complete input of a genome (I am using a bacterial genome with a length of around 5 million base pairs). |
I think the problem might be in the line "attn = self.attn(q, k, v)" in model.py. |
@ZTYyy Please attempt to run your script once more, I believe the error has been eliminated |
I ran train.py and got error below
Traceback (most recent call last): File "/public/home/wangycgroup/public/02_Data/Internal/phage/train.py", line 86, in <module> loss = model(next(train_loader)) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/long_net/model.py", line 326, in forward logits = self.net(x_inp, **kwargs) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/long_net/model.py", line 272, in forward x = self.transformer(x) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/long_net/model.py", line 245, in forward x = block(x) + x File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/long_net/model.py", line 206, in forward attn = self.attn(q, k, v) File "/public/home/wangycgroup/wangjn/software/miniconda3/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) TypeError: forward() takes 2 positional arguments but 4 were given
the output is
`No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
Using StableAdamWUnfused-v1
training: 0%| | 0/100000 [00:00<?, ?it/s]
training: 0%| | 0/100000 [00:00<?, ?it/s]
`
Upvote & Fund
The text was updated successfully, but these errors were encountered: