Last active
December 9, 2022 20:43
-
-
Save marcossilva/4025519bda136d0cd202bef936b8d560 to your computer and use it in GitHub Desktop.
Download weights from GECToR pre-trained model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import requests | |
from tqdm import tqdm | |
TEST_FIXTURES_DIR_PATH = "test_fixtures" | |
MODEL_URL = "https://grammarly-nlp-data-public.s3.amazonaws.com/gector/roberta_1_gectorv2.th" | |
def download_weights(): | |
model_path = Path("test_fixtures/roberta_model/weights.th") | |
if not model_path.exists(): | |
response = requests.get(MODEL_URL) | |
with model_path.open("wb") as out_fp: | |
# Write out data with progress bar | |
for data in tqdm(response.iter_content()): | |
out_fp.write(data) | |
assert model_path.exists() | |
return model_path | |
download_weights() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment