This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support read file from http URL (#1317)
Summary: ## Motivation and Context 1) We want to read pre-train model files from a public http/https URL using PathManager 2) As fvcore is available in PyPI, we should add it as dependency, such that we can use HTTPURLHandler to read http/https URL #1220 ## How Has This Been Tested I'm able to download model file in Python Console. I'm not adding a unit test as it adds complexity to exclude the test for internal use case. >>> with PathManager.open("https://dl.fbaipublicfiles.com/pytext/models/roberta/roberta_public.pt1", "rb") as f: ... print(len(f.read())) ... roberta_public.pt1: 9%|█████▊ | 44.4M/497M [00:07<01:22, 5.47MB/s] roberta_public.pt1: 497MB [01:19, 6.25MB/s] 497003753 ## Types of changes - [ ] Docs change / refactoring / dependency upgrade - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist - [x] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. - [x] I have completed my CLA (see **CONTRIBUTING**) - [ ] I have added tests to cover my changes. - [x] All new and existing tests passed. Pull Request resolved: #1317 Reviewed By: m3rlin45 Differential Revision: D21011330 Pulled By: hudeven fbshipit-source-id: 6a7696f460aaa26b2d6fc9d4ae431502efb23875
- Loading branch information