+
    jHàjÅ  ã                  ó¼  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt	^ RI
t	^ RIHtHt ]P                  ! ]4      tRt^tRt/ tR]R&   Rt^€tR R	 lt]! R
R7       ! R R4      4       t]! R
R7       ! R R4      4       t]P6                  ! R]P8                  4      t]P6                  ! R]P8                  4      tRR R lltR R lt R R lt!R R lt"R R lt#R# )uÄ  Browse Hugging Face for GGUF models the user can run.

The curated catalog is the front page; this module is the firehose behind it â€” day-0 models not yet
in the catalog, community quants, anything. Acquisition only: nothing here serves a model. A browsed
download lands in the machine-scoped models dir and from that moment the normal machinery owns it â€”
staleness bounce, preset generation from the real GGUF header, fit policy, placement pills.
)ÚannotationsN)Ú	dataclassÚreplacezhttps://huggingface.cozdict[str, tuple[float, object]]Ú_CACHEi,  c               ó    € V ^8„  d   QhRRRR/# )é   ÚurlÚstrÚreturnÚobject© )Úformats   "ÚG/home/ubuntu/.hermes/hermes-agent/hermes_cli/local_runtime/hf_browse.pyÚ__annotate__r   "   s   € ÷ ñ �3ð ˜6ñ ó    c                ó@  € \         P                  ! 4       p\        P                  V 4      pV'       d"   W^ ,          ,
          \        8  d
   V^,          # \
        P                  P                  V RR/R7      p\
        P                  P                  V\        R7      ;_uu_ 4       p\        P                  ! V4      pRRR4       \        \        4      \        8¼  d&   \        P                  \        \        R R7      4       VX3\        V &   V#   + '       g   i     LZ; i)é    z
User-Agentzhermes-local-models)Úheaders)ÚtimeoutNc                ó*   € \         V ,          ^ ,          # ©r   )r   )Úks   &r   Ú<lambda>Ú_get_json.<locals>.<lambda>+   s   € ¬V°A­Y°q®\r   )Úkey)ÚtimeÚ	monotonicr   ÚgetÚ_CACHE_TTL_SÚurllibÚrequestÚRequestÚurlopenÚ
_TIMEOUT_SÚjsonÚloadÚlenÚ
_CACHE_MAXÚpopÚmin)r   ÚnowÚhitÚreqÚrÚdatas   &     r   Ú	_get_jsonr/   "   s¼   € Ü
�.Š.Ó
€CÜ
�*‰*�S‹/€Cß
ˆs˜•V�|œlÔ*Ø�1�vˆÜ
�.‰.×
 Ñ
  ¨|Ð=RÐ.SÐ
 Ó
T€CÜ	�‰×	Ñ	 ¬ZÐ	×	8Ô	8¸AÜ�yŠy˜‹|ˆ÷ 
9ä
Œ6ƒ{”jÔ Ü�
‰
”3”vÑ#9Ô:Ô;Ø˜�+„Fˆ3�KØ€K÷ 
9×	8ús   Â$DÄD	T)Úfrozenc                  óJ   € ] tR t^0t$ R]R&   R]R&   R]R&   R]R&   R]R&   R	tR
# )Ú
HFModelHitr	   ÚrepoÚintÚ	downloadsÚlikesÚupdatedÚboolÚgatedr   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Ú__static_attributes__r   r   r   r2   r2   0   s   ‡ à
ƒIØƒNØƒJØƒLØ‡Kr   r2   c                  óH   € ] tR t^9t$ RtR]R&   R]R&   R]R&   RtR]R	&   R
tR# )ÚHFFileGroupzBOne downloadable quant: a single GGUF or all parts of a split one.r	   Úlabelztuple[str, ...]Úpathsr4   Útotal_bytesÚunknownÚfitr   N)r:   r;   r<   r=   Ú__doc__r>   rF   r?   r   r   r   rA   rA   9   s    ‡ áLàƒJØÓØÓØ€Cˆ×r   rA   z!(?:IQ|Q)\d[_A-Z0-9]*|F16|BF16|F32z-(\d{5})-of-(\d{5})\.gguf$c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úqueryr	   Úlimitr4   r
   zlist[HFModelHit]r   )r   s   "r   r   r   G   s"   € ÷ %ñ %˜ð % Sð %Ð2Bñ %r   c                ó<  € \         P                  P                  V P                  4       4      p\         RV R\        ^\        \        V4      ^24      4       2p\        V4       Uu. uFª  p\        \        VP                  RR4      4      \        VP                  R4      ;'       g    ^ 4      \        VP                  R4      ;'       g    ^ 4      \        VP                  R4      ;'       g    R4      \        VP                  R4      4      R	7      NK¬  	  up# u upi )
