Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3975a3370a |
24
main.py
24
main.py
@@ -123,20 +123,22 @@ def init_db():
|
||||
|
||||
def search_models(keyword: str, limit: int = 100) -> list:
|
||||
"""从 ModelScope 搜索模型"""
|
||||
url = f"{MODELSCOPE_API}/models"
|
||||
url = "https://modelscope.cn/openapi/v1/models"
|
||||
params = {
|
||||
'Query': keyword,
|
||||
'PageSize': limit,
|
||||
'SortBy': 'GITHUB_SCORE',
|
||||
'search': keyword,
|
||||
'page_size': limit,
|
||||
'page_number': 1,
|
||||
'sort': 'downloads',
|
||||
}
|
||||
try:
|
||||
resp = requests.get(url, params=params, timeout=15)
|
||||
resp = requests.get(url, params=params, timeout=20,
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
data = resp.json()
|
||||
models = data.get('Data', {}).get('Models', [])
|
||||
return models
|
||||
if data.get('success'):
|
||||
return data.get('data', {}).get('models', [])
|
||||
except Exception as e:
|
||||
log(f" 搜索失败 [{keyword}]: {e}")
|
||||
return []
|
||||
return []
|
||||
|
||||
|
||||
def check_architecture(model_id: str) -> tuple:
|
||||
@@ -367,16 +369,16 @@ def run_pipeline(gpus: list = None, submit_limit: int = 30):
|
||||
for kw in SEARCH_KEYWORDS:
|
||||
models = search_models(kw, limit=100)
|
||||
for m in models:
|
||||
mid = m.get('ModelId', m.get('Name', ''))
|
||||
mid = m.get('id', '')
|
||||
if mid and mid not in seen:
|
||||
seen.add(mid)
|
||||
downloads = m.get('Downloads', 0)
|
||||
downloads = m.get('downloads', 0)
|
||||
if downloads >= 50:
|
||||
all_models.append({
|
||||
'model_id': mid,
|
||||
'url': f"https://modelscope.cn/{mid}",
|
||||
'downloads': downloads,
|
||||
'params': m.get('Parameters', ''),
|
||||
'params': m.get('params', ''),
|
||||
'category': 'quantized' if 'GGUF' in mid.upper() else 'standard',
|
||||
})
|
||||
time.sleep(0.3)
|
||||
|
||||
Reference in New Issue
Block a user