"""Descarga fijada en la caché de Hugging Face; imprime rutas para launch.py."""
import hashlib
from pathlib import Path
from huggingface_hub import hf_hub_download,snapshot_download
repo='Qwen/Qwen2.5-3B-Instruct-GGUF';revision='7dabda4d13d513e3e842b20f0d435c732f172cbe'
filename='qwen2.5-3b-instruct-q4_k_m.gguf'
expected='626b4a6678b86442240e33df819e00132d3ba7dddfe1cdc4fbb18e0a9615c62d'
file=Path(hf_hub_download(repo,filename,revision=revision))
digest=hashlib.sha256()
with file.open('rb') as stream:
    for chunk in iter(lambda:stream.read(1024*1024),b''):digest.update(chunk)
if digest.hexdigest()!=expected:raise ValueError('SHA-256 no coincide con el archivo fijado')
tokenizer=snapshot_download('Qwen/Qwen2.5-3B-Instruct',revision='aa8e72537993ba99e69dfaafa59ed015b17504d1',
                            allow_patterns=['config.json','tokenizer.json','tokenizer_config.json','vocab.json','merges.txt','special_tokens_map.json','generation_config.json'])
print('GGUF verificado:',file)
print('Tokenizador y configuración:',tokenizer)
