Comments (2)
IIUC, @karpathy used A100-80G but you seem to have 40G - have you tried reducing the batch size B to say 16 or 32? https://github.com/karpathy/build-nanogpt/blob/master/train_gpt2.py#L325
from build-nanogpt.
@andytwigg Thank you for your answer. I used again 1 GPU with 40 GB and decreased the batch size to 2 and then I got another error:
[rank0]: x, y = data_loader.next_batch()
[rank0]: File "~/my_transformer/GPT.py", line 215, in next_batch
[rank0]: x = (buf[:-1]).view(B,T)
[rank0]: RuntimeError: shape '[2, 1024]' is invalid for input of size 104
I think the problem now is that in the "next_batch()" function (see line https://github.com/karpathy/build-nanogpt/blob/master/train_gpt2.py#L243), the reshaping fails because the token size does not match when the end of the buffer is reached. The code runs a while but then raises the error message mentioned above because just 104 tokens remain for processing:
buf = self.tokens[self.current_position : self.current_position+B*T+1]
x = (buf[:-1]).view(B, T)
Any idea how to address this? I was thinking to check with a modulo (%) operator whether the remaining tokens are divisble through (B*T+1). However, I think that would be a quick and dirty solution. Any other suggestions? I am wondering why it works in the tutorial. I guess I must have missed something.
from build-nanogpt.
Related Issues (16)
- Implement tensor parallelism HOT 4
- Embeddings are initialized with std of 0.02 HOT 2
- Chunking method in the original GPT-2 training dataset HOT 2
- Sharding the dataset not completing? HOT 7
- NO dropout in MLP and CausalSelfAttention HOT 1
- Is dataloader making optimal batches? HOT 1
- RuntimeError: User specified an unsupported autocast device_type 'cuda:0' HOT 1
- Running codes on Windows issues HOT 2
- Cannot get the log file "log124M_40B/log.txt"? HOT 5
- Integrating GPT-2 with deepspeed Zero-1, Zero-2 and Zero-3 HOT 1
- How to support padding in the train dataset for training ? HOT 2
- Different inference results between flash attention and manually implemented attention appeared.
- Text generation can use raw_model instead of model
- Consider using `torch.compile(model, fullgraph=True, mode="reduce-overhead")` HOT 11
- Fix torch.compile Issue - Error with HellaSwag eval and Generation
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 build-nanogpt.