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

prepare.py 477 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
  1. import os
  2. import json
  3. import torch
  4. from pathlib import Path
  5. from utils import preprocess
  6. from dotenv import load_dotenv
  7. load_dotenv('envs/.env')
  8. if __name__ == '__main__':
  9. vocab, config = preprocess.generate_vocabulary()
  10. vocab_path = Path(os.getenv('OUTPUT_PATH'), os.getenv('VOCAB_PATH'))
  11. torch.save(vocab, vocab_path)
  12. config_path = Path(os.getenv('OUTPUT_PATH'), os.getenv('CONFIG_PATH'))
  13. with open(config_path, 'w') as f:
  14. json.dump(config, f)
Tip!

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

Comments

Loading...