File size: 1,312 Bytes
ca687e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from huggingface_hub import HfApi
api = HfApi()

def find_public_chat_models(limit=50, scan_limit=2000, owners=None):
    """Return public chat-capable models optionally filtered by owner organizations.

    - `owners` can be an iterable of owner names (e.g., ['google','qwen']).
    """
    allowed_owners = set(o.lower() for o in owners) if owners else None
    found = []
    for m in api.list_models(pipeline_tag="text-generation", limit=scan_limit):
        if getattr(m, "private", False):
            continue
        # Extract owner from modelId (format: owner/model_name)
        model_id = m.modelId or ""
        owner = model_id.split('/', 1)[0] if '/' in model_id else None
        if allowed_owners and (owner is None or owner.lower() not in allowed_owners):
            continue
        tags = getattr(m, "tags", []) or []
        if any(t in ("chat", "conversational", "instruct", "instruction-following") for t in tags):
            found.append((m.modelId, owner, tags))
            if len(found) >= limit:
                break
    return found

# Only show models owned by 'google' or 'qwen'
for model_id, owner, tags in find_public_chat_models(limit=10, owners=["google"]):
    #print("---")
    #print(model_id, "(owner:", owner + ")", tags)
    print(model_id, "(owner:", owner + ")")