INNER CODE UNIT · Python

detect_model_len

usepr/eva · eva.py:78

def detect_model_len():
    url = f"{EVA_BASE_URL}/models"
    req = urllib.request.Request(url, headers=COMMON_HEADER)
    try:
        with urllib.request.urlopen(req, timeout=10) as resp:
            status = resp.status
            body = resp.read().decode('utf-8', errors='replace')
    except UnicodeEncodeError:
        print("错误:EVA_API_KEY 包含非 ASCII 字符,请检查 EVA_API_KEY 配置。")
        sys.exit(1)
    except urllib.error.HTTPError as e:
        status = e.code
        body = e.read().decode('utf-8', errors='replace')
    except Exception as e:
        print(f"错误:无法连接到 {EVA_BASE_URL},请检查 EVA_BASE_URL 配置。\n详情:{e}")
        sys.exit(1)

    if status == 401:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…