Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

distrib.py 849 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  1. from fastai.basics import *
  2. from fastai.distributed import *
  3. from reformer_fastai.all import *
  4. from reformer_fastai.expscript import *
  5. import time
  6. print('Loading data...')
  7. path = rank0_first(download_enwik8_data)
  8. print('Preparing dataloaders...')
  9. dls = rank0_first(get_enwik8_dataloader, data_path='./data', bs=4, sl=512, n_workers=4)
  10. config = TransformerLMConfigEnwik8(warn=False, verbose=False)
  11. model = TransformerLM.from_config(config)
  12. learn = get_lm_learner(dls, model)
  13. cbs = []
  14. # wandb_run, cbs = init_wandb(cbs, wandb_name=run_name, wandb_group=wandb_group,
  15. # wandb_notes=wandb_notes, wandb_tags=wandb_tags)
  16. print('Training...')
  17. with learn.distrib_ctx(): learn.fit(1, cbs=cbs)
  18. save_model = False
  19. if save_model:
  20. now = time.strftime("_%d_%m_%Y_%H:%M", time.gmtime())
  21. learn.save(f'{task}_{run_name}_{now}')
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...