admin commited on
Commit
011a462
·
1 Parent(s): e2308b4

Update vi_backbones.py

Browse files
Files changed (1) hide show
  1. vi_backbones.py +20 -24
vi_backbones.py CHANGED
@@ -3,9 +3,7 @@ import re
3
  import hashlib
4
  import requests
5
  import datasets
6
- # import subprocess
7
  from bs4 import BeautifulSoup
8
- # subprocess.call(['pip', 'install', 'torchvision'])
9
 
10
  _DBNAME = os.path.basename(__file__).split('.')[0]
11
  _HOMEPAGE = "https://huggingface.co/datasets/george-chou/" + _DBNAME
@@ -32,26 +30,26 @@ class vi_backbones(datasets.GeneratorBasedBuilder):
32
  license="mit"
33
  )
34
 
35
- def _get_file_md5(self, url):
36
- """
37
- Calculate the MD5 hash value of a file using its URL
38
-
39
- :param url: the URL address of the file
40
- :return: the MD5 hash value in string format
41
- """
42
- try:
43
- response = requests.get(url, stream=True)
44
- if response.status_code == 200:
45
- md5obj = hashlib.md5()
46
- for chunk in response.iter_content(chunk_size=1024*1024):
47
- md5obj.update(chunk)
48
- return md5obj.hexdigest()
49
- else:
50
- raise ValueError(
51
- f"Error downloading file from {url}. Status code: {response.status_code}")
52
- except Exception as e:
53
- raise ValueError(
54
- f"Error calculating MD5 of file at {url}: {str(e)}")
55
 
56
  def _parse_url(self, url):
57
  response = requests.get(url)
@@ -97,8 +95,6 @@ class vi_backbones(datasets.GeneratorBasedBuilder):
97
  ul = article.find('ul').find('ul')
98
  in1k_v1, in1k_v2 = [], []
99
 
100
- # import torchvision.models as models
101
-
102
  for li in ul.find_all('li'):
103
  name = str(li.text)
104
  if name.__contains__('torchvision.models.') and len(name.split('.')) == 3:
 
3
  import hashlib
4
  import requests
5
  import datasets
 
6
  from bs4 import BeautifulSoup
 
7
 
8
  _DBNAME = os.path.basename(__file__).split('.')[0]
9
  _HOMEPAGE = "https://huggingface.co/datasets/george-chou/" + _DBNAME
 
30
  license="mit"
31
  )
32
 
33
+ # def _get_file_md5(self, url):
34
+ # """
35
+ # Calculate the MD5 hash value of a file using its URL
36
+
37
+ # :param url: the URL address of the file
38
+ # :return: the MD5 hash value in string format
39
+ # """
40
+ # try:
41
+ # response = requests.get(url, stream=True)
42
+ # if response.status_code == 200:
43
+ # md5obj = hashlib.md5()
44
+ # for chunk in response.iter_content(chunk_size=1024*1024):
45
+ # md5obj.update(chunk)
46
+ # return md5obj.hexdigest()
47
+ # else:
48
+ # raise ValueError(
49
+ # f"Error downloading file from {url}. Status code: {response.status_code}")
50
+ # except Exception as e:
51
+ # raise ValueError(
52
+ # f"Error calculating MD5 of file at {url}: {str(e)}")
53
 
54
  def _parse_url(self, url):
55
  response = requests.get(url)
 
95
  ul = article.find('ul').find('ul')
96
  in1k_v1, in1k_v2 = [], []
97
 
 
 
98
  for li in ul.find_all('li'):
99
  name = str(li.text)
100
  if name.__contains__('torchvision.models.') and len(name.split('.')) == 3: