Upload code/agentic_chat.py with huggingface_hub
Browse files113 unmodified lines114115116117118119120121108 unmodified lines230231232233234235236237238239240241113 unmodified lines# We always load the SFT checkpoint for the chat scripttry:# Try to download the newly uploaded SFT checkpointckpt_path = hf_hub_download(repo_id=args.repo_id, filename="sft_checkpoints/sft_v1/sft_ckpt_latest.pt", token=token)except:# Fallback to local or baseckpt_path = "checkpoints/ckpt_latest_updated.pt"108 unmodified lines# Colorize think and search blocks for terminaldef colorize(match):tag = match.group(0)if "<think>" in tag: return f"\033[90m{tag}\033[0m"if "<search>" in tag: return f"\033[33m{tag}\033[0m"if "<search_result>" in tag: return f"\033[36m{tag}\033[0m"return tagdisplay_text = re.sub(r'<think>.*?</think>', colorize, full_reply_text, flags=re.DOTALL)display_text = re.sub(r'<search>.*?</search>', colorize, display_text, flags=re.DOTALL)display_text = re.sub(r'<search_result>.*?</search_result>', colorize, display_text, flags=re.DOTALL)113 unmodified lines114115116117118119120121108 unmodified lines230231232233234235236237238239240241113 unmodified lines# We always load the SFT checkpoint for the chat scripttry:# Try to download the newly uploaded SFT checkpoint (now in sft_v3)ckpt_path = hf_hub_download(repo_id=args.repo_id, filename="sft_checkpoints/sft_v3/sft_ckpt_latest.pt", token=token)except:# Fallback to local or baseckpt_path = "checkpoints/ckpt_latest_updated.pt"108 unmodified lines# Colorize think and search blocks for terminaldef colorize(match):tag = match.group(0)if "[THINK]" in tag: return f"\033[90m{tag}\033[0m"if "<search>" in tag: return f"\033[33m{tag}\033[0m"if "<search_result>" in tag: return f"\033[36m{tag}\033[0m"return tagdisplay_text = re.sub(r'\[THINK\].*?\[/THINK\]', colorize, full_reply_text, flags=re.DOTALL)display_text = re.sub(r'<search>.*?</search>', colorize, display_text, flags=re.DOTALL)display_text = re.sub(r'<search_result>.*?</search_result>', colorize, display_text, flags=re.DOTALL)
code/agentic_chat.py+4-4