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

utils.py 619 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
  1. import os
  2. import yaml
  3. PROJECT_PATH = os.path.realpath(os.path.join(
  4. os.path.dirname(os.path.realpath(__file__)), '..'))
  5. def make_path_relative(input_path):
  6. return os.path.relpath(os.path.realpath(input_path), PROJECT_PATH)
  7. def make_path_absolute(input_path):
  8. return os.path.join(PROJECT_PATH, input_path)
  9. def load_params(params_file='params.yaml'):
  10. with open(params_file) as fd:
  11. return yaml.safe_load(fd)
  12. def load_filelist(path: str):
  13. filelist = []
  14. with open(path, 'r') as f:
  15. for line in f.readlines():
  16. filelist.append(line.replace('\n', ''))
  17. return filelist
Tip!

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

Comments

Loading...