@@ -28,53 +28,53 @@ jobs:
28
28
env :
29
29
HF_TOKEN : ${{ secrets.HF_TOKEN }} # Make sure to set this secret in your repository settings
30
30
run : |
31
- python -c '
32
- import os
33
- import ast
34
- import json
35
- import requests
36
- from huggingface_hub import HfApi
31
+ python -c '
32
+ import os
33
+ import ast
34
+ import json
35
+ import requests
36
+ from huggingface_hub import HfApi
37
37
38
- def extract_models_sub_dict(parsed_code, sub_dict_name) :
39
- class MODELS_SUB_LIST_VISITOR(ast.NodeVisitor) :
40
- def __init__(self) :
41
- self.key = sub_dict_name
42
- self.value = None
43
-
44
- def visit_Assign(self, node) :
45
- for target in node.targets :
46
- if isinstance(target, ast.Name) and target.id == self.key :
47
- self.value = ast.literal_eval(node.value)
48
-
49
- visitor = MODELS_SUB_LIST_VISITOR()
50
- visitor.visit(parsed_code)
51
- return visitor.value
38
+ def extract_models_sub_dict(parsed_code, sub_dict_name):
39
+ class MODELS_SUB_LIST_VISITOR(ast.NodeVisitor):
40
+ def __init__(self):
41
+ self.key = sub_dict_name
42
+ self.value = None
43
+
44
+ def visit_Assign(self, node):
45
+ for target in node.targets:
46
+ if isinstance(target, ast.Name) and target.id == self.key:
47
+ self.value = ast.literal_eval(node.value)
48
+
49
+ visitor = MODELS_SUB_LIST_VISITOR()
50
+ visitor.visit(parsed_code)
51
+ return visitor.value
52
52
53
- def extract_models_dict(source_code) :
54
- parsed_code = ast.parse(source_code)
55
- class MODELS_LIST_VISITOR(ast.NodeVisitor) :
56
- def __init__(self) :
57
- self.key = "_MODELS"
58
- self.value = {}
59
- def visit_Assign(self, node) :
60
- for target in node.targets :
61
- if not isinstance(target, ast.Name) :
62
- return
63
- if target.id == self.key :
64
- for value in node.value.values :
65
- dict = extract_models_sub_dict(parsed_code, value.id)
66
- self.value.update(dict)
67
- visitor = MODELS_LIST_VISITOR()
68
- visitor.visit(parsed_code)
69
- return visitor.value
53
+ def extract_models_dict(source_code):
54
+ parsed_code = ast.parse(source_code)
55
+ class MODELS_LIST_VISITOR(ast.NodeVisitor):
56
+ def __init__(self):
57
+ self.key = "_MODELS"
58
+ self.value = {}
59
+ def visit_Assign(self, node):
60
+ for target in node.targets:
61
+ if not isinstance(target, ast.Name):
62
+ return
63
+ if target.id == self.key:
64
+ for value in node.value.values:
65
+ dict = extract_models_sub_dict(parsed_code, value.id)
66
+ self.value.update(dict)
67
+ visitor = MODELS_LIST_VISITOR()
68
+ visitor.visit(parsed_code)
69
+ return visitor.value
70
70
71
- url = "https://raw.githubusercontent.com/vllm-project/vllm/refs/heads/main/vllm/model_executor/models/registry.py"
72
- response = requests.get(url)
73
- response.raise_for_status() # Raise an exception for bad status codes
74
- source_code = response.text
71
+ url = "https://raw.githubusercontent.com/vllm-project/vllm/refs/heads/main/vllm/model_executor/models/registry.py"
72
+ response = requests.get(url)
73
+ response.raise_for_status() # Raise an exception for bad status codes
74
+ source_code = response.text
75
75
76
- models_dict = extract_models_dict(source_code)
77
- architectures = [item for tup in models_dict.values() for item in tup]
78
- architectures_json_str = json.dumps(architectures, indent=4)
79
- json_bytes = architectures_json_str.encode("utf-8")
80
- print(architectures_json_str)'
76
+ models_dict = extract_models_dict(source_code)
77
+ architectures = [item for tup in models_dict.values() for item in tup]
78
+ architectures_json_str = json.dumps(architectures, indent=4)
79
+ json_bytes = architectures_json_str.encode("utf-8")
80
+ print(architectures_json_str)'
0 commit comments