Skip to content

Commit 2e44225

Browse files
committed
wip
1 parent 4cd1f83 commit 2e44225

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

.github/workflows/vllm.yml

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,53 @@ jobs:
2828
env:
2929
HF_TOKEN: ${{ secrets.HF_TOKEN }} # Make sure to set this secret in your repository settings
3030
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
3737
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
5252
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
7070
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
7575
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

Comments
 (0)