Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define the default SSL context #1574

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def download_url(url, root, filename=None, md5=None): # pragma: no cover
md5 (str): the md5 string.
"""
import urllib
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
root = os.path.expanduser(root)
if not filename:
filename = os.path.basename(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@
import tempfile
import urllib.request
import zipfile
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

TASKS = ["CoLA", "SST", "MRPC", "QQP", "STS", "MNLI", "QNLI", "RTE", "WNLI", "diagnostic"]
TASK2PATH = {"CoLA":'https://dl.fbaipublicfiles.com/glue/data/CoLA.zip',
"SST":'https://dl.fbaipublicfiles.com/glue/data/SST-2.zip',
"QQP":'https://dl.fbaipublicfiles.com/glue/data/STS-B.zip',
"STS":'https://dl.fbaipublicfiles.com/glue/data/QQP-clean.zip',
"MNLI":'https://dl.fbaipublicfiles.com/glue/data/MNLI.zip',
"QNLI":'https://dl.fbaipublicfiles.com/glue/data/QNLIv2.zip',
"RTE":'https://dl.fbaipublicfiles.com/glue/data/RTE.zip',
"WNLI":'https://dl.fbaipublicfiles.com/glue/data/WNLI.zip',
"MRPC":"https://raw.githubusercontent.com/MegEngine/Models/master/official/nlp/bert/glue_data/MRPC/dev_ids.tsv",
"diagnostic":'https://dl.fbaipublicfiles.com/glue/data/AX.tsv'}
TASK2PATH = {"CoLA": 'https://dl.fbaipublicfiles.com/glue/data/CoLA.zip',
"SST": 'https://dl.fbaipublicfiles.com/glue/data/SST-2.zip',
"QQP": 'https://dl.fbaipublicfiles.com/glue/data/STS-B.zip',
"STS": 'https://dl.fbaipublicfiles.com/glue/data/QQP-clean.zip',
"MNLI": 'https://dl.fbaipublicfiles.com/glue/data/MNLI.zip',
"QNLI": 'https://dl.fbaipublicfiles.com/glue/data/QNLIv2.zip',
"RTE": 'https://dl.fbaipublicfiles.com/glue/data/RTE.zip',
"WNLI": 'https://dl.fbaipublicfiles.com/glue/data/WNLI.zip',
"MRPC": "https://raw.githubusercontent.com/MegEngine/Models/master/official/nlp/bert/glue_data/MRPC/dev_ids.tsv",
"diagnostic": 'https://dl.fbaipublicfiles.com/glue/data/AX.tsv'}

MRPC_TRAIN = 'https://dl.fbaipublicfiles.com/senteval/senteval_data/msr_paraphrase_train.txt'
MRPC_TEST = 'https://dl.fbaipublicfiles.com/senteval/senteval_data/msr_paraphrase_test.txt'
Expand Down
3 changes: 3 additions & 0 deletions neural_compressor/data/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ def download_url(url, root, filename=None, md5=None): # pragma: no cover
filename (str): the file name for saving.
md5 (str): the md5 string.
"""
import ssl
import urllib

ssl._create_default_https_context = ssl._create_unverified_context

root = os.path.expanduser(root)
if not filename:
filename = os.path.basename(url)
Expand Down
3 changes: 3 additions & 0 deletions neural_compressor/experimental/data/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ def download_url(url, root, filename=None, md5=None): # pragma: no cover
filename (str): the file name for saving.
md5 (str): the md5 string.
"""
import ssl
import urllib

ssl._create_default_https_context = ssl._create_unverified_context

root = os.path.expanduser(root)
if not filename:
filename = os.path.basename(url)
Expand Down
3 changes: 3 additions & 0 deletions test/data/test_exp_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,11 @@ def testRandomResizedCrop(self):

def testSquadV1(self):
import json
import ssl
import urllib

ssl._create_default_https_context = ssl._create_unverified_context

vocab_url = (
"https://raw.githubusercontent.com/microsoft/SDNet/master/bert_vocab_files/bert-large-uncased-vocab.txt"
)
Expand Down
3 changes: 3 additions & 0 deletions test/data/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,11 @@ def testRandomResizedCrop(self):

def testSquadV1(self):
import json
import ssl
import urllib

ssl._create_default_https_context = ssl._create_unverified_context

vocab_url = (
"https://raw.githubusercontent.com/microsoft/SDNet/master/bert_vocab_files/bert-large-uncased-vocab.txt"
)
Expand Down