download.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import argparse
  15. import sys
  16. from paddle.utils.download import get_path_from_url
  17. parser = argparse.ArgumentParser()
  18. parser.add_argument(
  19. '-d',
  20. '--data_dir',
  21. help='directory to save data to',
  22. type=str,
  23. default='./')
  24. parser.add_argument(
  25. '-u',
  26. '--url',
  27. help='URL of target',
  28. type=str,
  29. default="https://bj.bcebos.com/paddlenlp/datasets/sighan_test.zip")
  30. args = parser.parse_args()
  31. def main():
  32. get_path_from_url(args.url, args.data_dir)
  33. if __name__ == '__main__':
  34. sys.exit(main())