zvFull-text search over HF models that ship GGUF files, most downloaded first (the closest
public signal to 'trending').z/api/models?search=z/&filter=gguf&sort=downloads&direction=-1&limit=ÚidÚ r5   r6   ÚlastModifiedr9   )r3   r5   r6   r7   r9   )r   ÚparseÚquoteÚstripÚ_HFÚmaxr)   r4   r/   r2   r	   r   r8   )rI   rJ   Úqr   Úms   &&   r   Úsearch_modelsrV   G   sî   € ô 	�‰×Ñ˜5Ÿ;™;›=Ó)€AÜˆUÐ% a Sð )"Ü"% a¬¬S°«Z¸Ó)<Ó"=Ð!>ð@€Cô ˜s”^ó%ñ
 $�ô œC §¡ d¨B£Ó0Ü!$ Q§U¡U¨;Ó%7×%<Ð%<¸1Ó!=Ü  §¡ w£×!4Ð!4°1Ó5Ü" 1§5¡5¨Ó#8×#>Ð#>¸BÓ?Ü! !§%¡%¨£.Ó1÷	3ñ
 $ñ%ð %ùò %s   Á&A#DÃ
"DÃ-)Dc               ó    € V ^8„  d   QhRRRR/# )r   Úfilenamer	   r
   r   )r   s   "r   r   r   U   s   € ÷ 1ñ 1˜3ð 1 3ñ 1r   c                ó~   € \         P                  V 4      pV'       d    VP                  ^ 4      P                  4       # T # r   )Ú	_QUANT_REÚsearchÚgroupÚupper)rX   rU   s   & r   Ú_quant_labelr^   U   s0   € Ü×Ñ˜Ó"€Aß!"ˆ1�7‰7�1‹:×ÑÓÐ0¨Ð0r   c               ó    € V ^8„  d   QhRRRR/# ©r   r3   r	   r
   zlist[HFFileGroup]r   )r   s   "r   r   r   Z   s   € ÷ ñ �Sð Ð.ñ r   c                ó~  € \          R\        P                  P                  V 4       R2p\	        V4      p. p/ pV EF/  p\        VP                  RR4      4      pVP                  4       P                  R4      '       g   KF  VP                  R^4      R,          P                  4       pVP                  R4      '       g   RV9   d   K�  \        VP                  R4      ;'       g    ^ 4      p\        P                  V4      p	V	'       dP   VP                  VR	V	P                  4        . 4      P!                  \        V	P#                  ^4      4      Wh34       EK  VP!                  Wh34       EK2  	  V UUu. uF  w  rh\%        \'        V4      V3VR
7      NK  	  p
ppVP)                  4        Fu  w  r¼VP+                  4        T
P!                  \%        \'        V4      \,        ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      \/        R V 4       4      R
7      4       Kw  	  V
P+                  R RR7       V
# u uppi )z´The servable GGUFs in a repo, grouped: split parts collapse into one entry (first part is
what llama.cpp loads); mmproj/draft/MTP-head companions are excluded. Largest quant first.z/api/models/z/tree/main?recursive=trueÚpathrM   z.ggufÚ/ÚdraftÚsizeN)rB   rC   rD   c              3  ó*   "  € T F	  w  rqx € K  	  R # 5i©Nr   )Ú.0Ú_Úps   &  r   Ú	<genexpr>Úrepo_files.<locals>.<genexpr>u   s   é € ÐG_ÑY^ÉgÈaÐTUÌÓY^ùs   ‚c              3  ó,   "  € T F
  w   rVx € K  	  R # 5irg   r   )rh   ri   Úss   &  r   rk   rl   v   s   é € Ð1IÁ5¹¸¸1µ!Ã5ùs   ‚c                ó   € V P                   # rg   )rD   )Úgs   &r   r   Úrepo_files.<locals>.<lambda>w   s   € ˜aŸmšmr   T)r   Úreverseéÿÿÿÿ)ÚmmprojÚdsparkzmtp-)rR   r   rO   rP   r/   r	   r   ÚlowerÚendswithÚrsplitÚ
