repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/observability/prompt_versioning.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:40.494829 | import opik
from loguru import logger
class Prompt:
def __init__(self, name: str, prompt: str) -> None:
self.name = name
try:
self.__prompt = opik.Prompt(name=name, prompt=prompt)
except Exception:
logger.warning(
"Can't use Opik to version the promp... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/base.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:40.850031 | from abc import ABC, abstractmethod
from typing import Union
class STTModel(ABC):
"""
Abstract base class for Speech-to-Text models.
All STT model implementations must inherit from this class
and implement the stt method.
"""
@abstractmethod
async def stt(self, audio_data: Union[bytes, s... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/groq/whisper.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.104318 | from fastrtc import audio_to_bytes
from openai import OpenAI
from realtime_phone_agents.config import settings
from realtime_phone_agents.stt.base import STTModel
class WhisperGroqSTT(STTModel):
"""Speech-to-Text model using Whisper from Groq provider."""
def __init__(self, model_name: str = settings.groq.s... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/agent/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.261302 | def model_has_tool_calls(model_step_data) -> bool:
"""
Heuristic: returns True if this 'model' step contains tool_calls.
The exact schema depends on your agent; adjust as needed.
"""
msgs = None
if isinstance(model_step_data, dict) and "messages" in model_step_data:
msgs = model_step_dat... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/agent/stream.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.267485 | from fastrtc import Stream
from fastapi.responses import HTMLResponse
from fastapi.requests import Request
from loguru import logger
from typing import Any, Callable, Literal
from gradio.components.base import Component
from fastrtc.tracks import HandlerType
from fastrtc.utils import RTCConfigurationCallable
class Vo... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/agent/tools/property_search.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.285713 | import json
from langchain.tools import tool
from realtime_phone_agents.infrastructure.superlinked.service import (
get_property_search_service,
)
@tool
def search_property_mock_tool(location: str) -> str:
"""Retrieve real estate details for properties in a given location."""
return (
"I found o... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/api/models.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.287199 | from pydantic import BaseModel, Field
class IngestRequest(BaseModel):
"""Request model for ingesting properties into the vector database."""
data_path: str = Field(
..., description="Path to the CSV file containing property data"
)
class SearchRequest(BaseModel):
"""Request model for search... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/api/main.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.310888 | from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from realtime_phone_agents.api.routes import health, superlinked, voice
from realtime_phone_agents.api.routes.voice import mount_voice_stream
from realtime_phone_agents.infrastructure.superlinked.... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/local/moonshine.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.391724 | from fastrtc import get_stt_model
from realtime_phone_agents.stt.base import STTModel
class MoonshineSTT(STTModel):
"""Speech-to-Text model using Moonshine."""
def __init__(self):
self.moonshine_client = get_stt_model()
def stt(self, audio_data: bytes) -> str:
return self.moonshine_clie... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/runpod/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.442643 | from .faster_whisper.model import FasterWhisperSTT
from .faster_whisper.options import FasterWhisperSTTOptions
__all__ = ["FasterWhisperSTT", "FasterWhisperSTTOptions"]
|
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/runpod/faster_whisper/model.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.772189 | from fastrtc import audio_to_bytes
from openai import OpenAI
from realtime_phone_agents.stt.base import STTModel
from realtime_phone_agents.stt.runpod.faster_whisper.options import (
FasterWhisperSTTOptions,
)
class FasterWhisperSTT(STTModel):
"""Speech-to-Text model using Faster Whisper."""
def __init_... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/runpod/faster_whisper/options.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.835768 | from pydantic import BaseModel, Field
from realtime_phone_agents.config import settings
class FasterWhisperSTTOptions(BaseModel):
"""Faster Whisper STT options with defaults from Pydantic settings."""
api_url: str = Field(
default_factory=lambda: settings.faster_whisper.api_url,
description=... |
neural-maze/realtime-phone-agents-course | https://github.com/neural-maze/realtime-phone-agents-course | null | null | null | null | 973 | null | null | mit | null | null | null | null | null | null | null | src/realtime_phone_agents/stt/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:41.865674 | from realtime_phone_agents.stt.base import STTModel
from realtime_phone_agents.stt.groq.whisper import WhisperGroqSTT
from realtime_phone_agents.stt.local.moonshine import MoonshineSTT
from realtime_phone_agents.stt.runpod import FasterWhisperSTT
def get_stt_model(model: str) -> STTModel:
"""Get the STT model bas... |
ViggoZ/producthunt-daily-hot | https://github.com/ViggoZ/producthunt-daily-hot | null | null | null | null | 972 | null | null | mit | null | null | null | null | null | null | null | scripts/publish_to_wordpress.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:44.294327 | import os
import markdown
import requests
from datetime import datetime, timezone
# 加载 .env 文件
# load_dotenv()
def publish_to_wordpress():
wordpress_url = os.getenv('WORDPRESS_URL')
wordpress_username = os.getenv('WORDPRESS_USERNAME')
wordpress_password = os.getenv('WORDPRESS_PASSWORD')
# 获取今天的日期并格式... |
ViggoZ/producthunt-daily-hot | https://github.com/ViggoZ/producthunt-daily-hot | null | null | null | null | 972 | null | null | mit | null | null | null | null | null | null | null | scripts/republish_to_wordpress.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:44.306209 | import os
import markdown
import requests
import argparse
from datetime import datetime, timezone
from dotenv import load_dotenv
# 加载 .env 文件
load_dotenv()
def republish_to_wordpress(file_path):
"""重新发布指定的 Markdown 文件到 WordPress"""
wordpress_url = os.getenv('WORDPRESS_URL')
wordpress_username = os.getenv... |
ViggoZ/producthunt-daily-hot | https://github.com/ViggoZ/producthunt-daily-hot | null | null | null | null | 972 | null | null | mit | null | null | null | null | null | null | null | scripts/batch_republish.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:44.307000 | import os
import glob
import argparse
import time
from datetime import datetime, timedelta
from republish_to_wordpress import republish_to_wordpress
def batch_republish(start_date, end_date, pause=5):
"""批量重新发布指定日期范围内的 Markdown 文件"""
# 解析日期
start = datetime.strptime(start_date, '%Y-%m-%d')
end = dateti... |
ViggoZ/producthunt-daily-hot | https://github.com/ViggoZ/producthunt-daily-hot | null | null | null | null | 972 | null | null | mit | null | null | null | null | null | null | null | scripts/product_hunt_list_to_md.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:44.315420 | import os
try:
from dotenv import load_dotenv
# 加载 .env 文件
load_dotenv()
except ImportError:
# 在 GitHub Actions 等环境中,环境变量已经设置好,不需要 dotenv
print("dotenv 模块未安装,将直接使用环境变量")
import requests
from datetime import datetime, timedelta, timezone
import openai
from bs4 import BeautifulSoup
import pytz
from r... |
ViggoZ/producthunt-daily-hot | https://github.com/ViggoZ/producthunt-daily-hot | null | null | null | null | 972 | null | null | mit | null | null | null | null | null | null | null | scripts/fix_images.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:44.319380 | import os
import re
import requests
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
import json
import argparse
import glob
import time
import random
# 尝试加载 .env 文件
try:
from dotenv import load_dotenv
load_dotenv()
print("已加载 .env 文件中的环境变量")
except ImportError:
print("dotenv 模块未安... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | data_provider/data_loader_benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.397145 | import warnings
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from utils.timefeatures import time_features
warnings.filterwarnings('ignore')
class CIDatasetBenchmark(Dataset):
def __init__(self, root_path='dataset', flag='train', in... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | exp/exp_basic.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.447296 | import os
import torch
from models import TrmEncoder, Timer
class Exp_Basic(object):
def __init__(self, args):
self.args = args
self.model_dict = {
'TrmEncoder': TrmEncoder,
'Timer': Timer,
}
if self.args.use_multi_gpu:
self.model = self._build... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | data_provider/data_factory.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.452318 | import os
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from data_provider.data_loader import Dataset_ETT_hour, Dataset_ETT_minute, \
Dataset_Custom, Dataset_PEMS, UCRAnomalyloader
from data_provider.data_loader_benchmark import CIDatasetBenchmark, \
CIAut... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | exp/exp_anomaly_detection.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.453803 | import torch.multiprocessing
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.tools import adjust_learning_rate, visual
torch.multiprocessing.set_sharing_strategy('file_system')
import torch
import torch.nn as nn
from torch import optim
import os
import time
import w... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | layers/Embed.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.462718 | import math
import torch
import torch.nn as nn
class PositionalEmbedding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEmbedding, self).__init__()
# Compute the positional encodings once in log space.
pe = torch.zeros(max_len, d_model).float()
pe.require_gr... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | exp/exp_forecast.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.465464 | import os
import time
import warnings
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
from torch import optim
from torch.nn.parallel import DistributedDataParallel as DDP
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.metrics ... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | data_provider/data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.473404 | import os
import warnings
import numpy as np
import pandas as pd
import torch
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from utils.timefeatures import time_features
warnings.filterwarnings('ignore')
class Dataset_ETT_hour(Dataset):
def __init__(self, root_path, flag=... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | exp/exp_imputation.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:46.509893 | import os
import time
import warnings
import numpy as np
import torch
import torch.nn as nn
from torch import optim
from data_provider.data_factory import data_provider
from exp.exp_basic import Exp_Basic
from utils.metrics import metric
from utils.tools import EarlyStopping, adjust_learning_rate, visual
warnings.fi... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | models/TimerBackbone.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.446121 | import torch
from torch import nn
from layers.Embed import PatchEmbedding
from layers.SelfAttention_Family import AttentionLayer, FullAttention
from layers.Transformer_EncDec import Encoder, EncoderLayer
class Model(nn.Module):
def __init__(self, configs):
super().__init__()
self.task_name = conf... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/UTSD/dataset_evaluation.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.464075 | from arch.unitroot import ADF
from scipy.stats import entropy
import numpy as np
import torch
import argparse
from datasets import load_from_disk
def adf_evaluator(x):
return ADF(x).stat
def forecastability_evaluator(x, seq_len=256):
x = torch.tensor(x).squeeze() # L
forecastability_list = []
for i ... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | models/TrmEncoderBackbone.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.474224 | import torch
import torch.nn as nn
from layers.Embed import PatchEmbedding
from layers.SelfAttention_Family import AttentionLayer, FullAttention
from layers.Transformer_EncDec import Encoder, EncoderLayer
class FlattenHead(nn.Module):
def __init__(self, nf, target_window, head_dropout=0):
super().__init_... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | models/Timer.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.475488 | import torch
from torch import nn
from models import TimerBackbone
class Model(nn.Module):
"""
Timer: Generative Pre-trained Transformers Are Large Time Series Models (ICML 2024)
Paper: https://arxiv.org/abs/2402.02368
GitHub: https://github.com/thuml/Large-Time-Series-Model
Citation: ... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | run.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.477553 | import argparse
import os
import random
from datetime import datetime
import numpy as np
import torch
import torch.distributed as dist
from exp.exp_forecast import Exp_Forecast
from exp.exp_anomaly_detection import Exp_Anomaly_Detection
from exp.exp_imputation import Exp_Imputation
from utils.tools import HiddenPrint... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | models/TrmEncoder.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.480192 | import torch
import torch.nn as nn
from models import TrmEncoderBackbone
class FlattenHead(nn.Module):
def __init__(self, nf, target_window, head_dropout=0):
super().__init__()
self.flatten = nn.Flatten(start_dim=-2)
self.linear = nn.Linear(nf, target_window)
self.dropout = nn.Dro... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | layers/Transformer_EncDec.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.512746 | import torch.nn as nn
import torch.nn.functional as F
class ConvLayer(nn.Module):
def __init__(self, c_in):
super(ConvLayer, self).__init__()
self.downConv = nn.Conv1d(in_channels=c_in,
out_channels=c_in,
kernel_size=3,
... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | layers/SelfAttention_Family.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:47.604073 | import numpy as np
import torch
import torch.nn as nn
from math import sqrt
from utils.masking import TriangularCausalMask
class FullAttention(nn.Module):
def __init__(self, mask_flag=True, factor=5, scale=None, attention_dropout=0.1, output_attention=False):
super(FullAttention, self).__init__()
... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | utils/timefeatures.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.096998 |
from typing import List
import numpy as np
import pandas as pd
from pandas.tseries import offsets
from pandas.tseries.frequencies import to_offset
class TimeFeature:
def __init__(self):
pass
def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
pass
def __repr__(self):
ret... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/UTSD/utsdataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.118116 | import datasets
import numpy as np
from torch.utils.data import Dataset
from sklearn.preprocessing import StandardScaler
from tqdm import tqdm
"""
All single-variate series in UTSD are divided into (input-output) windows with a uniform length based on S3.
Proposed by: Timer: Generative Pre-trained Transformers Are L... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | utils/masking.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.118829 | import torch
class TriangularCausalMask():
def __init__(self, B, L, device="cpu"):
mask_shape = [B, 1, L, L]
with torch.no_grad():
self._mask = torch.triu(torch.ones(mask_shape, dtype=torch.bool), diagonal=1).to(device)
@property
def mask(self):
return self._mask |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/UTSD/download_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.129919 | # if you want to download the dataset, you can run this script:
# '''python download_dataset.py'''
# if you meet with some network problems, you can set the mirror site before running the script:
# export HF_ENDPOINT=https://hf-mirror.com
import datasets
ds = datasets.load_dataset("thuml/UTSD", "UTSD-1G")
# ds = dat... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | utils/tools.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.150735 | import os
import sys
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.distributed as dist
plt.switch_backend('agg')
def adjust_learning_rate(optimizer, epoch, args):
# lr = args.learning_rate * (0.2 ** (epoch // 2))
if args.lradj == 'type1':
lr_adjust = {epoch... |
thuml/Large-Time-Series-Model | https://github.com/thuml/Large-Time-Series-Model | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | utils/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:48.151651 | import numpy as np
def RSE(pred, true):
return np.sqrt(np.sum((true - pred) ** 2)) / np.sqrt(np.sum((true - true.mean()) ** 2))
def CORR(pred, true):
u = ((true - true.mean(0)) * (pred - pred.mean(0))).sum(0)
d = np.sqrt(((true - true.mean(0)) ** 2 * (pred - pred.mean(0)) ** 2).sum(0))
return (u / d... |
hwchase17/chat-your-data | https://github.com/hwchase17/chat-your-data | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | query_data.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:50.232277 | from langchain.chains import RetrievalQA, ConversationalRetrievalChain
from langchain.prompts.prompt import PromptTemplate
from langchain.vectorstores.base import VectorStoreRetriever
from langchain.chat_models import ChatOpenAI
from langchain.memory import ConversationBufferMemory
import pickle
_template = """Given ... |
hwchase17/chat-your-data | https://github.com/hwchase17/chat-your-data | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | app.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:50.232850 | import os
from typing import Optional, Tuple
from threading import Lock
import gradio as gr
from query_data import get_basic_qa_chain
def set_openai_api_key(api_key: str):
"""Set the api key and return chain.
If no api_key, then None is returned.
"""
if api_key:
os.environ["OPENAI_API_KEY"] ... |
hwchase17/chat-your-data | https://github.com/hwchase17/chat-your-data | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | cli_app.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:50.271919 | from query_data import chain_options
from rich.console import Console
from rich.prompt import Prompt
if __name__ == "__main__":
c = Console()
model = Prompt.ask("Which QA model would you like to work with?",
choices=list(chain_options.keys()),
default="basic")
... |
hwchase17/chat-your-data | https://github.com/hwchase17/chat-your-data | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | ingest_data.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:50.315433 | from langchain.text_splitter import CharacterTextSplitter
from langchain.document_loaders import UnstructuredFileLoader
from langchain.vectorstores.faiss import FAISS
from langchain.embeddings import OpenAIEmbeddings
import pickle
print("Loading data...")
loader = UnstructuredFileLoader("state_of_the_union.txt")
raw_... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/hotpotqa.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.426895 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import sys
import os
import spacy
import pprint
import kilt.kilt_utils as utils
from kilt.datasets.base_datas... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/base_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.434984 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib.resources
import json
from abc import ABC, abstractmethod
from kilt.configs import mapping
class Datas... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/fact_verification.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.448262 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import spacy
import sys
import unicodedata
import pprint
pp = pprint.PrettyPrinter(indent=4)
import kilt.ki... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/entity_linking.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.450150 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import random
import sys
import uuid
import uuid
from tqdm import tqdm
import kilt.kilt_utils as utils
from k... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/hotpotqa_ks.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.454105 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
from multiprocessing.pool import ThreadPool
import os
from kilt.kilt_utils import chunk_it
import bz... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/dataset_mapper.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:52.514865 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import sys
import multiprocessing
from multiprocessing.pool import ThreadPool
from kilt.knowledge_source imp... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/eval_retrieval.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.350113 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import pprint
from collections import defaultdict, OrderedDict
from kilt import kilt_utils
from kilt impo... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/kilt_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.351416 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import nltk
import json
import os
import logging
import sys
import time
import string
import random
ENT_START = "[START_E... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/fid/postprocess.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.353760 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import sys
import json
def convert_to_kilt(inputpath, outputpath, datapath):
data = []
with open(datapath, 'r') ... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/zero_shot_re.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.361218 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import spacy
import uuid
import kilt.kilt_utils as utils
from kilt.datasets.base_dataset import Dataset
class ZeroShotRE... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/eval_downstream.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.362133 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import pprint
import re
import string
from rouge import Rouge
from collections import Counter
import kil... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/knowledge_source.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.363961 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from pymongo import MongoClient
import requests
from urllib.parse import unquote
import urllib.request
from bs4 import Beau... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/fid/preprocess.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.366058 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import sys
from tqdm.auto import tqdm
def convert_kilt(inputpath, outputpath):
data = []
inputdata =... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/natural_questions.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:53.990359 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
im... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/t5/evaluate_kilt_task.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:54.690847 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import glob
import os
from pathlib import Path
import torch
from rouge_score import rouge_scorer, scoring... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/t5/finetune.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:54.692103 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import glob
import logging
import os
import time
import torch
from torch.utils.data import DataLoader
fro... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/BM25_connector.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:54.693165 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
from multiprocessing.pool import ThreadPool
import json
from tqdm import tqdm
import jnius_config
... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/t5/data.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:54.694676 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import configparser
import fcntl
import gzip
import json
import os
import pathlib
import torch.utils.data
from transforme... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrieval.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:54.836201 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import os
import os.path
from os import path
from kilt import kilt_utils as utils
def generate_output_file(... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/BLINK_connector.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:55.408689 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
import pickle
import blink.main_dense as main_dense
from flair.models import SequenceTagge... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/DPR_connector.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:55.741913 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import argparse
import glob
import pickle
from dpr.utils.model_utils import (
load_states_from_checkpoint... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/download_all_kilt_data.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:55.914707 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import requests
from tqdm.auto import tqdm
urls = [
"http://dl.fbaipublicfiles.com/KILT/fever-train-kilt.jsonl",
... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/readers/t5/base_transformer.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.028452 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
import os
import random
import numpy as np
import pytorch_lightning as pl
import torch
fro... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/execute_retrieval.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.039293 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
import argparse
from kilt import retrieval
from kilt import kilt_utils as utils
def execute(
logger, tes... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/DrQA_tfidf.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.264859 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
from multiprocessing.pool import ThreadPool
from tqdm import tqdm
from drqa import retriever
impo... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/get_triviaqa_input.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.321329 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import sys
import requests
import tarfile
import os
import json
from tqdm.auto import tqdm
from kilt import kilt_utils
... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/base_retriever.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.431733 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
from abc import ABC, abstractmethod
from kilt.configs import retriever
class Retriever(ABC):
def __init_... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/retrievers/DPR_distr_connector.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.472850 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
import pickle
import zlib
from omegaconf import OmegaConf
from tqdm import tqdm
from dpr.models import ini... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/map_TAC-KBP2010_to_KILT.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.507584 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import json
from tqdm.auto import tqdm
import pickle
import argparse
from kilt.knowledge_source import KnowledgeSource
... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/map_datasets.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.621238 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from kilt import dataset_mapper
from kilt.datasets import (
base_dataset,
entity_linking,
fact_verification,
... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.669681 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="kilt",... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | kilt/datasets/triviaqa.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.773060 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
im... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | tests/test_eval_downstream.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:56.936535 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import importlib.resources
import kilt.eval_downstream
import kilt.eval_retrieval
import tests.test_data ... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | tests/test_eval_retrieval.py | null | null | null | null | null | null | Python | 2026-05-04T01:38:57.018805 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import importlib.resources
import kilt.eval_downstream
import kilt.eval_retrieval
import tests.test_data ... |
facebookresearch/KILT | https://github.com/facebookresearch/KILT | null | null | null | null | 971 | null | null | mit | null | null | null | null | null | null | null | scripts/create_kilt_data_paragraphs.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:00.663426 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
from multiprocessing.pool import ThreadPool
import sys
import argparse
import pickle
import json
im... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/Evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.801690 | # Licensed under the MIT license.
from eval_src.toolkit_for_MATH.latex_answer_check import latex_answer_check as latex_equiv
import os, json, re
from typing import List, Dict, Tuple
from collections import defaultdict
import random
from fuzzywuzzy import fuzz, process
class Evaluator:
def __init__(self) -> None... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | models/IO_System.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.813838 | # Licensed under the MIT license.
import sys
sys.path.append(".")
from typing import List, Dict
try:
from models.vLLM_API import generate_with_vLLM_model
except:
pass
try:
from models.OpenAI_API import generate_n_with_OpenAI_model
except:
pass
class IO_System:
"""Input/Output system"""
d... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | models/HuggingFace_API.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.821703 | # Licensed under the MIT license.
import torch
from transformers import (
GenerationConfig,
AutoModelForCausalLM,
AutoTokenizer,
)
from tqdm import tqdm
import torch.nn.functional as F
import numpy as np
def load_HF_model(ckpt) -> tuple:
tokenizer = AutoTokenizer.from_pretrained(ckpt)
model = Aut... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/toolkit_for_MATH/parsing_lib.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.826410 | # ---------------------------------------------------------
# Xwin-Math
# Copyright (c) 2023 Xwin-Math Team
# Licensed under The MIT License [see LICENSE for details]
# Written by Weiqi Wang
# ---------------------------------------------------------
from pyparsing import *
from typing import List
import os
def extr... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/toolkit_for_MATH/metamath_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.831853 | import pprint
def last_boxed_only(sample):
q, a = sample
a = last_boxed_only_string(a)
if a == None:
return None
return (q, a)
def last_boxed_only_string(string):
idx = string.rfind("\\boxed")
if idx < 0:
idx = string.rfind("\\fbox")
if idx < 0:
return Non... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | common/arguments.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.834971 | # Licensed under the MIT license.
import os, json, torch, math
from argparse import ArgumentParser
from datetime import datetime
def get_parser():
parser = ArgumentParser()
parser.add_argument("--note", type=str, default="debug")
allowed_apis = ["together", "huggingface", "llama", "vllm", "debug", "gpt... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/toolkit_for_MATH/latex_answer_check.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.836484 | # ---------------------------------------------------------
# Xwin-Math
# Copyright (c) 2023 Xwin-Math Team
# Licensed under The MIT License [see LICENSE for details]
# Based on ToRA (https://github.com/microsoft/ToRA/blob/main/src/eval/grader.py)
# Modified by Weiqi Wang
# ---------------------------------------------... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/toolkit_for_MATH/simple_answer_check.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.838687 | # ---------------------------------------------------------
# Xwin-Math
# Copyright (c) 2023 Xwin-Math Team
# Licensed under The MIT License [see LICENSE for details]
# Written by Weiqi Wang
# ---------------------------------------------------------
import sys
sys.path.append(".")
from eval_src.eval_MATH.parsing_lib... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | eval_src/do_eval.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.915569 | # Licensed under the MIT license.
import sys
sys.path.append(".")
from common.utils import read_json, save_json
from eval_src.Evaluator import *
import warnings
warnings.filterwarnings("ignore")
from tqdm import tqdm
from argparse import ArgumentParser
def extract_trace(data_item, num_votes):
res = []
for... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | common/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:02.916194 | # Licensed under the MIT license.
import json
import re
import os
import random
import numpy as np
import torch
import multiprocessing
from typing import Tuple
from statistics import mean
from torch.utils.data import Dataset
def fix_seeds(seed):
# random
random.seed(seed)
# Numpy
np.random.seed(seed)... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | models/OpenAI_API.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.359957 | # Licensed under the MIT license.
import os
import os
import time
from tqdm import tqdm
import concurrent.futures
from openai import AzureOpenAI
client = AzureOpenAI(
api_version="",
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT", ""),
api_key=os.environ.get("AZURE_OPENAI_API_KEY", ""),
)
max_thre... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | run_src/MCTS_backbone.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.422086 | """
A minimal implementation of Monte Carlo tree search (MCTS) in Python 3
Luke Harold Miles, July 2019, Public Domain Dedication
See also https://en.wikipedia.org/wiki/Monte_Carlo_tree_search
https://gist.github.com/qpwo/c538c6f73727e254fdc7fab81024f6e1
"""
from abc import ABC, abstractmethod
from collections import ... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | prompts/MULTIARITH/gsm8k_tot.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.433191 | vote_prompt = '''Given a question and several choices of next steps, analyze each choice in detail and compare them to decide which choice is the most promising to be the next step to solve the question. After analyzing each choice in detail and comparing them, conclude your final choice with \"Therefore, the best choi... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | run_src/MCTS_for_reasoning.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.433856 | # Licensed under the MIT license.
import sys
sys.path.append(".")
import numpy as np, os, random, json, math, wandb
from tqdm import trange
from typing import List, Dict, Tuple
from copy import deepcopy
try:
from rapidfuzz import fuzz, process
except:
pass
from models.IO_System import IO_System
from common... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | run_src/rstar_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.443044 | # Licensed under the MIT license.
from enum import Enum, unique
import re
import math
from typing import Dict, Tuple
from colorama import Fore, Style
import math
from eval_src import Evaluator
@unique
class Node_Type(Enum):
USER_QUESTION = "USER_QUESTION"
REPHRASED_USER_QUESTION = "REPHRASED_USER_QUESTION"
... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | models/vLLM_API.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.445646 | # Licensed under the MIT license.
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
import numpy as np
import math
def load_vLLM_model(model_ckpt, seed, tensor_parallel_size=1, half_precision=False, max_num_seqs=256):
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
if half_pr... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | run_src/do_generate.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.456101 | # Licensed under the MIT license.
import sys
import os, json, time
from tqdm import tqdm
sys.path.append(".")
from common.utils import fix_seeds, setup_model_parallel, read_json
from common.arguments import get_parser, post_process_args, save_args
from run_src.rstar_utils import GeneratorError
from MCTS_for_reasonin... |
zhentingqi/rStar | https://github.com/zhentingqi/rStar | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | run_src/do_discriminate.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:03.460030 | # Licensed under the MIT license.
import sys
import os, json
from tqdm import tqdm
sys.path.append(".")
from common.utils import fix_seeds, read_json, read_txt
from eval_src.Evaluator import *
from run_src.rstar_utils import concat_solution_trace, mask_solution_trace
from models.vLLM_API import load_vLLM_model, gene... |
echen/restricted-boltzmann-machines | https://github.com/echen/restricted-boltzmann-machines | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | rbm.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:10.457190 | from __future__ import print_function
import numpy as np
class RBM:
def __init__(self, num_visible, num_hidden):
self.num_hidden = num_hidden
self.num_visible = num_visible
self.debug_print = True
# Initialize a weight matrix, of dimensions (num_visible x num_hidden), using
# a uniform distri... |
jwyang/fpn.pytorch | https://github.com/jwyang/fpn.pytorch | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | _init_paths.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:12.679501 | import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
# Add lib to PYTHONPATH
lib_path = osp.join(this_dir, 'lib')
add_path(lib_path)
coco_path = osp.join(this_dir, 'data', 'coco', 'PythonAPI')
add_path(coco_path)
|
jwyang/fpn.pytorch | https://github.com/jwyang/fpn.pytorch | null | null | null | null | 970 | null | null | mit | null | null | null | null | null | null | null | lib/datasets/pascal_voc.py | null | null | null | null | null | null | Python | 2026-05-04T01:39:12.695031 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import xml.dom.minidom as minidom
import os
# import PIL
import numpy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.