startswithr4   Ú	_SPLIT_REr[   Ú
setdefaultÚstartÚappendr\   rA   r^   ÚitemsÚsortÚtupleÚsum)r3   r   ÚfilesÚsinglesÚsplitsÚfrb   Únamere   rU   ÚgroupsÚstemÚpartss   &            r   Ú
repo_filesrŠ   Z   sÑ  € ô ˆE�œfŸl™l×0Ñ0°Ó6Ð7Ð7PÐ
Q€CÜ�c‹N€Eà%'€GØ46€FÜˆÜ�1—5‘5˜ Ó$Ó%ˆØ�z‰z‹|×$Ñ$ W×-Ò-ÙØ�{‰{˜3 Ó" 2Õ&×,Ñ,Ó.ˆà�?‰?Ð7×8Ò8¸GÀt¼OÙÜ�1—5‘5˜“=×%Ð% AÓ&ˆÜ×Ñ˜TÓ"ˆßØ×Ñ˜d ; Q§W¡W£YÐ/°Ó4×;Ñ;¼SÀÇÁÈÃ»_ÈdÐ<Y×Zà�N‰N˜D˜<×(ñ ñ  !(ô)Ù '‘*�$ô ¤¨TÓ 2¸4¸'Èt×TÙ 'ð ñ )à—|‘|–~‰ˆØ�
‰
ŒØ�‰”k¬°TÓ(:Ç%Ä%ÑG_ÑY^ÓG_Ç%Á%ÑG_ÑY^ÓG_ÓB_Ü.1Ñ1IÁ5Ó1IÓ.IôKö 	Lñ &ð ‡K�KÑ+°T€KÔ:Ø€Mùó)s   Å4#H9c               ó    € V ^8„  d   QhRRRR/# )r   rD   r4   r
   r	   r   )r   s   "r   r   r   {   s   € ÷ ñ ˜3ð ¨3ñ r   c                óŠ   € V \         ,           pW!P                  8:  d   R# W!P                  VP                  ,           8:  d   R# R# )u®   Coarse pre-download verdict from file size alone (GGUF file size â‰ˆ in-memory weights);
the GGUF header refines this after download. Bands match the catalog pills' language.zfits-gpuz	needs-ramztoo-big)Ú_ROUGH_KV_AND_OVERHEADÚusable_vram_bytesÚram_available_bytes)rD   ÚbudgetÚneeds   && r   Ú	rough_fitr’   {   s;   € ð Ô/Õ/€DØ×'Ñ'Ô'ÙØ×'Ñ'¨&×*DÑ*DÕDÔDÙÙr   c               ó    € V ^8„  d   QhRRRR/# r`   r   )r   s   "r   r   r   †   s   € ÷ Xñ X˜Cð XÐ,=ñ Xr   c           
     ó€   € \        V 4       Uu. uF$  p\        V\        VP                  V4      R 7      NK&  	  up# u upi ))rF   )rŠ   r   r’   rD   )r3   r�   rp   s   && r   Úpriced_repo_filesr•   †   s4   € ÜFPÐQUÔFVÓWÑFVÀŒG�Aœ9 Q§]¡]°FÓ;×<ÑFVÑWÐWùÒWs   Ž*;l        )é   )$Ú__conditional_annotations__rG   Ú
__future__r   r$   ÚloggingÚrer   Úurllib.parser   Úurllib.requestÚdataclassesr   r   Ú	getLoggerr:   ÚloggerrR   r#   r�   r   r>   r   r'   r/   r2   rA   ÚcompileÚ
IGNORECASErZ   rz   rV   r^   rŠ   r’   r•   )r—   s   @r   Ú<module>r¢      sæ   øðôõ #ã Û Û 	Û Û Û ß *à	×	Ò	˜8Ó	$€à€Ø€
ð !Ð ð +-€Ð'Ó ,Ø€Ø€
õñ �$Ô÷ð ó ðñ �$Ô÷ð ó ðð �JŠJÐ;¸R¿]¹]ÓK€	Ø�JŠJÐ4°b·m±mÓD€	÷%õ1õ
õB÷Xr   