before_code
stringlengths
30
149k
reviewer_comment
stringlengths
16
20.6k
after_code
stringlengths
30
163k
diff_context
stringlengths
0
22.4k
file_path
stringlengths
6
155
comment_line
int64
0
26
language
stringclasses
19 values
quality_score
float64
0.07
1
comment_type
stringclasses
9 values
comment_length
int64
16
20.6k
before_lines
int64
2
4.61k
after_lines
int64
2
4.4k
is_negative
bool
2 classes
pr_title
stringlengths
7
140
pr_number
int64
18
61.2k
repo_name
stringclasses
29 values
repo_stars
int64
321
56k
repo_language
stringclasses
14 values
reviewer_username
stringclasses
378 values
author_username
stringclasses
739 values
user
stringlengths
361
200k
assistant
stringlengths
16
20.6k
system
stringclasses
1 value
from argparse import Namespace import model_training.models.reward_model # noqa: F401 from model_training.models.reward_model import GPTNeoXRewardModel from model_training.utils import get_tokenizer from transformers import AutoModelForSequenceClassification, AutoTokenizer def test_convert_model( model_name: st...
No issues found.
from argparse import Namespace import model_training.models.reward_model # noqa: F401 from model_training.models.reward_model import GPTNeoXRewardModel from model_training.utils import get_tokenizer from transformers import AutoModelForSequenceClassification, AutoTokenizer def test_convert_model( model_name: st...
@@ -0,0 +1,40 @@ +from argparse import Namespace + +import model_training.models.reward_model # noqa: F401 +from model_training.models.reward_model import GPTNeoXRewardModel +from model_training.utils import get_tokenizer +from transformers import AutoModelForSequenceClassification, AutoTokenizer + + +def test_convert...
model/model_training/tests/test_rm_loading.py
0
Python
1
none
16
41
41
true
Add GPTNeoXRewardModel
2,182
LAION-AI/Open-Assistant
29,137
Python
andreaskoepf
Review this pull request change. Language: Python File: model/model_training/tests/test_rm_loading.py PR Title: Add GPTNeoXRewardModel BEFORE CODE: from argparse import Namespace import model_training.models.reward_model # noqa: F401 from model_training.models.reward_model import GPTNeoXRewardModel from model_tra...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
generated_ids = [] decoded_text = "" for stream_response in stream_events: if stream_response.is_error: logger.error(f"Error from inference server: {stream_response.error}") utils.send_response( ws, inference.ErrorResponse( ...
No issues found.
generated_ids = [] decoded_text = "" for stream_response in stream_events: if stream_response.is_error: logger.error(f"Error from inference server: {stream_response.error}") utils.send_response( ws, inference.ErrorResponse( ...
@@ -1,4 +1,5 @@ import threading +from concurrent import futures import interface import requests @@ -22,8 +23,8 @@ def truncate_prompt( with tokenizer_lock: ids = tokenizer.encode(prompt) - max_input_length = worker_config.model_max_input_length - max_total_tokens = worker_config.model_max_t...
inference/worker/work.py
0
Python
1
none
16
51
51
true
Introduce model configs to abstract pairings of models and hardware
2,194
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: Python File: inference/worker/work.py PR Title: Introduce model configs to abstract pairings of models and hardware BEFORE CODE: generated_ids = [] decoded_text = "" for stream_response in stream_events: if stream_response.is_error: logger.e...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
const customPresetDefaultValue: SamplingParameters = { max_new_tokens: 256, repetition_penalty: 1.2, temperature: 1, top_k: 50, top_p: 0.95, typical_p: 0.5, }; const parameterLabel: Record<keyof SamplingParameters, string> = { max_new_tokens: "Max new tokens", top_k: "Top K", top_p: "Top P", temper...
No issues found.
const customPresetDefaultValue: SamplingParameters = { max_new_tokens: 256, repetition_penalty: 1.2, temperature: 1, top_k: 50, top_p: 0.95, typical_p: 0.5, }; const parameterLabel: Record<keyof SamplingParameters, string> = { max_new_tokens: "Max new tokens", top_k: "Top K", top_p: "Top P", temper...
@@ -28,8 +28,7 @@ import { Settings } from "lucide-react"; import { useTranslation } from "next-i18next"; import { ChangeEvent, useCallback, useState } from "react"; import { Controller, useFormContext, useWatch } from "react-hook-form"; -import { WorkParametersInput } from "src/types/Chat"; -import { StrictOmit } f...
website/src/components/Chat/ChatConfigDrawer.tsx
0
TypeScript
1
none
16
51
51
true
Use new inference model config / API
2,208
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatConfigDrawer.tsx PR Title: Use new inference model config / API BEFORE CODE: const customPresetDefaultValue: SamplingParameters = { max_new_tokens: 256, repetition_penalty: 1.2, temperature: 1, top_k: 50, top_p: 0....
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
tokenizer: transformers.PreTrainedTokenizer = transformers.AutoTokenizer.from_pretrained(model_config.model_id) while True: try: if not model_config.is_lorem: utils.wait_for_inference_server(settings.inference_server_url) if settings.perform_oom_test: ...
No issues found.
tokenizer: transformers.PreTrainedTokenizer = transformers.AutoTokenizer.from_pretrained(model_config.model_id) while True: try: if not model_config.is_lorem: utils.wait_for_inference_server(settings.inference_server_url) if settings.perform_oom_test: ...
@@ -85,7 +85,12 @@ def main(): ) ftrs.append(ftr) case "ping": - utils.send_response(ws, inference.PongResponse(request_id=worker_request.id)) + utils.send_respons...
inference/worker/__main__.py
0
Python
1
none
16
51
51
true
Create worker metrics manually for more control
2,229
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: Python File: inference/worker/__main__.py PR Title: Create worker metrics manually for more control BEFORE CODE: tokenizer: transformers.PreTrainedTokenizer = transformers.AutoTokenizer.from_pretrained(model_config.model_id) while True: try: ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ucr: UserChatRepository async with deps.manual_user_chat_repository(user_id) as ucr: work_parameters = inference.WorkParameters( model_config=model_config, sampling_parameters=request.sampling_parameters, ) assistant_message = await ucr...
No issues found.
ucr: UserChatRepository async with deps.manual_user_chat_repository(user_id) as ucr: work_parameters = inference.WorkParameters( model_config=model_config, sampling_parameters=request.sampling_parameters, ) assistant_message = await ucr...
@@ -2,11 +2,10 @@ import pydantic from fastapi import Depends from loguru import logger -from oasst_inference_server import auth, deps, models, queueing +from oasst_inference_server import auth, chat_utils, deps, models, queueing from oasst_inference_server.schemas import chat as chat_schema from oasst_inference_s...
inference/server/oasst_inference_server/routes/chats.py
0
Python
1
none
16
51
51
true
Enabling Threads and Retry for Web Chat
2,232
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/routes/chats.py PR Title: Enabling Threads and Retry for Web Chat BEFORE CODE: ucr: UserChatRepository async with deps.manual_user_chat_repository(user_id) as ucr: work_parameters = inference....
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
except chat_schema.MessageTimeoutException as e: logger.warning(f"Message timed out before work could be initiated: {e.message.id=}") await handle_timeout(message=e.message) finally: _add_dequeue(pending_futu...
No issues found.
except chat_schema.MessageTimeoutException as e: logger.warning(f"Message timed out before work could be initiated: {e.message.id=}") await handle_timeout(message=e.message) finally: _add_dequeue(pending_futu...
@@ -327,7 +327,7 @@ async def handle_token_response( deps.redis_client, message_id=work_response_container.message_id, ) - await message_queue.enqueue(response.json(), expire=settings.message_queue_expire) + await message_queue.enqueue(response.json()) work_response_container.num_respo...
inference/server/oasst_inference_server/routes/workers.py
0
Python
1
none
16
51
51
true
Computing message queue positions
2,235
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/routes/workers.py PR Title: Computing message queue positions BEFORE CODE: except chat_schema.MessageTimeoutException as e: logger.warning(f"Message timed out before work could...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
to run the galactica-125m model, using the webgpt dataset only (as opposed to all the datasets listed in defaults in config.yaml) and treat each digit as a separate token. """, ) parser.add_argument("--local_rank", type=int, default=-1) parser.add_argument("--deepspeed", action="store_tr...
No issues found.
to run the galactica-125m model, using the webgpt dataset only (as opposed to all the datasets listed in defaults in config.yaml) and treat each digit as a separate token. """, ) parser.add_argument("--local_rank", type=int, default=-1) parser.add_argument("--deepspeed", action="store_tr...
@@ -67,6 +67,7 @@ def compute_loss(self, model, inputs, return_outputs=False): outputs = model( input_ids=inputs["input_ids"], attention_mask=inputs.get("attention_mask", None), + use_cache=False, ) loss = self.loss_fct(outputs.get("logits"), targets, ma...
model/model_training/trainer_sft.py
0
Python
1
none
16
51
51
true
Fix GPTNeoX-20B training
2,240
LAION-AI/Open-Assistant
29,137
Python
dvruette
Review this pull request change. Language: Python File: model/model_training/trainer_sft.py PR Title: Fix GPTNeoX-20B training BEFORE CODE: to run the galactica-125m model, using the webgpt dataset only (as opposed to all the datasets listed in defaults in config.yaml) and treat each digit as a sepa...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { ChakraProvider, cookieStorageManagerSSR, localStorageManager } from "@chakra-ui/react"; import { PropsWithChildren } from "react"; import { theme } from "./Theme"; export function Chakra({ cookie, children }: PropsWithChildren<{ cookie: string }>) { const colorModeManager = typeof cookie === "string" ? coo...
No issues found.
import { ChakraProvider, cookieStorageManagerSSR, localStorageManager } from "@chakra-ui/react"; import { PropsWithChildren } from "react"; import { theme } from "./Theme"; export function Chakra({ cookie, children }: PropsWithChildren<{ cookie: string }>) { const colorModeManager = typeof cookie === "string" ? coo...
@@ -1,24 +1,14 @@ import { ChakraProvider, cookieStorageManagerSSR, localStorageManager } from "@chakra-ui/react"; +import { PropsWithChildren } from "react"; import { theme } from "./Theme"; -export function Chakra({ cookies, children }) { - const colorModeManager = typeof cookies === "string" ? cookieStorageMa...
website/src/styles/Chakra.tsx
0
TypeScript
1
none
16
15
15
true
Expose env vars globally
2,244
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/styles/Chakra.tsx PR Title: Expose env vars globally BEFORE CODE: import { ChakraProvider, cookieStorageManagerSSR, localStorageManager } from "@chakra-ui/react"; import { PropsWithChildren } from "react"; import { theme } from "./Theme"; exp...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]: # self: transformers.models.llama.modeling_llama.LlamaAttention if output_attentions: warnings.warn("Output attentions is not supported for patched `LlamaAttention`, returning `None` instead.") bsz, q_len, _ = hidden_st...
No issues found.
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]: # self: transformers.models.llama.modeling_llama.LlamaAttention if output_attentions: warnings.warn("Output attentions is not supported for patched `LlamaAttention`, returning `None` instead.") bsz, q_len, _ = hidden_st...
@@ -0,0 +1,88 @@ +import warnings +from typing import Optional, Tuple + +import torch +import torch.nn as nn +from transformers.models.llama.modeling_llama import LlamaAttention, apply_rotary_pos_emb + +from .patching_utils import compute_flash_attention + + +def llama_forward_with_flash_attn( + self: LlamaAttention...
model/model_training/models/patching_llama.py
0
Python
1
none
16
51
51
true
Flash attention support for Llama
2,277
LAION-AI/Open-Assistant
29,137
Python
dvruette
Review this pull request change. Language: Python File: model/model_training/models/patching_llama.py PR Title: Flash attention support for Llama BEFORE CODE: ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]: # self: transformers.models.llama.modeling_llama.LlamaAttention if o...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}, callbacks: { /** * Ensure we propagate the user's role when creating the session from the * token. */ async session({ session, token }) { session.user.role = token.role; session.user.isNew = token.isNew; session.user.name = token.name; session.user.tosAcceptanceDate...
No issues found.
}, callbacks: { /** * Ensure we propagate the user's role when creating the session from the * token. */ async session({ session, token }) { session.user.role = token.role; session.user.isNew = token.isNew; session.user.name = token.name; session.user.tosAcceptanceDate...
@@ -11,7 +11,6 @@ import EmailProvider from "next-auth/providers/email"; import { checkCaptcha } from "src/lib/captcha"; import { discordAvatarRefresh } from "src/lib/discord_avatar_refresh"; import { createApiClientFromUser } from "src/lib/oasst_client_factory"; -import { getInferenceTokens } from "src/lib/oasst_in...
website/src/pages/api/auth/[...nextauth].ts
0
TypeScript
1
none
16
51
51
true
Use trusted clients for inference auth
2,278
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/pages/api/auth/[...nextauth].ts PR Title: Use trusted clients for inference auth BEFORE CODE: }, callbacks: { /** * Ensure we propagate the user's role when creating the session from the * token. */ async session({ se...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
load_sleep=${LOAD_SLEEP:-0} mkdir -p $HF_HOME echo -n "$HF_TOKEN" > $HF_HOME/token export HUGGING_FACE_HUB_TOKEN=$HF_TOKEN export MODEL_CONFIG_NAME=${MODEL_CONFIG_NAME:-"OA_SFT_Pythia_12B"} export MODEL_ID=$(python get_model_config_prop.py model_id) export QUANTIZE=$(python get_model_config_prop.py quantized) echo ...
No issues found.
load_sleep=${LOAD_SLEEP:-0} mkdir -p $HF_HOME echo -n "$HF_TOKEN" > $HF_HOME/token export HUGGING_FACE_HUB_TOKEN=$HF_TOKEN export MODEL_CONFIG_NAME=${MODEL_CONFIG_NAME:-"OA_SFT_Pythia_12B"} export MODEL_ID=$(python get_model_config_prop.py model_id) export QUANTIZE=$(python get_model_config_prop.py quantized) echo ...
@@ -1,14 +1,54 @@ #!/bin/bash -mkdir -p $HOME/.cache/huggingface -echo -n "$HF_TOKEN" > $HOME/.cache/huggingface/token +export HF_HOME=${HF_HOME:-"$HOME/.cache/huggingface"} +load_sleep=${LOAD_SLEEP:-0} -python3 -m uvicorn --port 8883 basic_hf_server:app & +mkdir -p $HF_HOME +echo -n "$HF_TOKEN" > $HF_HOME/token +...
inference/worker/worker_hf_main.sh
0
Shell
1
none
16
51
51
true
changed basic hf server to support quantization and streaming
2,293
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: Shell File: inference/worker/worker_hf_main.sh PR Title: changed basic hf server to support quantization and streaming BEFORE CODE: load_sleep=${LOAD_SLEEP:-0} mkdir -p $HF_HOME echo -n "$HF_TOKEN" > $HF_HOME/token export HUGGING_FACE_HUB_TOKEN=$HF_TOKEN export MODEL_CO...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def argument_parsing(notebook=False, notebook_args=None): parser = argparse.ArgumentParser() parser.add_argument( "--datasets", nargs="+", required=True, help=""" Multiple datasets can be passed to set different options. For example, run as: ./check_d...
No issues found.
def argument_parsing(notebook=False, notebook_args=None): parser = argparse.ArgumentParser() parser.add_argument( "--datasets", nargs="+", required=True, help=""" Multiple datasets can be passed to set different options. For example, run as: ./check_d...
@@ -0,0 +1,125 @@ +import argparse +from enum import Enum +from pathlib import Path +from typing import Any + +import pandas as pd +import yaml +from model_training.utils import _strtobool, get_dataset + + +class Mode(Enum): + sft = "sft" + rm = "rm" + rl = "rl" + + def config_name(self) -> str: + ma...
model/model_training/check_dataset_counts.py
0
Python
1
none
16
51
51
true
add dataset counts script
2,294
LAION-AI/Open-Assistant
29,137
Python
CloseChoice
Review this pull request change. Language: Python File: model/model_training/check_dataset_counts.py PR Title: add dataset counts script BEFORE CODE: def argument_parsing(notebook=False, notebook_args=None): parser = argparse.ArgumentParser() parser.add_argument( "--datasets", nargs="+", ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
class HellaSwagDataset(Dataset): """ Dataset class to use data from https://arxiv.org/pdf/1905.07830.pdf for Reward modeling """ name = "hellaswag" def __init__(self, split) -> None: super().__init__() np.random.seed(SEED) self.dataset_list = [] dataset = loa...
No issues found.
class HellaSwagDataset(Dataset): """ Dataset class to use data from https://arxiv.org/pdf/1905.07830.pdf for Reward modeling """ name = "hellaswag" def __init__(self, split) -> None: super().__init__() np.random.seed(SEED) self.dataset_list = [] dataset = loa...
@@ -78,27 +78,53 @@ class HFDataset(Dataset): name = "hfsummary" - def __init__(self, split=None) -> None: + def __init__(self, split=None, subset="axis") -> None: super().__init__() + # axis subset contains splits 'test' and 'validation' + # comparisons subset contains splits 'tra...
model/model_training/custom_datasets/rank_datasets.py
0
Python
1
none
16
51
51
true
two more datasets
2,301
LAION-AI/Open-Assistant
29,137
Python
mikegarts
Review this pull request change. Language: Python File: model/model_training/custom_datasets/rank_datasets.py PR Title: two more datasets BEFORE CODE: class HellaSwagDataset(Dataset): """ Dataset class to use data from https://arxiv.org/pdf/1905.07830.pdf for Reward modeling """ name = "hella...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return len(self.dataset_list) def __getitem__(self, idx): context, completions = self.dataset_list[idx].values() return [context], completions class HFDataset(Dataset): """ Dataset class to use data from openai/summarize_from_feedback for Reward modeling. Summaries ranked by o...
No issues found.
return len(self.dataset_list) def __getitem__(self, idx): context, completions = self.dataset_list[idx].values() return [context], completions class HFDataset(Dataset): """ Dataset class to use data from openai/summarize_from_feedback for Reward modeling. Summaries ranked by o...
@@ -40,7 +40,6 @@ def __getitem__(self, idx): class HellaSwagDataset(Dataset): - """ Dataset class to use data from https://arxiv.org/pdf/1905.07830.pdf for Reward modeling @@ -70,7 +69,6 @@ def __getitem__(self, idx): class HFDataset(Dataset): - """ Dataset class to use data from ope...
model/model_training/custom_datasets/rank_datasets.py
0
Python
1
none
16
51
51
true
revert instructor code and fix a bug in anthropic ds parsing
2,307
LAION-AI/Open-Assistant
29,137
Python
mikegarts
Review this pull request change. Language: Python File: model/model_training/custom_datasets/rank_datasets.py PR Title: revert instructor code and fix a bug in anthropic ds parsing BEFORE CODE: return len(self.dataset_list) def __getitem__(self, idx): context, completions = self.dataset_list[id...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# dialogue_collator.py line 36 ) gen_sequences = outputs.sequences[:, inputs["input_ids"].shape[-1] :] for output in gen_sequences: decoded = tokenizer.decode( output, truncate_before_pattern=[r"\n\n^#", "^'''", "\n\n\n"], skip_special_tokens=True ...
No issues found.
# dialogue_collator.py line 36 ) gen_sequences = outputs.sequences[:, inputs["input_ids"].shape[-1] :] for output in gen_sequences: decoded = tokenizer.decode( output, truncate_before_pattern=[r"\n\n^#", "^'''", "\n\n\n"], skip_special_tokens=True ...
@@ -0,0 +1,247 @@ +""" + Augment oasst dataset with sft generated results + + You can use augment new response using a model with bad response, ie non SFT model + + had to do this in a quick fashion, please tolerate the hackiness in the code + +""" +import json +import os + +# so far load_oasst_export is prett...
model/model_training/tools/augment_oasst.py
0
Python
1
none
16
51
51
true
fix deepspeed issue on trainer_rm.py, add crossentropy support
2,321
LAION-AI/Open-Assistant
29,137
Python
theblackcat102
Review this pull request change. Language: Python File: model/model_training/tools/augment_oasst.py PR Title: fix deepspeed issue on trainer_rm.py, add crossentropy support BEFORE CODE: # dialogue_collator.py line 36 ) gen_sequences = outputs.sequences[:, inputs["input_ids"].shape[-1] :]...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
work_end_at: datetime.datetime | None = Field(None) worker_id: str | None = Field(None, foreign_key="worker.id") worker_compat_hash: str | None = Field(None, index=True) worker_config: inference.WorkerConfig | None = Field(None, sa_column=sa.Column(pg.JSONB)) score: int = Field(0) @property ...
No issues found.
work_end_at: datetime.datetime | None = Field(None) worker_id: str | None = Field(None, foreign_key="worker.id") worker_compat_hash: str | None = Field(None, index=True) worker_config: inference.WorkerConfig | None = Field(None, sa_column=sa.Column(pg.JSONB)) score: int = Field(0) @property ...
@@ -1,18 +1,18 @@ import datetime -from uuid import uuid4 import sqlalchemy as sa import sqlalchemy.dialects.postgresql as pg from oasst_inference_server.schemas import chat as chat_schema from oasst_shared.schemas import inference from sqlmodel import Field, Relationship, SQLModel +from uuid_extensions import ...
inference/server/oasst_inference_server/models/chat.py
0
Python
1
none
16
51
51
true
inference: use uuid v7 for most of table
2,327
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/models/chat.py PR Title: inference: use uuid v7 for most of table BEFORE CODE: work_end_at: datetime.datetime | None = Field(None) worker_id: str | None = Field(None, foreign_key="worker.id") worker_compat_ha...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
parser.add_argument("--rng_seed", type=int, help="rng seed") parser.add_argument("--show_dataset_stats", action="store_true", help="Show dataset stats", default=False) parser.set_defaults(deepspeed=False) if notebook: args, remaining = parser.parse_known_args(notebook_args) else: ar...
No issues found.
parser.add_argument("--rng_seed", type=int, help="rng seed") parser.add_argument("--show_dataset_stats", action="store_true", help="Show dataset stats", default=False) parser.set_defaults(deepspeed=False) if notebook: args, remaining = parser.parse_known_args(notebook_args) else: ar...
@@ -1,9 +1,8 @@ import argparse import logging import os -from typing import Callable, Dict, List, Literal, Optional, Tuple, Union +from typing import Callable, Literal, Optional, Union -import bitsandbytes import datasets import torch from model_training.custom_datasets.ranking_collator import RankingDataColla...
model/model_training/trainer_rm.py
0
Python
1
none
16
51
51
true
Improve scores of small 1.4B reward model..
2,329
LAION-AI/Open-Assistant
29,137
Python
andreaskoepf
Review this pull request change. Language: Python File: model/model_training/trainer_rm.py PR Title: Improve scores of small 1.4B reward model.. BEFORE CODE: parser.add_argument("--rng_seed", type=int, help="rng seed") parser.add_argument("--show_dataset_stats", action="store_true", help="Show dataset stats...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
stats: Partial<{ [time in LeaderboardTimeFrame]: LeaderboardEntity }>; title?: string; }) => { const { t } = useTranslation("leaderboard"); return ( <SurveyCard> <Title>{title || t("your_stats")}</Title> {[LeaderboardTimeFrame.day, LeaderboardTimeFrame.week, LeaderboardTimeFrame.month, Leaderbo...
No issues found.
stats: Partial<{ [time in LeaderboardTimeFrame]: LeaderboardEntity }>; title?: string; }) => { const { t } = useTranslation("leaderboard"); return ( <SurveyCard> <Title>{title || t("your_stats")}</Title> {[LeaderboardTimeFrame.day, LeaderboardTimeFrame.week, LeaderboardTimeFrame.month, Leaderbo...
@@ -0,0 +1,74 @@ +import { Box, Flex, Grid, Text } from "@chakra-ui/react"; +import { useTranslation } from "next-i18next"; +import { ReactNode } from "react"; +import { getTypeSafei18nKey } from "src/lib/i18n"; +import { LeaderboardEntity, LeaderboardTimeFrame } from "src/types/Leaderboard"; + +import { SurveyCard } f...
website/src/components/Account/UserStats.tsx
0
TypeScript
1
none
16
51
51
true
stats are shown on the admin
2,330
LAION-AI/Open-Assistant
29,137
Python
vivasvan1
Review this pull request change. Language: TypeScript File: website/src/components/Account/UserStats.tsx PR Title: stats are shown on the admin BEFORE CODE: stats: Partial<{ [time in LeaderboardTimeFrame]: LeaderboardEntity }>; title?: string; }) => { const { t } = useTranslation("leaderboard"); return ( ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { BrowserEnv } from "src/lib/browserEnv"; import { SWRConfig, SWRConfiguration } from "swr"; import nextI18NextConfig from "../../next-i18next.config.js"; import { Chakra } from "../styles/Chakra"; type AppPropsWithLayout = AppProps & { Component: NextPageWithLayout; } & AppInitialProps; const swrConfig: SW...
No issues found.
import { BrowserEnv } from "src/lib/browserEnv"; import { SWRConfig, SWRConfiguration } from "swr"; import nextI18NextConfig from "../../next-i18next.config.js"; import { Chakra } from "../styles/Chakra"; type AppPropsWithLayout = AppProps & { Component: NextPageWithLayout; } & AppInitialProps; const swrConfig: SW...
@@ -10,33 +10,25 @@ import React, { useEffect } from "react"; import { FlagsProvider } from "react-feature-flags"; import { getDefaultLayout, NextPageWithLayout } from "src/components/Layout"; import flags from "src/flags"; +import { BrowserEnv } from "src/lib/browserEnv"; import { SWRConfig, SWRConfiguration } fro...
website/src/pages/_app.tsx
0
TypeScript
1
none
16
51
51
true
Use SSR for every pages
2,334
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/pages/_app.tsx PR Title: Use SSR for every pages BEFORE CODE: import { BrowserEnv } from "src/lib/browserEnv"; import { SWRConfig, SWRConfiguration } from "swr"; import nextI18NextConfig from "../../next-i18next.config.js"; import { Chakra } f...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}; const Chat = () => { const { t } = useTranslation(["common", "chat"]); const router = useRouter(); const { data, mutate: refreshChatList } = useSWR<GetChatsResponse>("/api/chat", get, { revalidateOnFocus: true }); const { trigger: newChatTrigger } = useSWRMutation<{ id: string }>("/api/chat", post); con...
No issues found.
}; const Chat = () => { const { t } = useTranslation(["common", "chat"]); const router = useRouter(); const { data, mutate: refreshChatList } = useSWR<GetChatsResponse>("/api/chat", get, { revalidateOnFocus: true }); const { trigger: newChatTrigger } = useSWRMutation<{ id: string }>("/api/chat", post); con...
@@ -1,11 +1,12 @@ -import { Box, Button, Divider, Flex, Progress, Text } from "@chakra-ui/react"; +import { Box, Button, Divider, Flex, Grid, Progress, Text } from "@chakra-ui/react"; import { GetServerSideProps } from "next"; import Head from "next/head"; import Link from "next/link"; import { useRouter } from "ne...
website/src/pages/chat/index.tsx
0
TypeScript
1
none
16
51
51
true
Add delete chat button
2,345
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/pages/chat/index.tsx PR Title: Add delete chat button BEFORE CODE: }; const Chat = () => { const { t } = useTranslation(["common", "chat"]); const router = useRouter(); const { data, mutate: refreshChatList } = useSWR<GetChatsResponse>(...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { useEffect } from "react"; import { UseFormReturn } from "react-hook-form"; import { ChatConfigForm } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG"; export const getCachedChatForm = (): ChatConfigForm | null => { if (typeof localStorage !== "undefined") { const oldConfig = localStorage.ge...
No issues found.
import { useEffect } from "react"; import { UseFormReturn } from "react-hook-form"; import { ChatConfigForm } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG"; export const getCachedChatForm = (): ChatConfigForm | null => { if (typeof localStorage !== "undefined") { const oldConfig = localStorage.ge...
@@ -0,0 +1,25 @@ +import { useEffect } from "react"; +import { UseFormReturn } from "react-hook-form"; +import { ChatConfigForm } from "src/types/Chat"; + +const CHAT_CONFIG_KEY = "CHAT_CONFIG"; + +export const getCachedChatForm = (): ChatConfigForm | null => { + if (typeof localStorage !== "undefined") { + const o...
website/src/hooks/chat/useCacheConfig.ts
0
TypeScript
1
none
16
26
26
true
Persist chat config
2,367
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/hooks/chat/useCacheConfig.ts PR Title: Persist chat config BEFORE CODE: import { useEffect } from "react"; import { UseFormReturn } from "react-hook-form"; import { ChatConfigForm } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG";...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
export { getServerSideProps } from "src/lib/defaultServerSideProps"; import { Box, Card, CardBody, Grid, Heading, Stack, Text, useColorModeValue } from "@chakra-ui/react"; import Head from "next/head"; import { useTranslation } from "next-i18next"; import React from "react"; import { TeamMember } from "src/components/T...
No issues found.
export { getServerSideProps } from "src/lib/defaultServerSideProps"; import { Box, Card, CardBody, Grid, Heading, Stack, Text, useColorModeValue } from "@chakra-ui/react"; import Head from "next/head"; import { useTranslation } from "next-i18next"; import React from "react"; import { TeamMember } from "src/components/T...
@@ -1,28 +1,14 @@ export { getServerSideProps } from "src/lib/defaultServerSideProps"; -import { - Avatar, - Badge, - Box, - Card, - CardBody, - Flex, - Grid, - Heading, - Stack, - Text, - useColorModeValue, -} from "@chakra-ui/react"; -import { Github } from "lucide-react"; +import { Box, Card, CardBody, G...
website/src/pages/team.tsx
0
TypeScript
1
none
16
50
50
true
Added stability, and added sponsors to inference interface
2,383
LAION-AI/Open-Assistant
29,137
Python
yk
Review this pull request change. Language: TypeScript File: website/src/pages/team.tsx PR Title: Added stability, and added sponsors to inference interface BEFORE CODE: export { getServerSideProps } from "src/lib/defaultServerSideProps"; import { Box, Card, CardBody, Grid, Heading, Stack, Text, useColorModeValue } ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
export const convertToBackendUserCore = <T extends { accounts: Account[]; id: string; name: string }>( user: T ): BackendUserCore => { // If there are no linked accounts, just use what we have locally. if (user.accounts.length === 0) { return { id: user.id, display_name: user.name, auth_meth...
No issues found.
export const convertToBackendUserCore = <T extends { accounts: Account[]; id: string; name: string }>( user: T ): BackendUserCore => { // If there are no linked accounts, just use what we have locally. if (user.accounts.length === 0) { return { id: user.id, display_name: user.name, auth_meth...
@@ -1,5 +1,6 @@ import { Account } from "@prisma/client"; import prisma from "src/lib/prismadb"; +import { AuthMethod } from "src/types/Providers"; import type { BackendUserCore } from "src/types/Users"; /** @@ -39,7 +40,7 @@ export const convertToBackendUserCore = <T extends { accounts: Account[]; id: st retu...
website/src/lib/users.ts
0
TypeScript
1
none
16
51
51
true
Google auth website
2,391
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/lib/users.ts PR Title: Google auth website BEFORE CODE: export const convertToBackendUserCore = <T extends { accounts: Account[]; id: string; name: string }>( user: T ): BackendUserCore => { // If there are no linked accounts, just use what...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import pydantic class Settings(pydantic.BaseSettings): safety_model_name: str = "shahules786/blade2blade-t5-base" settings = Settings()
No issues found.
import pydantic class Settings(pydantic.BaseSettings): safety_model_name: str = "shahules786/blade2blade-t5-base" settings = Settings()
@@ -0,0 +1,8 @@ +import pydantic + + +class Settings(pydantic.BaseSettings): + safety_model_name: str = "shahules786/blade2blade-t5-base" + + +settings = Settings()
inference/safety/settings.py
0
Python
1
none
16
9
9
true
Add safety server to inference
2,449
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/safety/settings.py PR Title: Add safety server to inference BEFORE CODE: import pydantic class Settings(pydantic.BaseSettings): safety_model_name: str = "shahules786/blade2blade-t5-base" settings = Settings() AFTER CODE: import pydantic c...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"""Add deleted field to user Revision ID: f0e18084aae4 Revises: 78f16015b904 Create Date: 2023-04-12 20:33:28.239793 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "f0e18084aae4" down_revision = "78f16015b904" branch_labels = None depends_on = None def upgrad...
No issues found.
"""Add deleted field to user Revision ID: f0e18084aae4 Revises: 78f16015b904 Create Date: 2023-04-12 20:33:28.239793 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "f0e18084aae4" down_revision = "78f16015b904" branch_labels = None depends_on = None def upgrad...
@@ -0,0 +1,27 @@ +"""Add deleted field to user + +Revision ID: f0e18084aae4 +Revises: 78f16015b904 +Create Date: 2023-04-12 20:33:28.239793 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "f0e18084aae4" +down_revision = "78f16015b904" +branch_labels = None...
inference/server/alembic/versions/2023_04_12_2033-f0e18084aae4_add_deleted_field_to_user.py
0
Python
1
none
16
28
28
true
Add support for user deletion
2,486
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/server/alembic/versions/2023_04_12_2033-f0e18084aae4_add_deleted_field_to_user.py PR Title: Add support for user deletion BEFORE CODE: """Add deleted field to user Revision ID: f0e18084aae4 Revises: 78f16015b904 Create Date: 2023-04-12 20:33:28.2397...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
export const ChatListBase = memo(function ChatListBase({ isSideBar, chats, ...props }: CardProps & { isSideBar: boolean; chats?: GetChatsResponse }) { const { data: response } = useSWR<GetChatsResponse>(chats ? null : API_ROUTES.LIST_CHAT, get, { fallbackData: chats, }); const { t } = useTranslation(["c...
No issues found.
export const ChatListBase = memo(function ChatListBase({ isSideBar, chats, ...props }: CardProps & { isSideBar: boolean; chats?: GetChatsResponse }) { const { data: response } = useSWR<GetChatsResponse>(chats ? null : API_ROUTES.LIST_CHAT, get, { fallbackData: chats, }); const { t } = useTranslation(["c...
@@ -1,10 +1,9 @@ import "simplebar-react/dist/simplebar.min.css"; -import { Button, Card, CardProps } from "@chakra-ui/react"; +import { Card, CardProps } from "@chakra-ui/react"; import { Plus } from "lucide-react"; -import Link from "next/link"; import { useTranslation } from "next-i18next"; -import { memo } fro...
website/src/components/Chat/ChatListBase.tsx
0
TypeScript
1
none
16
51
51
true
Don't refresh the page after each message
2,491
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatListBase.tsx PR Title: Don't refresh the page after each message BEFORE CODE: export const ChatListBase = memo(function ChatListBase({ isSideBar, chats, ...props }: CardProps & { isSideBar: boolean; chats?: GetChatsRes...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"""Add safe_content to message Revision ID: ea19bbc743f9 Revises: 401eef162771 Create Date: 2023-04-14 22:37:41.373382 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "ea19bbc743f9" down_revision = "401eef162771" branch_labels = None depends_on =...
No issues found.
"""Add safe_content to message Revision ID: ea19bbc743f9 Revises: 401eef162771 Create Date: 2023-04-14 22:37:41.373382 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "ea19bbc743f9" down_revision = "401eef162771" branch_labels = None depends_on =...
@@ -0,0 +1,34 @@ +"""Add safe_content to message + +Revision ID: ea19bbc743f9 +Revises: 401eef162771 +Create Date: 2023-04-14 22:37:41.373382 + +""" +import sqlalchemy as sa +import sqlmodel +from alembic import op + +# revision identifiers, used by Alembic. +revision = "ea19bbc743f9" +down_revision = "401eef162771" +b...
inference/server/alembic/versions/2023_04_29_1739-ea19bbc743f9_add_safe_content_to_message.py
0
Python
1
none
16
35
35
true
Inference worker inform backend on safety intervention
2,505
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/server/alembic/versions/2023_04_29_1739-ea19bbc743f9_add_safe_content_to_message.py PR Title: Inference worker inform backend on safety intervention BEFORE CODE: """Add safe_content to message Revision ID: ea19bbc743f9 Revises: 401eef162771 Create D...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client"; const handler = withoutRole("banned", async (req, res, token) => { if (!isChatEnable()) { return res.status(404).end(); } const client = cre...
No issues found.
import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client"; const handler = withoutRole("banned", async (req, res, token) => { if (!isChatEnable()) { return res.status(404).end(); } const client = cre...
@@ -0,0 +1,17 @@ +import { withoutRole } from "src/lib/auth"; +import { isChatEnable } from "src/lib/isChatEnable"; +import { createInferenceClient } from "src/lib/oasst_inference_client"; + +const handler = withoutRole("banned", async (req, res, token) => { + if (!isChatEnable()) { + return res.status(404).end(); ...
website/src/pages/api/chat/title.ts
0
TypeScript
1
none
16
18
18
true
implement update chat title UI
2,507
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/pages/api/chat/title.ts PR Title: implement update chat title UI BEFORE CODE: import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { ChatConfigFormData } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG"; export const setConfigCache = (config: ChatConfigFormData) => { if (typeof localStorage !== "undefined") { localStorage.setItem(CHAT_CONFIG_KEY, JSON.stringify(config)); } }; export const getConfigCache = () => { if...
No issues found.
import { ChatConfigFormData } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG"; export const setConfigCache = (config: ChatConfigFormData) => { if (typeof localStorage !== "undefined") { localStorage.setItem(CHAT_CONFIG_KEY, JSON.stringify(config)); } }; export const getConfigCache = () => { if...
@@ -0,0 +1,20 @@ +import { ChatConfigFormData } from "src/types/Chat"; + +const CHAT_CONFIG_KEY = "CHAT_CONFIG"; + +export const setConfigCache = (config: ChatConfigFormData) => { + if (typeof localStorage !== "undefined") { + localStorage.setItem(CHAT_CONFIG_KEY, JSON.stringify(config)); + } +}; + +export const g...
website/src/utils/chat.ts
0
TypeScript
1
none
16
21
21
true
fix custom preset selection
2,511
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/utils/chat.ts PR Title: fix custom preset selection BEFORE CODE: import { ChatConfigFormData } from "src/types/Chat"; const CHAT_CONFIG_KEY = "CHAT_CONFIG"; export const setConfigCache = (config: ChatConfigFormData) => { if (typeof localSto...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"""Add hidden field to chats Revision ID: b66fd8f9da1f Revises: f0e18084aae4 Create Date: 2023-04-14 16:11:35.361507 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "b66fd8f9da1f" down_revision = "f0e18084aae4" branch_labels = None depends_on = None def upgrad...
No issues found.
"""Add hidden field to chats Revision ID: b66fd8f9da1f Revises: f0e18084aae4 Create Date: 2023-04-14 16:11:35.361507 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "b66fd8f9da1f" down_revision = "f0e18084aae4" branch_labels = None depends_on = None def upgrad...
@@ -0,0 +1,27 @@ +"""Add hidden field to chats + +Revision ID: b66fd8f9da1f +Revises: f0e18084aae4 +Create Date: 2023-04-14 16:11:35.361507 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "b66fd8f9da1f" +down_revision = "f0e18084aae4" +branch_labels = None...
inference/server/alembic/versions/2023_04_14_1611-b66fd8f9da1f_add_hidden_field_to_chats.py
0
Python
1
none
16
28
28
true
Add ability to hide (soft delete) chats to inference backend
2,512
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/server/alembic/versions/2023_04_14_1611-b66fd8f9da1f_add_hidden_field_to_chats.py PR Title: Add ability to hide (soft delete) chats to inference backend BEFORE CODE: """Add hidden field to chats Revision ID: b66fd8f9da1f Revises: f0e18084aae4 Create...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
formatted = ds_entry.get_formatted(Mode.sft, "<|endofline|>") assert len(formatted) == 3 assert "length: 100" in formatted[0] assert "quality: 1.0" in formatted[0] assert "humor: 0.0" in formatted[0] assert "creativity: 0.0" in formatted[0] assert "Some context" in formatted[0] assert f"...
No issues found.
formatted = ds_entry.get_formatted(Mode.sft, "<|endofline|>") assert len(formatted) == 3 assert "length: 100" in formatted[0] assert "quality: 1.0" in formatted[0] assert "humor: 0.0" in formatted[0] assert "creativity: 0.0" in formatted[0] assert "Some context" in formatted[0] assert f"...
@@ -0,0 +1,79 @@ +import pytest +from model_training.custom_datasets.entities import Language, Mode +from model_training.custom_datasets.formatting import QA_SPECIAL_TOKENS, DatasetEntry + + +def test_dataset_entry_formatting_missing_lang(): + ds_entry = DatasetEntry( + questions=["What is the capital of Fran...
model/model_training/tests/test_formatting.py
0
Python
1
none
16
51
51
true
Feature/dataset entry
2,520
LAION-AI/Open-Assistant
29,137
Python
CloseChoice
Review this pull request change. Language: Python File: model/model_training/tests/test_formatting.py PR Title: Feature/dataset entry BEFORE CODE: formatted = ds_entry.get_formatted(Mode.sft, "<|endofline|>") assert len(formatted) == 3 assert "length: 100" in formatted[0] assert "quality: 1.0" in fo...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
const { data: session } = useSession(); const router = useRouter(); const { trigger } = useSWRMutation("/api/account/delete", del); const executeDelete = useCallback(async () => { try { await trigger(); signOut({ callbackUrl: "/" }); } catch (err) { console.error(err); } }, [tr...
No issues found.
const { data: session } = useSession(); const router = useRouter(); const { trigger } = useSWRMutation("/api/account/delete", del); const executeDelete = useCallback(async () => { try { await trigger(); signOut({ callbackUrl: "/" }); } catch (err) { console.error(err); } }, [tr...
@@ -0,0 +1,77 @@ +import { Button, Divider, Flex, Grid, Icon, ListItem, Text, UnorderedList } from "@chakra-ui/react"; +import Head from "next/head"; +import Link from "next/link"; +import React, { useCallback } from "react"; +export { getServerSideProps } from "src/lib/defaultServerSideProps"; +import { useRouter } fr...
website/src/pages/account/delete.tsx
0
TypeScript
1
none
16
51
51
true
Add delete account page
2,523
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/pages/account/delete.tsx PR Title: Add delete account page BEFORE CODE: const { data: session } = useSession(); const router = useRouter(); const { trigger } = useSWRMutation("/api/account/delete", del); const executeDelete = useCallb...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"shp", "hellaswag", "webgpt", ] def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: return dataset, None train_idx, val_idx = train_test_split( list(range(len(dataset))), test_size=val_split, random_state=666, shuffle=True ) ...
No issues found.
"shp", "hellaswag", "webgpt", ] def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: return dataset, None train_idx, val_idx = train_test_split( list(range(len(dataset))), test_size=val_split, random_state=666, shuffle=True ) ...
@@ -10,6 +10,7 @@ from model_training.custom_datasets.prompt_dialogue import Gpt4All, load_oig_file from model_training.custom_datasets.qa_datasets import ( SODA, + DatabricksDolly15k, JokeExplaination, QADataset, SODADialogue, @@ -159,6 +160,8 @@ def get_one_dataset( train, eval = loa...
model/model_training/custom_datasets/__init__.py
0
Python
1
none
16
51
51
true
remove references from dolly
2,535
LAION-AI/Open-Assistant
29,137
Python
CloseChoice
Review this pull request change. Language: Python File: model/model_training/custom_datasets/__init__.py PR Title: remove references from dolly BEFORE CODE: "shp", "hellaswag", "webgpt", ] def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: r...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
raise fastapi.HTTPException(status_code=400, detail="Parent message is not an assistant message") if msg_dict[parent_id].state != inference.MessageState.complete: raise fastapi.HTTPException(status_code=400, detail="Parent message is not complete") message = models.D...
No issues found.
raise fastapi.HTTPException(status_code=400, detail="Parent message is not an assistant message") if msg_dict[parent_id].state != inference.MessageState.complete: raise fastapi.HTTPException(status_code=400, detail="Parent message is not complete") message = models.D...
@@ -228,16 +228,21 @@ async def add_report(self, message_id: str, reason: str, report_type: inference. await self.session.refresh(report) return report - async def update_title(self, chat_id: str, title: str) -> None: - logger.info(f"Updating title of chat {chat_id=}: {title=}") + async...
inference/server/oasst_inference_server/user_chat_repository.py
0
Python
1
none
16
51
51
true
Unify title update and visibility update inference endpoints
2,627
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/user_chat_repository.py PR Title: Unify title update and visibility update inference endpoints BEFORE CODE: raise fastapi.HTTPException(status_code=400, detail="Parent message is not an assistant message"...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
TextLabel.hate_speech, TextLabel.sexual_content, ] mandatory_labels_initial_prompt: Optional[list[TextLabel]] = [TextLabel.spam] """Mandatory labels in text-labeling tasks for initial prompts.""" mandatory_labels_assistant_reply: Optional[list[TextLabel]] = [TextLabel.spam] """Mand...
No issues found.
TextLabel.hate_speech, TextLabel.sexual_content, ] mandatory_labels_initial_prompt: Optional[list[TextLabel]] = [TextLabel.spam] """Mandatory labels in text-labeling tasks for initial prompts.""" mandatory_labels_assistant_reply: Optional[list[TextLabel]] = [TextLabel.spam] """Mand...
@@ -274,6 +274,9 @@ def validate_user_stats_intervals(cls, v: int): TASK_VALIDITY_MINUTES: int = 60 * 24 * 2 # tasks expire after 2 days + DISCORD_API_KEY: str | None = None + DISCORD_CHANNEL_ID: str | None = None + class Config: env_file = ".env" env_file_encoding = "utf-8"
backend/oasst_backend/config.py
0
Python
1
none
16
51
51
true
send flagged message notification to discord
2,641
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: Python File: backend/oasst_backend/config.py PR Title: send flagged message notification to discord BEFORE CODE: TextLabel.hate_speech, TextLabel.sexual_content, ] mandatory_labels_initial_prompt: Optional[list[TextLabel]] = [TextLabel.spam] ""...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}>(`/api/v1/messages/${message_id}/tree/state`); } /** * Delete a message by its id */ async delete_message(message_id: string): Promise<void> { return this.delete<void>(`/api/v1/messages/${message_id}`); } /** * Undelete a message by its id */ async undelete_message(message_id: string...
No issues found.
}>(`/api/v1/messages/${message_id}/tree/state`); } /** * Delete a message by its id */ async delete_message(message_id: string): Promise<void> { return this.delete<void>(`/api/v1/messages/${message_id}`); } /** * Undelete a message by its id */ async undelete_message(message_id: string...
@@ -400,7 +400,7 @@ export class OasstApiClient { async set_tos_acceptance(user: BackendUserCore) { // NOTE: we do a post here to force create the user if it does not exist - const backendUser = await this.post<BackendUser>(`/api/v1/frontend_users/`, user); + const backendUser = await this.upsert_fronte...
website/src/lib/oasst_api_client.ts
0
TypeScript
1
none
16
51
51
true
create backend user when generate jwt
2,702
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/lib/oasst_api_client.ts PR Title: create backend user when generate jwt BEFORE CODE: }>(`/api/v1/messages/${message_id}/tree/state`); } /** * Delete a message by its id */ async delete_message(message_id: string): Promise<void>...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
TEXT_DATASETS = { "gutenberg_english": "sedthh/gutenberg_english", # Gutenberg eBooks in English "gutenberg_multilang": "sedthh/gutenberg_multilang", # Gutenberg eBooks in foreign languages "tv_dialogue": "sedthh/tv_dialogue", # TV and Movie dialogues and transcripts "fd_dialogue": "sedthh/fd_dialogu...
No issues found.
TEXT_DATASETS = { "gutenberg_english": "sedthh/gutenberg_english", # Gutenberg eBooks in English "gutenberg_multilang": "sedthh/gutenberg_multilang", # Gutenberg eBooks in foreign languages "tv_dialogue": "sedthh/tv_dialogue", # TV and Movie dialogues and transcripts "fd_dialogue": "sedthh/fd_dialogu...
@@ -22,6 +22,7 @@ "oa_leet10k": "ehartford/oa_leet10k", "LogicInference_OA": "KK04/LogicInference_OA", "oa_dolly_15k": "OllieStanley/oa_dolly_15k", + "poetry_instruction": "checkai/poetry-instruction", } SAFETY_DATASETS = {
data/datasets/__init__.py
0
Python
1
none
16
34
34
true
add poetry dataset setup
2,730
LAION-AI/Open-Assistant
29,137
Python
check3D
Review this pull request change. Language: Python File: data/datasets/__init__.py PR Title: add poetry dataset setup BEFORE CODE: TEXT_DATASETS = { "gutenberg_english": "sedthh/gutenberg_english", # Gutenberg eBooks in English "gutenberg_multilang": "sedthh/gutenberg_multilang", # Gutenberg eBooks in fore...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if parent_id is None: if len(chat.messages) > 0: raise fastapi.HTTPException(status_code=400, detail="Trying to add first message to non-empty chat") chat.title = content else: msg_dict = chat.get_msg_dict() if parent_id not in msg_dict: ...
No issues found.
if parent_id is None: if len(chat.messages) > 0: raise fastapi.HTTPException(status_code=400, detail="Trying to add first message to non-empty chat") chat.title = content else: msg_dict = chat.get_msg_dict() if parent_id not in msg_dict: ...
@@ -14,12 +14,30 @@ class UserChatRepository(pydantic.BaseModel): class Config: arbitrary_types_allowed = True - async def get_chats(self, include_hidden: bool = False) -> list[models.DbChat]: + async def get_chats( + self, + include_hidden: bool = False, + limit: int | None =...
inference/server/oasst_inference_server/user_chat_repository.py
0
Python
1
none
16
51
51
true
support pagination for chat list
2,773
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/user_chat_repository.py PR Title: support pagination for chat list BEFORE CODE: if parent_id is None: if len(chat.messages) > 0: raise fastapi.HTTPException(status_code=400, detail="Tr...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@validator("length") def above_zero(cls, v) -> int: if v is not None and v < 0: raise ValueError(f"Length cannot be lower than 0. Received {v}") return v @validator("quality", "humor", "creativity") def between_0_1(cls, v, field: ModelField) -> float: if v is not No...
No issues found.
@validator("length") def above_zero(cls, v) -> int: if v is not None and v < 0: raise ValueError(f"Length cannot be lower than 0. Received {v}") return v @validator("quality", "humor", "creativity") def between_0_1(cls, v, field: ModelField) -> float: if v is not No...
@@ -1,7 +1,8 @@ from itertools import zip_longest from random import shuffle -from model_training.custom_datasets.entities import Language, Mode +from langcodes import Language +from model_training.custom_datasets.entities import Mode from pydantic import BaseModel, validator from pydantic.fields import ModelFiel...
model/model_training/custom_datasets/formatting.py
0
Python
1
none
16
51
51
true
update entities
2,809
LAION-AI/Open-Assistant
29,137
Python
CloseChoice
Review this pull request change. Language: Python File: model/model_training/custom_datasets/formatting.py PR Title: update entities BEFORE CODE: @validator("length") def above_zero(cls, v) -> int: if v is not None and v < 0: raise ValueError(f"Length cannot be lower than 0. Received {v...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if (model.includes("Llama")) { const OA = await createInferenceClient(user.username, user.id); if (!chatId) { let chat = await OA.create_chat(); chatId = chat.id; } let prompter_message = await OA.post_prompter_message({ chat_id: chatId, content: message, parent_id: paren...
No issues found.
if (model.includes("Llama")) { const OA = await createInferenceClient(user.username, user.id); if (!chatId) { let chat = await OA.create_chat(); chatId = chat.id; } let prompter_message = await OA.post_prompter_message({ chat_id: chatId, content: message, parent_id: paren...
@@ -0,0 +1,75 @@ +import { createInferenceClient } from "../modules/inference/client.js"; +import { HfInference } from "@huggingface/inference"; +const hf = new HfInference(process.env.HUGGINGFACE_TOKEN); + +export default async function chat( + model, + user, + message, + chatId?, + parentId?, + presets?, + pre...
discord-bots/oa-bot-js/src/modules/chat.ts
0
TypeScript
1
none
16
51
51
true
Discord bot: Pythia model
2,831
LAION-AI/Open-Assistant
29,137
Python
mrloldev
Review this pull request change. Language: TypeScript File: discord-bots/oa-bot-js/src/modules/chat.ts PR Title: Discord bot: Pythia model BEFORE CODE: if (model.includes("Llama")) { const OA = await createInferenceClient(user.username, user.id); if (!chatId) { let chat = await OA.create_chat(); ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
token = self.tokens.pop() end_tokens.append(token) end_sequence = token.text + end_sequence if end_sequence in self.stop_sequences: break else: self.tokens.extend(reversed(end_tokens)) yield from ...
No issues found.
token = self.tokens.pop() end_tokens.append(token) end_sequence = token.text + end_sequence if end_sequence in self.stop_sequences: break else: self.tokens.extend(reversed(end_tokens)) yield from ...
@@ -103,9 +103,8 @@ def text_to_events(text: str, seed: int | None = None, pause: float = 0.0): def lorem_events(seed): - sentence = lorem.sentence() - time.sleep(1) - yield from text_to_events(sentence, seed=seed, pause=0.5) + sentence = lorem.paragraph() + yield from text_to_events(sentence, seed=...
inference/worker/utils.py
0
Python
1
none
16
51
51
true
Implement auto scroll when stream message
2,839
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: Python File: inference/worker/utils.py PR Title: Implement auto scroll when stream message BEFORE CODE: token = self.tokens.pop() end_tokens.append(token) end_sequence = token.text + end_sequence if end_sequen...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
(e: ChangeEvent<HTMLSelectElement>) => { const newPresetName = e.target.value; const config = newPresetName === customPresetName ? customPresetDefaultValue : presets.find((preset) => preset.name === newPresetName)!.sampling_parameters; for (const [key, value] of Object...
No issues found.
(e: ChangeEvent<HTMLSelectElement>) => { const newPresetName = e.target.value; const config = newPresetName === customPresetName ? customPresetDefaultValue : presets.find((preset) => preset.name === newPresetName)!.sampling_parameters; for (const [key, value] of Object...
@@ -17,9 +17,9 @@ import { Tooltip, } from "@chakra-ui/react"; import { useTranslation } from "next-i18next"; -import { ChangeEvent, memo, useCallback, useState } from "react"; -import { Controller, useFormContext, useWatch } from "react-hook-form"; -import { ChatConfigFormData, SamplingParameters } from "src/type...
website/src/components/Chat/ChatConfigForm.tsx
0
TypeScript
1
none
16
51
51
true
Fix saving model between chats
2,843
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatConfigForm.tsx PR Title: Fix saving model between chats BEFORE CODE: (e: ChangeEvent<HTMLSelectElement>) => { const newPresetName = e.target.value; const config = newPresetName === customPresetName ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
chats: chatResponse.chats.map((chat) => { if (chat.id === chatId) { return { ...chat, title, }; } return chat; }), })) || []), ], false ); }, [mut...
No issues found.
chats: chatResponse.chats.map((chat) => { if (chat.id === chatId) { return { ...chat, title, }; } return chat; }), })) || []), ], false ); }, [mut...
@@ -5,51 +5,67 @@ import { Plus } from "lucide-react"; import { useTranslation } from "next-i18next"; import { memo, useCallback } from "react"; import SimpleBar from "simplebar-react"; -import { get } from "src/lib/api"; -import { API_ROUTES } from "src/lib/routes"; import { GetChatsResponse } from "src/types/Chat...
website/src/components/Chat/ChatListBase.tsx
0
TypeScript
1
none
16
51
51
true
feat(website): support pagination for chat list
2,860
LAION-AI/Open-Assistant
29,137
Python
mtosity
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatListBase.tsx PR Title: feat(website): support pagination for chat list BEFORE CODE: chats: chatResponse.chats.map((chat) => { if (chat.id === chatId) { return { ......
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
{ ...columnHelper.accessor("display_name", { header: "Name", }), filterable: true, meta: { cellProps: (x) => { return { style: { overflow: "hidden" } }; }, }, }, columnHelper.accessor("role", { header: "Role", }), columnHelper.accessor((user) => user.user_id, ...
No issues found.
{ ...columnHelper.accessor("display_name", { header: "Name", }), filterable: true, meta: { cellProps: (x) => { return { style: { overflow: "hidden" } }; }, }, }, columnHelper.accessor("role", { header: "Role", }), columnHelper.accessor((user) => user.user_id, ...
@@ -1,5 +1,5 @@ import { Card, CardBody, IconButton } from "@chakra-ui/react"; -import { createColumnHelper } from "@tanstack/react-table"; +import { createColumnHelper, Cell } from "@tanstack/react-table"; import { Pencil } from "lucide-react"; import Link from "next/link"; import { memo, useState } from "react"; ...
website/src/components/UserTable.tsx
0
TypeScript
1
none
16
51
51
true
Fix display name spill-over (#2851)
2,863
LAION-AI/Open-Assistant
29,137
Python
scorbett123
Review this pull request change. Language: TypeScript File: website/src/components/UserTable.tsx PR Title: Fix display name spill-over (#2851) BEFORE CODE: { ...columnHelper.accessor("display_name", { header: "Name", }), filterable: true, meta: { cellProps: (x) => { return { st...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
isSending: boolean; onSubmit: () => void; queueInfo: QueueInfo | null; }; // eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, ref) => { const { isSending, onSubmit: onSubmit, queueInfo } = props; const { t } = useTranslation("chat"); ...
No issues found.
isSending: boolean; onSubmit: () => void; queueInfo: QueueInfo | null; }; // eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, ref) => { const { isSending, onSubmit: onSubmit, queueInfo } = props; const { t } = useTranslation("chat"); ...
@@ -35,12 +35,7 @@ export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, r [onSubmit] ); return ( - <Box - as="form" - maxWidth={{ base: "3xl", "2xl": "4xl" }} - onSubmit={handleSubmit} - className="pt-2 pb-4 w-full mx-auto" - > + <Box as="form" maxWidth=...
website/src/components/Chat/ChatForm.tsx
0
TypeScript
1
none
16
51
51
true
update chat warning design
2,924
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatForm.tsx PR Title: update chat warning design BEFORE CODE: isSending: boolean; onSubmit: () => void; queueInfo: QueueInfo | null; }; // eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HT...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def read_message_trees(input_file_path: str | Path) -> Iterable[ExportMessageTree]: for x in read_oasst_jsonl(input_file_path): assert isinstance(x, ExportMessageTree) yield x def read_message_tree_list( input_file_path: str | Path, filter: Optional[Callable[[ExportMessageTree], bool]] = N...
No issues found.
def read_message_trees(input_file_path: str | Path) -> Iterable[ExportMessageTree]: for x in read_oasst_jsonl(input_file_path): assert isinstance(x, ExportMessageTree) yield x def read_message_tree_list( input_file_path: str | Path, filter: Optional[Callable[[ExportMessageTree], bool]] = N...
@@ -4,6 +4,7 @@ from typing import Callable, Iterable, Optional, TextIO import pydantic +from datasets import load_dataset from .schemas import ExportMessageNode, ExportMessageTree @@ -17,22 +18,24 @@ def open_jsonl_read(input_file_path: str | Path) -> TextIO: return input_file_path.open("r", encoding...
oasst-data/oasst_data/reader.py
0
Python
1
none
16
51
51
true
Add data loader for HF oasst1
2,951
LAION-AI/Open-Assistant
29,137
Python
grgau
Review this pull request change. Language: Python File: oasst-data/oasst_data/reader.py PR Title: Add data loader for HF oasst1 BEFORE CODE: def read_message_trees(input_file_path: str | Path) -> Iterable[ExportMessageTree]: for x in read_oasst_jsonl(input_file_path): assert isinstance(x, ExportMessageT...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { AxiosError } from "axios"; import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client"; import { InferencePostAssistantMessageParams } from "src/types/Chat"; const handler = withoutRole("banned", async ...
No issues found.
import { AxiosError } from "axios"; import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client"; import { InferencePostAssistantMessageParams } from "src/types/Chat"; const handler = withoutRole("banned", async ...
@@ -1,3 +1,4 @@ +import { AxiosError } from "axios"; import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } from "src/lib/oasst_inference_client"; @@ -9,12 +10,16 @@ const handler = withoutRole("banned", async (req, res, token) => { } c...
website/src/pages/api/chat/assistant_message.ts
0
TypeScript
1
none
16
26
26
true
Handle chat error
2,959
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/pages/api/chat/assistant_message.ts PR Title: Handle chat error BEFORE CODE: import { AxiosError } from "axios"; import { withoutRole } from "src/lib/auth"; import { isChatEnable } from "src/lib/isChatEnable"; import { createInferenceClient } f...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, forwardedRef) => { const { isSending, onSubmit: onSubmit, queueInfo } = props; const { t } = useTranslation("chat"); const handleSubmit = useCallback( (e: SyntheticEvent) => { e....
No issues found.
// eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, forwardedRef) => { const { isSending, onSubmit: onSubmit, queueInfo } = props; const { t } = useTranslation("chat"); const handleSubmit = useCallback( (e: SyntheticEvent) => { e....
@@ -1,8 +1,9 @@ -import { Box, CircularProgress, Flex, Textarea } from "@chakra-ui/react"; +import { Box, CircularProgress, Flex, Textarea, useBreakpointValue } from "@chakra-ui/react"; import { Send } from "lucide-react"; import { useTranslation } from "next-i18next"; -import { forwardRef, KeyboardEvent, SyntheticEv...
website/src/components/Chat/ChatForm.tsx
0
TypeScript
1
none
16
51
51
true
Auto focus chat input
2,998
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatForm.tsx PR Title: Auto focus chat input BEFORE CODE: // eslint-disable-next-line react/display-name export const ChatForm = forwardRef<HTMLTextAreaElement, ChatFormProps>((props, forwardedRef) => { const { isSending, onSu...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
: presets.find((preset) => preset.name === newPresetName)!.sampling_parameters; for (const [key, value] of Object.entries(config) as Array<[keyof SamplingParameters, number]>) { setValue(key, value, { shouldDirty: true }); // force dirty so the ChatConfigSaver will update the cache } ...
No issues found.
: presets.find((preset) => preset.name === newPresetName)!.sampling_parameters; for (const [key, value] of Object.entries(config) as Array<[keyof SamplingParameters, number]>) { setValue(key, value, { shouldDirty: true }); // force dirty so the ChatConfigSaver will update the cache } ...
@@ -92,7 +92,7 @@ export const ChatConfigForm = memo(function ChatConfigForm() { const { control, getValues, register, setValue } = useFormContext<ChatConfigFormData>(); const selectedModel = getValues("model_config_name"); // have to use getValues to here to access latest value - const plugins = getValues("pl...
website/src/components/Chat/ChatConfigForm.tsx
0
TypeScript
1
none
16
51
51
true
Fixed PluginChooser button width problem
3,014
LAION-AI/Open-Assistant
29,137
Python
draganjovanovich
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatConfigForm.tsx PR Title: Fixed PluginChooser button width problem BEFORE CODE: : presets.find((preset) => preset.name === newPresetName)!.sampling_parameters; for (const [key, value] of Object.entries(config...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
safety_rots=safety_rots, ), ) logger.debug(f"Safe prompt: {prompt}") stream_response = None token_buffer = utils.TokenBuffer(stop_sequences=parameters.stop) if model_config.is_lorem: stream_events = utils.lorem_events(parameters.seed) ...
No issues found.
safety_rots=safety_rots, ), ) logger.debug(f"Safe prompt: {prompt}") stream_response = None token_buffer = utils.TokenBuffer(stop_sequences=parameters.stop) if model_config.is_lorem: stream_events = utils.lorem_events(parameters.seed) ...
@@ -1,58 +1,25 @@ import re -import threading from concurrent import futures import chat_chain import interface import requests -import sseclient import transformers import utils import websocket -from chat_chain_prompts import ASSISTANT_PREFIX, END_SEQ, OBSERVATION_SEQ, START_SEQ, THOUGHT_SEQ +from chat_chai...
inference/worker/work.py
0
Python
1
none
16
51
51
true
Fix plugins
3,017
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/worker/work.py PR Title: Fix plugins BEFORE CODE: safety_rots=safety_rots, ), ) logger.debug(f"Safe prompt: {prompt}") stream_response = None token_buffer = utils.TokenBuffer(stop_...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pe="50px" borderRadius="lg" maxLength={100} autoFocus ></Input> <Flex position="absolute" alignContent="center" style={{ insetInlineEnd: `8px`, }} gap="1.5" zIndex={1...
No issues found.
pe="50px" borderRadius="lg" maxLength={100} autoFocus ></Input> <Flex position="absolute" alignContent="center" style={{ insetInlineEnd: `8px`, }} gap="1.5" zIndex={1...
@@ -1,10 +1,32 @@ -import { Box, Button, CircularProgress, Flex, Input, Tooltip, useBoolean, useOutsideClick } from "@chakra-ui/react"; -import { Check, EyeOff, LucideIcon, Pencil, X } from "lucide-react"; +import { + AlertDialog, + AlertDialogBody, + AlertDialogContent, + AlertDialogFooter, + AlertDialogHeader, +...
website/src/components/Chat/ChatListItem.tsx
0
TypeScript
1
none
16
51
51
true
add delete function
3,019
LAION-AI/Open-Assistant
29,137
Python
ruoniw
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatListItem.tsx PR Title: add delete function BEFORE CODE: pe="50px" borderRadius="lg" maxLength={100} autoFocus ></Input> <Flex position="absolute...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
handler: setIsEditing.off, }); const handleKeydown = useCallback( (e: KeyboardEvent) => { if (e.key === "Escape") { setIsEditing.off(); } if (e.key === "Enter" && !e.shiftKey) { handleEditSubmit(); } }, [handleEditSubmit, setIsEditing] ); const { onCopy,...
No issues found.
handler: setIsEditing.off, }); const handleKeydown = useCallback( (e: KeyboardEvent) => { if (e.key === "Escape") { setIsEditing.off(); } if (e.key === "Enter" && !e.shiftKey) { handleEditSubmit(); } }, [handleEditSubmit, setIsEditing] ); const { onCopy,...
@@ -22,6 +22,7 @@ import { BaseMessageEntry } from "../Messages/BaseMessageEntry"; import { BaseMessageEmojiButton } from "../Messages/MessageEmojiButton"; import { MessageInlineEmojiRow } from "../Messages/MessageInlineEmojiRow"; import { WorkParametersDisplay } from "./WorkParameters"; +import { EncourageMessage }...
website/src/components/Chat/ChatMessageEntry.tsx
0
TypeScript
1
none
16
51
51
true
Created feedback encouragement message
3,057
LAION-AI/Open-Assistant
29,137
Python
amitag2
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatMessageEntry.tsx PR Title: Created feedback encouragement message BEFORE CODE: handler: setIsEditing.off, }); const handleKeydown = useCallback( (e: KeyboardEvent) => { if (e.key === "Escape") { se...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
name="k50-Plugins", description="Top-k sampling with k=50 and temperature=0.35", sampling_parameters=inference.SamplingParameters( max_new_tokens=1024, temperature=0.35, top_k=50, repetition_penalty=(1 / 0.90), ), ), ParameterConfig...
No issues found.
name="k50-Plugins", description="Top-k sampling with k=50 and temperature=0.35", sampling_parameters=inference.SamplingParameters( max_new_tokens=1024, temperature=0.35, top_k=50, repetition_penalty=(1 / 0.90), ), ), ParameterConfig...
@@ -1,4 +1,5 @@ import asyncio +import json import aiohttp import fastapi @@ -121,8 +122,14 @@ async def fetch_plugin(url: str, retries: int = 3, timeout: float = 5.0) -> infe content_type = response.headers.get("Content-Type") if response.status == 200: - ...
inference/server/oasst_inference_server/routes/configs.py
0
Python
1
none
16
51
51
true
Plugins fixes
3,070
LAION-AI/Open-Assistant
29,137
Python
draganjovanovich
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/routes/configs.py PR Title: Plugins fixes BEFORE CODE: name="k50-Plugins", description="Top-k sampling with k=50 and temperature=0.35", sampling_parameters=inference.SamplingParameters( ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { useEffect, useMemo, useRef } from "react"; import { get } from "src/lib/api"; import { API_ROUTES } from "src/lib/routes"; import { GetChatsResponse } from "src/types/Chat"; import useSWRInfinite from "swr/infinite"; export type ChatListViewSelection = "visible" | "visible_hidden"; export function useListCha...
No issues found.
import { useEffect, useMemo, useRef } from "react"; import { get } from "src/lib/api"; import { API_ROUTES } from "src/lib/routes"; import { GetChatsResponse } from "src/types/Chat"; import useSWRInfinite from "swr/infinite"; export type ChatListViewSelection = "visible" | "visible_hidden"; export function useListCha...
@@ -1,25 +1,28 @@ import { useEffect, useMemo, useRef } from "react"; import { get } from "src/lib/api"; +import { API_ROUTES } from "src/lib/routes"; import { GetChatsResponse } from "src/types/Chat"; import useSWRInfinite from "swr/infinite"; -export function useListChatPagination(initialChats?: GetChatsRespons...
website/src/components/Chat/useListChatPagination.ts
0
TypeScript
1
none
16
47
47
true
Show hidden chats in chat list
3,075
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/components/Chat/useListChatPagination.ts PR Title: Show hidden chats in chat list BEFORE CODE: import { useEffect, useMemo, useRef } from "react"; import { get } from "src/lib/api"; import { API_ROUTES } from "src/lib/routes"; import { GetChats...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
<ChatParameterField {...item} value={getValues(name)} // need to call getValues here, react-hook-form not trigger rerender when call setValue manually onChange={onChange} name={name} isDisabled={selectedPresetName ...
No issues found.
<ChatParameterField {...item} value={getValues(name)} // need to call getValues here, react-hook-form not trigger rerender when call setValue manually onChange={onChange} name={name} isDisabled={selectedPresetName ...
@@ -19,14 +19,18 @@ import { import { useTranslation } from "next-i18next"; import { ChangeEvent, memo, useCallback, useEffect, useRef, useState } from "react"; import { Controller, useFormContext, UseFormSetValue } from "react-hook-form"; +import SimpleBar from "simplebar-react"; import { ChatConfigFormData, Model...
website/src/components/Chat/ChatConfigForm.tsx
0
TypeScript
1
none
16
51
51
true
Allow to save custom preset
3,079
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatConfigForm.tsx PR Title: Allow to save custom preset BEFORE CODE: <ChatParameterField {...item} value={getValues(name)} // need to call getValues here, react-hook-form not ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"""add text search Revision ID: 1b6e3ae16e9d Revises: 9db92d504f64 Create Date: 2023-05-07 21:29:35.545612 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "1b6e3ae16e9d" down_revision = "9db92d504f64" branch_labels = Non...
No issues found.
"""add text search Revision ID: 1b6e3ae16e9d Revises: 9db92d504f64 Create Date: 2023-05-07 21:29:35.545612 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "1b6e3ae16e9d" down_revision = "9db92d504f64" branch_labels = Non...
@@ -0,0 +1,25 @@ +"""add text search + +Revision ID: 1b6e3ae16e9d +Revises: 9db92d504f64 +Create Date: 2023-05-07 21:29:35.545612 +""" +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = "1b6e3ae16e9d" +down_revision = "9db...
backend/alembic/versions/2023_05_07_2129-1b6e3ae16e9d_add_text_search.py
0
Python
1
none
16
26
26
true
Backend support for message search
3,080
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: backend/alembic/versions/2023_05_07_2129-1b6e3ae16e9d_add_text_search.py PR Title: Backend support for message search BEFORE CODE: """add text search Revision ID: 1b6e3ae16e9d Revises: 9db92d504f64 Create Date: 2023-05-07 21:29:35.545612 """ import sqlalchemy...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from oasst_backend.config import settings from oasst_backend.models.message import Message ROOT_ENDPOINT = "https://discord.com/api/v10" @celery_app.task(name="send_new_report_message") def send_new_report_message(message: Message, label_text: str, user_id: UUID): """ Send a message to the Discord channel wh...
No issues found.
from oasst_backend.config import settings from oasst_backend.models.message import Message ROOT_ENDPOINT = "https://discord.com/api/v10" @celery_app.task(name="send_new_report_message") def send_new_report_message(message: Message, label_text: str, user_id: UUID): """ Send a message to the Discord channel wh...
@@ -2,13 +2,24 @@ import requests from loguru import logger +from oasst_backend.celery_worker import app as celery_app from oasst_backend.config import settings from oasst_backend.models.message import Message ROOT_ENDPOINT = "https://discord.com/api/v10" -def send_new_report_message(message: Message, labe...
backend/oasst_backend/utils/discord.py
0
Python
1
none
16
51
51
true
Make send report message from discord a celery task.
3,089
LAION-AI/Open-Assistant
29,137
Python
espoirMur
Review this pull request change. Language: Python File: backend/oasst_backend/utils/discord.py PR Title: Make send report message from discord a celery task. BEFORE CODE: from oasst_backend.config import settings from oasst_backend.models.message import Message ROOT_ENDPOINT = "https://discord.com/api/v10" @cele...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# format to QnA def qna_wrapper(): def create_qna(row): # make a random number random_num = random.randint(0, 2) # extract rows' vals con_type = row["Type"] lang = row["Language"] word1 = row["Word1"] word2 = row["Word2"] score_percent = row["Score"]...
No issues found.
# format to QnA def qna_wrapper(): def create_qna(row): # make a random number random_num = random.randint(0, 2) # extract rows' vals con_type = row["Type"] lang = row["Language"] word1 = row["Word1"] word2 = row["Word2"] score_percent = row["Score"]...
@@ -0,0 +1,72 @@ +import json +import random +from dataclasses import dataclass + +import pandas as pd +import random_stuff +from datasets import load_dataset + +random.seed(42) + + +# format to QnA +def qna_wrapper(): + def create_qna(row): + # make a random number + random_num = random.randint(0, 2) ...
data/datasets/semantics_ws_qna_oa/data_process.py
0
Python
1
none
16
51
51
true
Add semantics WS dataset
3,200
LAION-AI/Open-Assistant
29,137
Python
echo0x22
Review this pull request change. Language: Python File: data/datasets/semantics_ws_qna_oa/data_process.py PR Title: Add semantics WS dataset BEFORE CODE: # format to QnA def qna_wrapper(): def create_qna(row): # make a random number random_num = random.randint(0, 2) # extract rows' vals...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
tool_names = None final_input = ( f"{input_prompt}{eos_token}{V2_ASST_PREFIX}\n{prev_chain_response}{OBSERVATION_SEQ} {tool_response}" ) inner_prompt = prepare_prompt( final_input, prompt_template, memor...
No issues found.
tool_names = None final_input = ( f"{input_prompt}{eos_token}{V2_ASST_PREFIX}\n{prev_chain_response}{OBSERVATION_SEQ} {tool_response}" ) inner_prompt = prepare_prompt( final_input, prompt_template, memor...
@@ -25,9 +25,6 @@ from oasst_shared.schemas import inference from settings import settings -# Max depth of retries for tool usage -MAX_DEPTH = 6 - # Exclude tools description from final prompt. Saves ctx space but can hurt output # quality especially if truncation kicks in. Dependent on model used REMOVE_TOOLS_F...
inference/worker/chat_chain.py
0
Python
1
none
16
51
51
true
Add inference server setting to control max depth of plugins
3,227
LAION-AI/Open-Assistant
29,137
Python
olliestanley
Review this pull request change. Language: Python File: inference/worker/chat_chain.py PR Title: Add inference server setting to control max depth of plugins BEFORE CODE: tool_names = None final_input = ( f"{input_prompt}{eos_token}{V2_ASST_PREFIX}\n{prev_chain_response}...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
message: inference.MessageRead | None = None class MessageResponseEvent(pydantic.BaseModel): event_type: Literal["message"] = "message" message: inference.MessageRead class SafePromptResponseEvent(pydantic.BaseModel): event_type: Literal["safe_prompt"] = "safe_prompt" safe_prompt: str messag...
No issues found.
message: inference.MessageRead | None = None class MessageResponseEvent(pydantic.BaseModel): event_type: Literal["message"] = "message" message: inference.MessageRead class SafePromptResponseEvent(pydantic.BaseModel): event_type: Literal["safe_prompt"] = "safe_prompt" safe_prompt: str messag...
@@ -46,8 +46,23 @@ class SafePromptResponseEvent(pydantic.BaseModel): message: inference.MessageRead +class PluginIntermediateResponseEvent(pydantic.BaseModel): + event_type: Literal["plugin_intermediate"] = "plugin_intermediate" + current_plugin_thought: str + current_plugin_action_taken: str + cu...
inference/server/oasst_inference_server/schemas/chat.py
0
Python
1
none
16
51
51
true
Plugins intermediate steps reporting
3,238
LAION-AI/Open-Assistant
29,137
Python
draganjovanovich
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/schemas/chat.py PR Title: Plugins intermediate steps reporting BEFORE CODE: message: inference.MessageRead | None = None class MessageResponseEvent(pydantic.BaseModel): event_type: Literal["message"] = "message...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/roast-user/", operation_id="roastUser") async def roast_user( roasting_style: str = Query(..., description="style of roasting and malice tha...
No issues found.
app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/roast-user/", operation_id="roastUser") async def roast_user( roasting_style: str = Query(..., description="style of roasting and malice tha...
@@ -0,0 +1,66 @@ +import json +from pathlib import Path + +from fastapi import FastAPI, Query, Request, Response +from fastapi.middleware.cors import CORSMiddleware +from fastapi.openapi.utils import get_openapi + +folder_path = Path(__file__).parent + +app = FastAPI() + +app.add_middleware( + CORSMiddleware, + a...
inference/server/oasst_inference_server/plugins/gale_roaster/main.py
0
Python
1
none
16
51
51
true
Add Dragan's web retriever plugin
3,277
LAION-AI/Open-Assistant
29,137
Python
andreaskoepf
Review this pull request change. Language: Python File: inference/server/oasst_inference_server/plugins/gale_roaster/main.py PR Title: Add Dragan's web retriever plugin BEFORE CODE: app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"]...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"""add_message_revisions Revision ID: c181661eba3a Revises: 1b6e3ae16e9d Create Date: 2023-06-06 15:05:58.079120 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "c181661eba3a" down_revision = "1b6e3ae16e9d" branch_label...
No issues found.
"""add_message_revisions Revision ID: c181661eba3a Revises: 1b6e3ae16e9d Create Date: 2023-06-06 15:05:58.079120 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "c181661eba3a" down_revision = "1b6e3ae16e9d" branch_label...
@@ -0,0 +1,50 @@ +"""add_message_revisions + +Revision ID: c181661eba3a +Revises: 1b6e3ae16e9d +Create Date: 2023-06-06 15:05:58.079120 + +""" +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = "c181661eba3a" +down_revisio...
backend/alembic/versions/2023_06_06_1505-c181661eba3a_add_message_revisions.py
0
Python
1
none
16
51
51
true
Moderator Message Editing
3,280
LAION-AI/Open-Assistant
29,137
Python
someone13574
Review this pull request change. Language: Python File: backend/alembic/versions/2023_06_06_1505-c181661eba3a_add_message_revisions.py PR Title: Moderator Message Editing BEFORE CODE: """add_message_revisions Revision ID: c181661eba3a Revises: 1b6e3ae16e9d Create Date: 2023-06-06 15:05:58.079120 """ import sqlalc...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
onReport={showReportPopup} message={message} /> <LabelMessagePopup message={message} show={labelPopupOpen} onClose={closeLabelPopup} /> <ReportPopup messageId={message.id} show={reportPopupOpen} onClose={closeReportPopup} /> </MessageInlineEmojiR...
No issues found.
onReport={showReportPopup} message={message} /> <LabelMessagePopup message={message} show={labelPopupOpen} onClose={closeLabelPopup} /> <ReportPopup messageId={message.id} show={reportPopupOpen} onClose={closeReportPopup} /> </MessageInlineEmojiR...
@@ -9,7 +9,6 @@ import { MenuList, Portal, SimpleGrid, - Text, Tooltip, useColorModeValue, useDisclosure, @@ -39,7 +38,6 @@ import { LabelMessagePopup } from "src/components/Messages/LabelPopup"; import { MessageEmojiButton } from "src/components/Messages/MessageEmojiButton"; import { ReportPopup }...
website/src/components/Messages/MessageTableEntry.tsx
0
TypeScript
1
none
16
51
51
true
Edit history viewer
3,322
LAION-AI/Open-Assistant
29,137
Python
someone13574
Review this pull request change. Language: TypeScript File: website/src/components/Messages/MessageTableEntry.tsx PR Title: Edit history viewer BEFORE CODE: onReport={showReportPopup} message={message} /> <LabelMessagePopup message={message} show={labelPopupOpen} ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
borderInlineStartColor: "gray.300", _dark: { borderInlineStartColor: "gray.500", }, }, "table tbody tr": { borderBottomColor: "gray.400", _dark: { borderBottomColor: "gray.700", }, }, "table thead tr": { borderBottomColor: "gray.400", borderBottomWidth: "1px", _da...
No issues found.
borderInlineStartColor: "gray.300", _dark: { borderInlineStartColor: "gray.500", }, }, "table tbody tr": { borderBottomColor: "gray.400", _dark: { borderBottomColor: "gray.700", }, }, "table thead tr": { borderBottomColor: "gray.400", borderBottomWidth: "1px", _da...
@@ -1,3 +1,5 @@ +import "katex/dist/katex.min.css"; + import { Box, Button, @@ -17,13 +19,11 @@ import { useTranslation } from "next-i18next"; import { memo, MouseEvent, useMemo, useState } from "react"; import ReactMarkdown from "react-markdown"; import type { ReactMarkdownOptions } from "react-markdown/lib/...
website/src/components/Messages/RenderedMarkdown.tsx
0
TypeScript
1
none
16
51
51
true
Bug Fix: Delete feature (Fixes three issues)
3,383
LAION-AI/Open-Assistant
29,137
Python
CertifiedJoon
Review this pull request change. Language: TypeScript File: website/src/components/Messages/RenderedMarkdown.tsx PR Title: Bug Fix: Delete feature (Fixes three issues) BEFORE CODE: borderInlineStartColor: "gray.300", _dark: { borderInlineStartColor: "gray.500", }, }, "table tbody tr": { bo...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
})) || []), ], false ); }, [mutateChatResponses] ); const removeItemFromList = useCallback( ({ chatId }: { chatId: string }) => { mutateChatResponses( (chatResponses) => [ ...(chatResponses?.map((chatResponse) => ({ ...chatResponse, ...
No issues found.
})) || []), ], false ); }, [mutateChatResponses] ); const removeItemFromList = useCallback( ({ chatId }: { chatId: string }) => { mutateChatResponses( (chatResponses) => [ ...(chatResponses?.map((chatResponse) => ({ ...chatResponse, ...
@@ -14,9 +14,9 @@ import { ChatListViewSelection, useListChatPagination } from "./useListChatPagin export const ChatListBase = memo(function ChatListBase({ allowViews, - minHeight, + noScrollbar, ...props -}: CardProps & { allowViews?: boolean; minHeight?: string }) { +}: CardProps & { allowViews?: boolean; ...
website/src/components/Chat/ChatListBase.tsx
0
TypeScript
1
none
16
51
51
true
fix chat list double scrollbar
3,385
LAION-AI/Open-Assistant
29,137
Python
notmd
Review this pull request change. Language: TypeScript File: website/src/components/Chat/ChatListBase.tsx PR Title: fix chat list double scrollbar BEFORE CODE: })) || []), ], false ); }, [mutateChatResponses] ); const removeItemFromList = useCallback( ({ chatId }: { c...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
onReview: () => void; onSubmit: () => void; onSkip: () => void; } export const TaskControls = ({ task, taskStatus, isLoading, isRejecting, isSubmitting, onEdit, onReview, onSubmit, onSkip, }: TaskControlsProps) => { const { t } = useTranslation(); return ( <Card> {isLoading && <P...
No issues found.
onReview: () => void; onSubmit: () => void; onSkip: () => void; } export const TaskControls = ({ task, taskStatus, isLoading, isRejecting, isSubmitting, onEdit, onReview, onSubmit, onSkip, }: TaskControlsProps) => { const { t } = useTranslation(); return ( <Card> {isLoading && <P...
@@ -1,11 +1,13 @@ -import { Button, Card, Flex, IconButton, Progress, Tooltip } from "@chakra-ui/react"; +import { Card, Flex, IconButton, Progress, Tooltip } from "@chakra-ui/react"; import { Edit2 } from "lucide-react"; import { useTranslation } from "next-i18next"; import { SubmitButton } from "src/components/But...
website/src/components/Survey/TaskControls.tsx
0
TypeScript
1
none
16
51
51
true
Added confirmation dialog when skipping after entering text
3,479
LAION-AI/Open-Assistant
29,137
Python
MehrJonas
Review this pull request change. Language: TypeScript File: website/src/components/Survey/TaskControls.tsx PR Title: Added confirmation dialog when skipping after entering text BEFORE CODE: onReview: () => void; onSubmit: () => void; onSkip: () => void; } export const TaskControls = ({ task, taskStatus, ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
const { data: session, status } = useSession(); const isAdminOrMod = useHasAnyRole(["admin", "moderator"]); if (!session || status !== "authenticated") { return null; } const options: MenuOption[] = [ { name: t("dashboard"), href: "/dashboard", icon: Layout, isExternal: false, ...
No issues found.
const { data: session, status } = useSession(); const isAdminOrMod = useHasAnyRole(["admin", "moderator"]); if (!session || status !== "authenticated") { return null; } const options: MenuOption[] = [ { name: t("dashboard"), href: "/dashboard", icon: Layout, isExternal: false, ...
@@ -72,7 +72,7 @@ export function UserMenu() { <Menu> <MenuButton border="solid" borderRadius="full" borderWidth="thin" borderColor={borderColor}> <Box display="flex" alignItems="center" gap="3" p="1"> - <Avatar size="sm" src={session.user.image!} /> + <Avatar size="sm" src={sessi...
website/src/components/Header/UserMenu.tsx
0
TypeScript
1
none
16
51
51
true
Update profile image on login
3,491
LAION-AI/Open-Assistant
29,137
Python
AbdBarho
Review this pull request change. Language: TypeScript File: website/src/components/Header/UserMenu.tsx PR Title: Update profile image on login BEFORE CODE: const { data: session, status } = useSession(); const isAdminOrMod = useHasAnyRole(["admin", "moderator"]); if (!session || status !== "authenticated") { ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { LucideProps } from "lucide-react"; export const MarkdownOffIcon = (props: LucideProps) => { return ( <svg xmlns="http://www.w3.org/2000/svg" className="icon icon-tabler icon-tabler-markdown-off" width={24} height={24} viewBox="0 0 24 24" strokeWidth="2" stroke="...
No issues found.
import { LucideProps } from "lucide-react"; export const MarkdownOffIcon = (props: LucideProps) => { return ( <svg xmlns="http://www.w3.org/2000/svg" className="icon icon-tabler icon-tabler-markdown-off" width={24} height={24} viewBox="0 0 24 24" strokeWidth="2" stroke="...
@@ -0,0 +1,26 @@ +import { LucideProps } from "lucide-react"; + +export const MarkdownOffIcon = (props: LucideProps) => { + return ( + <svg + xmlns="http://www.w3.org/2000/svg" + className="icon icon-tabler icon-tabler-markdown-off" + width={24} + height={24} + viewBox="0 0 24 24" + st...
website/src/components/icons/MarkdownOff.tsx
0
TypeScript
1
none
16
27
27
true
Add: option to view plaintext chat message. Issue/2508
3,496
LAION-AI/Open-Assistant
29,137
Python
CertifiedJoon
Review this pull request change. Language: TypeScript File: website/src/components/icons/MarkdownOff.tsx PR Title: Add: option to view plaintext chat message. Issue/2508 BEFORE CODE: import { LucideProps } from "lucide-react"; export const MarkdownOffIcon = (props: LucideProps) => { return ( <svg xmlns...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import { getValidDisplayName } from "src/lib/display_name_validation"; import prisma from "src/lib/prismadb"; import { getBatchFrontendUserIdFromBackendUser } from "src/lib/users"; import { AuthMethod } from "src/types/Providers"; export const updateUsersDisplayNames = <T extends { display_name: string; username: stri...
No issues found.
import { getValidDisplayName } from "src/lib/display_name_validation"; import prisma from "src/lib/prismadb"; import { getBatchFrontendUserIdFromBackendUser } from "src/lib/users"; import { AuthMethod } from "src/types/Providers"; export const updateUsersDisplayNames = <T extends { display_name: string; username: stri...
@@ -11,16 +11,16 @@ export const updateUsersDisplayNames = <T extends { display_name: string; userna }; export const updateUsersProfilePictures = async <T extends { auth_method: AuthMethod; username: string }>( - entires: T[] + entries: T[] ) => { - const frontendUserIds = await getBatchFrontendUserIdFromBacken...
website/src/lib/leaderboard_utilities.ts
0
TypeScript
1
none
16
30
30
true
fix typos
3,543
LAION-AI/Open-Assistant
29,137
Python
RainRat
Review this pull request change. Language: TypeScript File: website/src/lib/leaderboard_utilities.ts PR Title: fix typos BEFORE CODE: import { getValidDisplayName } from "src/lib/display_name_validation"; import prisma from "src/lib/prismadb"; import { getBatchFrontendUserIdFromBackendUser } from "src/lib/users"; i...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
except ModuleNotFoundError: warnings.warn( """\nmodule flash_attn not found - either install: pip3 install flash_attn or run with: --use_flash_attention=false """ ) exit(1) if (resid_pdrop is None or resid_pdrop == 0.0) and not flash_attention: ...
No issues found.
except ModuleNotFoundError: warnings.warn( """\nmodule flash_attn not found - either install: pip3 install flash_attn or run with: --use_flash_attention=false """ ) exit(1) if (resid_pdrop is None or resid_pdrop == 0.0) and not flash_attention: ...
@@ -6,12 +6,13 @@ import torch.nn as nn import transformers -from transformers import GPTNeoXForCausalLM, GPTNeoXModel, LlamaForCausalLM, LlamaModel +from transformers import AutoConfig, GPTNeoXForCausalLM, GPTNeoXModel, LlamaForCausalLM, LlamaModel from trlx.models.modeling_ppo import AutoModelForCausalLMWithHydr...
model/model_training/models/patching.py
0
Python
1
none
16
51
51
true
Add RoPE Interpolation
3,564
LAION-AI/Open-Assistant
29,137
Python
shahules786
Review this pull request change. Language: Python File: model/model_training/models/patching.py PR Title: Add RoPE Interpolation BEFORE CODE: except ModuleNotFoundError: warnings.warn( """\nmodule flash_attn not found - either install: pip3 install flash_attn or run with: --u...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import torch from model_training.models.patching import patch_model from transformers import AutoTokenizer from transformers.models.falcon.modeling_falcon import FalconForCausalLM def test_flash_attention_falcon_patch(device="cuda:0"): model_name = "tiiuae/falcon-7b" dtype = torch.bfloat16 tokenizer = Au...
No issues found.
import torch from model_training.models.patching import patch_model from transformers import AutoTokenizer from transformers.models.falcon.modeling_falcon import FalconForCausalLM def test_flash_attention_falcon_patch(device="cuda:0"): model_name = "tiiuae/falcon-7b" dtype = torch.bfloat16 tokenizer = Au...
@@ -0,0 +1,34 @@ +import torch +from model_training.models.patching import patch_model +from transformers import AutoTokenizer +from transformers.models.falcon.modeling_falcon import FalconForCausalLM + + +def test_flash_attention_falcon_patch(device="cuda:0"): + model_name = "tiiuae/falcon-7b" + dtype = torch.bf...
model/model_training/tests/test_patched_falcon.py
0
Python
1
none
16
35
35
true
Add flash-attention patch for falcon-7b
3,580
LAION-AI/Open-Assistant
29,137
Python
andreaskoepf
Review this pull request change. Language: Python File: model/model_training/tests/test_patched_falcon.py PR Title: Add flash-attention patch for falcon-7b BEFORE CODE: import torch from model_training.models.patching import patch_model from transformers import AutoTokenizer from transformers.models.falcon.modeling...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
const handleOpen = () => { setCustomInstructions(savedCustomInstructions); setIsOpen(true); }; const handleClose = () => setIsOpen(false); const handleSave = () => { setIsOpen(false); onChange(customInstructions); }; function createChangeHandler(key: string) { return function handleInp...
No issues found.
const handleOpen = () => { setCustomInstructions(savedCustomInstructions); setIsOpen(true); }; const handleClose = () => setIsOpen(false); const handleSave = () => { setIsOpen(false); onChange(customInstructions); }; function createChangeHandler(key: string) { return function handleInp...
@@ -0,0 +1,106 @@ +import React, { useState } from "react"; +import { + Button, + Modal, + ModalOverlay, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + FormControl, + FormLabel, + Input, + Text, + Textarea, +} from "@chakra-ui/react"; +import { BookOpen } from "lucide-react"; +import { useTran...
website/src/components/Chat/CustomInstructions.tsx
0
TypeScript
1
none
16
51
51
true
Custom instructions feature
3,597
LAION-AI/Open-Assistant
29,137
Python
draganjovanovich
Review this pull request change. Language: TypeScript File: website/src/components/Chat/CustomInstructions.tsx PR Title: Custom instructions feature BEFORE CODE: const handleOpen = () => { setCustomInstructions(savedCustomInstructions); setIsOpen(true); }; const handleClose = () => setIsOpen(false); ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: return dataset, None train_idx, val_idx = train_test_split( list(range(len(dataset))), test_size=val_split, random_state=666, shuffle=True ) return Subset(dataset, train_idx), Subset(da...
No issues found.
def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: return dataset, None train_idx, val_idx = train_test_split( list(range(len(dataset))), test_size=val_split, random_state=666, shuffle=True ) return Subset(dataset, train_idx), Subset(da...
@@ -8,7 +8,7 @@ from model_training.custom_datasets.instruction import INSTRUCTION_DATASETS, InstructionDataset from model_training.custom_datasets.oasst_dataset import load_oasst_export from model_training.custom_datasets.pretrain_datasets import FanFics, RedPajama -from model_training.custom_datasets.prompt_dialog...
model/model_training/custom_datasets/__init__.py
0
Python
1
none
16
51
51
true
Dolphin gpt 3.5 data mix
3,606
LAION-AI/Open-Assistant
29,137
Python
shahules786
Review this pull request change. Language: Python File: model/model_training/custom_datasets/__init__.py PR Title: Dolphin gpt 3.5 data mix BEFORE CODE: def train_val_dataset(dataset, val_split=0.2) -> tuple[Dataset, Dataset | None]: if val_split == 0: return dataset, None train_idx, val_idx = tr...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
class JokeExplaination(Dataset): name = "joke" url = "https://gist.github.com/theblackcat102/42b697e24a13fdb499e20edfbf618361/raw/1834dca207898c15f93b809d1195f6f6e47c9e1e/joke_explained.jsonl" def __init__(self, cache_dir) -> None: super().__init__() os.makedirs(cache_dir, exist_ok=True) ...
No issues found.
class JokeExplaination(Dataset): name = "joke" url = "https://gist.github.com/theblackcat102/42b697e24a13fdb499e20edfbf618361/raw/1834dca207898c15f93b809d1195f6f6e47c9e1e/joke_explained.jsonl" def __init__(self, cache_dir) -> None: super().__init__() os.makedirs(cache_dir, exist_ok=True) ...
@@ -514,9 +514,8 @@ def process_vicuna_conversations( def __init__(self, cache_dir: str | Path, mode: str = "sft", input_max_length: int = 32 * 1024) -> None: super().__init__() - self.pairs = [] - if mode not in ("sft", "rl"): - raise NotImplementedError(f"Currently only the mo...
model/model_training/custom_datasets/qa_datasets.py
0
Python
1
none
16
51
51
true
Changes for orcacode experiment
3,612
LAION-AI/Open-Assistant
29,137
Python
andreaskoepf
Review this pull request change. Language: Python File: model/model_training/custom_datasets/qa_datasets.py PR Title: Changes for orcacode experiment BEFORE CODE: class JokeExplaination(Dataset): name = "joke" url = "https://gist.github.com/theblackcat102/42b697e24a13fdb499e20edfbf618361/raw/1834dca207898c1...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
], ) elif model_name in family_8b: return CacheGenConfig( nlayers=32, kspecs=[ QuantizationSpec(start_layer=0, end_layer=10, bins=32), QuantizationSpec(start_layer=10, end_layer=20, bins=16), ...
Is there any support for the default setting (for models other than these five models)? For exmple, we can pass the model_config in vllm (which contains info about the number of layers) or the number of layers directly as the function param, and configure the `CacheGenConfig` dynamically based on this input.
], ) elif model_name in family_8b: return CacheGenConfig( nlayers=32, kspecs=[ QuantizationSpec(start_layer=0, end_layer=10, bins=32), QuantizationSpec(start_layer=10, end_layer=32, bins=16), ...
@@ -39,40 +43,43 @@ def from_model_name(model_name: str) -> "CacheGenConfig": family_9b = ["THUDM/glm-4-9b-chat"] if model_name in family_7b: return CacheGenConfig( - key_first_layers=10, - key_second_layers=20, - key_third_layers=32, # total ...
lmcache/storage_backend/serde/cachegen_basics.py
26
Python
0.571
performance
309
51
51
false
cachegen config refactor
156
LMCache/LMCache
4,864
Python
YaoJiayi
Oasis-Git
Review this pull request change. Language: Python File: lmcache/storage_backend/serde/cachegen_basics.py PR Title: cachegen config refactor BEFORE CODE: ], ) elif model_name in family_8b: return CacheGenConfig( nlayers=32, kspecs=[ ...
Is there any support for the default setting (for models other than these five models)? For exmple, we can pass the model_config in vllm (which contains info about the number of layers) or the number of layers directly as the function param, and configure the `CacheGenConfig` dynamically based on this input.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"lmcache_instance_id": { "type": str, "default": "lmcache_default_instance", "env_converter": str, }, "controller_url": {"type": Optional[str], "default": None, "env_converter": str}, "lmcache_worker_port": { "type": Optional[int], "default": None, "env_co...
@chunxiaozheng Can you explain these two parameters a bit?
"lmcache_instance_id": { "type": str, "default": "lmcache_default_instance", "env_converter": str, }, "controller_url": {"type": Optional[str], "default": None, "env_converter": str}, "lmcache_worker_port": { "type": Optional[int], "default": None, "env_co...
@@ -142,6 +142,16 @@ def _to_int_list( "default": None, "env_converter": int, }, + "lmcache_worker_heartbeat_delay_time": { + "type": int, + "default": 10, + "env_converter": int, + }, + "lmcache_worker_heartbeat_time": { + "type": Optional[int], + "def...
lmcache/v1/config.py
26
Python
0.214
question
58
51
51
false
[feature] support heartbeat in lmcache worker
652
LMCache/LMCache
4,864
Python
YaoJiayi
chunxiaozheng
Review this pull request change. Language: Python File: lmcache/v1/config.py PR Title: [feature] support heartbeat in lmcache worker BEFORE CODE: "lmcache_instance_id": { "type": str, "default": "lmcache_default_instance", "env_converter": str, }, "controller_url": {"type": Optio...
@chunxiaozheng Can you explain these two parameters a bit?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if TYPE_CHECKING: # First Party from lmcache.v1.cache_controller.worker import LMCacheWorker logger = init_logger(__name__) class LocalCPUBackend(StorageBackendInterface): """ The local cpu backend size is variable depending on how much free space is left in the allocator so we cannot use LRUEvi...
Why can't we leverage the `fmt` argument in the `allocate` function?
if TYPE_CHECKING: # First Party from lmcache.v1.cache_controller.worker import LMCacheWorker logger = init_logger(__name__) class LocalCPUBackend(StorageBackendInterface): """ The local cpu backend size is variable depending on how much free space is left in the allocator so we cannot use LRUEvi...
@@ -60,6 +60,7 @@ def __init__( lookup_server: Optional[LookupServerInterface] = None, lmcache_worker: Optional["LMCacheWorker"] = None, layerwise: bool = False, + mla: bool = False,
lmcache/v1/storage_backend/local_cpu_backend.py
26
Python
0.357
question
68
51
51
false
[Refactor][Bugfix] Add KV Cache format storage in local disk backend
735
LMCache/LMCache
4,864
Python
YaoJiayi
Shaoting-Feng
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/local_cpu_backend.py PR Title: [Refactor][Bugfix] Add KV Cache format storage in local disk backend BEFORE CODE: if TYPE_CHECKING: # First Party from lmcache.v1.cache_controller.worker import LMCacheWorker logger = init_log...
Why can't we leverage the `fmt` argument in the `allocate` function?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Standard from dataclasses import dataclass from typing import Any, List...
Why using any here? Shouldn't it be memory format?
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Future from __future__ import annotations # Standard from dataclasses ...
@@ -32,6 +32,7 @@ class DiskCacheMetadata: size: int # in bytes shape: Optional[torch.Size] = None dtype: Optional[torch.dtype] = None + fmt: Any = None
lmcache/utils.py
26
Python
0.429
question
50
51
51
false
[Refactor][Bugfix] Add KV Cache format storage in local disk backend
735
LMCache/LMCache
4,864
Python
YaoJiayi
Shaoting-Feng
Review this pull request change. Language: Python File: lmcache/utils.py PR Title: [Refactor][Bugfix] Add KV Cache format storage in local disk backend BEFORE CODE: # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See th...
Why using any here? Shouldn't it be memory format?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
f"Connection initialized/re-established at {self.config.remote_url}" ) except Exception as e: with self.lock: self.failure_time = time.time() logger.warning(f"Failed to initialize/re-establish remote connection: {e}") self.connectio...
Why do we remove the error handling here?
return try: assert self.config.remote_url is not None self.connection = CreateConnector( self.config.remote_url, self.loop, self.local_cpu_backend, self.config, self.metadata, ) ...
@@ -126,19 +126,7 @@ def contains(self, key: CacheEngineKey, pin: bool = False) -> bool: logger.warning("Connection is None in contains, returning False") return False - future = asyncio.run_coroutine_threadsafe( - self.connection.exists(key), self.loop - ) - ...
lmcache/v1/storage_backend/remote_backend.py
26
Python
0.286
question
41
51
51
false
[feature] add exists sync interface
828
LMCache/LMCache
4,864
Python
YaoJiayi
chunxiaozheng
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/remote_backend.py PR Title: [feature] add exists sync interface BEFORE CODE: f"Connection initialized/re-established at {self.config.remote_url}" ) except Exception as e: with self.lock...
Why do we remove the error handling here?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.loop, self.local_cpu_backend, self.config, ) logger.info( f"Connection initialized/re-established at {self.config.remote_url}" ) except Exception as e: with self.lock: self.failur...
@chunxiaozheng Would you like to add an boolean type extra_config as a switch?
self.loop, self.local_cpu_backend, self.config, self.metadata, ) logger.info( f"Connection initialized/re-established at {self.config.remote_url}" ) except Exception as e: with self.lo...
@@ -130,12 +130,8 @@ def contains(self, key: CacheEngineKey, pin: bool = False) -> bool: key.fmt, key.model_name, key.world_size, 0, key.chunk_hash ) - future = asyncio.run_coroutine_threadsafe(
lmcache/v1/storage_backend/remote_backend.py
26
Python
0.357
question
78
51
51
false
[feature] add exists sync interface
828
LMCache/LMCache
4,864
Python
maobaolong
chunxiaozheng
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/remote_backend.py PR Title: [feature] add exists sync interface BEFORE CODE: self.loop, self.local_cpu_backend, self.config, ) logger.info( f"Con...
@chunxiaozheng Would you like to add an boolean type extra_config as a switch?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
################### # Scheduler side APIs #################### @_lmcache_nvtx_annotate def get_num_new_matched_tokens( self, request: "Request", num_computed_tokens: int, ) -> int: """ Check for external KV cache hit. Args: request (R...
Directly change `token_ids` instead of deepcopying `request`
################### # Scheduler side APIs #################### @_lmcache_nvtx_annotate def get_num_new_matched_tokens( self, request: "Request", num_computed_tokens: int, ) -> int: """ Check for external KV cache hit. Args: request (R...
@@ -786,6 +805,10 @@ def get_num_new_matched_tokens( the number of tokens that can be loaded from the external KV cache beyond what is already computed. """ + + # Preprocess the request for multimodal hashes. + request = mask_mm_hashes_in_request(request) + if s...
lmcache/integration/vllm/vllm_v1_adapter.py
26
Python
0.429
suggestion
60
51
51
false
[Core] Support multimodal models that use `mm_hashes` in vLLM
882
LMCache/LMCache
4,864
Python
YaoJiayi
Shaoting-Feng
Review this pull request change. Language: Python File: lmcache/integration/vllm/vllm_v1_adapter.py PR Title: [Core] Support multimodal models that use `mm_hashes` in vLLM BEFORE CODE: ################### # Scheduler side APIs #################### @_lmcache_nvtx_annotate def get_num_new_matched...
Directly change `token_ids` instead of deepcopying `request`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
meta.add_request(req_meta) for request in scheduler_output.scheduled_cached_reqs: request_tracker = self._request_trackers[request.req_id] request_tracker.update(request) req_meta = ReqMeta.from_request_tracker( request_tracker, ...
remove redundant calls to `mask_mm_hashes_in_request`
for request in scheduler_output.scheduled_cached_reqs: request_tracker = self._request_trackers[request.req_id] request_tracker.update(request) req_meta = ReqMeta.from_request_tracker( request_tracker, self._block_size, self._l...
@@ -925,6 +955,9 @@ def request_finished( request: "Request", block_ids: list[int], ) -> tuple[bool, Optional[dict[str, Any]]]: + # Preprocess the request for multimodal hashes. + request = mask_mm_hashes_in_request(request)
lmcache/integration/vllm/vllm_v1_adapter.py
26
Python
0.429
suggestion
53
39
34
false
[Core] Support multimodal models that use `mm_hashes` in vLLM
882
LMCache/LMCache
4,864
Python
YaoJiayi
Shaoting-Feng
Review this pull request change. Language: Python File: lmcache/integration/vllm/vllm_v1_adapter.py PR Title: [Core] Support multimodal models that use `mm_hashes` in vLLM BEFORE CODE: meta.add_request(req_meta) for request in scheduler_output.scheduled_cached_reqs: request_trac...
remove redundant calls to `mask_mm_hashes_in_request`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if self._mla_worker_id_as0_mode: key = CacheEngineKey( key.fmt, key.model_name, key.world_size, 0, key.chunk_hash ) t1 = time.perf_counter() future = asyncio.run_coroutine_threadsafe(self.connection.get(key), self.loop) try: memory_obj...
If the connection is `None`, are we planning to re-establish the connection?
return None t2 = time.perf_counter() self.stats_monitor.update_interval_remote_time_to_get_sync((t2 - t1) * 1000) if memory_obj is None: return None decompressed_memory_obj = self.deserializer.deserialize(memory_obj) t3 = time.perf_counter() logge...
@@ -268,6 +268,93 @@ def get_non_blocking( ) -> Optional[Future]: raise NotImplementedError + def batched_get_blocking( + self, + keys: List[CacheEngineKey], + ) -> List[Optional[MemoryObj]]: + if self.connection is None: + logger.warning("Connection is None in batc...
lmcache/v1/storage_backend/remote_backend.py
26
Python
0.357
question
76
51
51
false
[feature] support batched_get_blocking in remote backend
1,027
LMCache/LMCache
4,864
Python
YaoJiayi
chunxiaozheng
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/remote_backend.py PR Title: [feature] support batched_get_blocking in remote backend BEFORE CODE: if self._mla_worker_id_as0_mode: key = CacheEngineKey( key.fmt, key.model_name, key.world_size, 0, ...
If the connection is `None`, are we planning to re-establish the connection?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
class NixlChannel: """Provides the primitives to send the data and process the received data. It will have some internal threads to handle the data receiving. """ def __init__( self, nixl_config: NixlConfigXpYd, config: LMCacheEngineConfig, backend: StorageBackendInter...
initialize tp_rank for both sender and receiver
self._receiver_nixl_wrapper.close() class NixlChannel: """Provides the primitives to send the data and process the received data. It will have some internal threads to handle the data receiving. """ def __init__( self, nixl_config: NixlConfigXpYd, config: LMCacheEngine...
@@ -684,7 +687,13 @@ def __init__( if nixl_config.role == NixlRole.SENDER: self._sender = NixlSender(nixl_config, config, backend) else: - self._receiver = NixlReceiver(nixl_config, config, backend) + tp_rank = get_tensor_model_parallel_rank()
lmcache/v1/storage_backend/connector/nixl_connector_v3.py
26
Python
0.071
suggestion
47
51
51
false
[PD] Support tp for pd
1,039
LMCache/LMCache
4,864
Python
YaoJiayi
Shaoting-Feng
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/connector/nixl_connector_v3.py PR Title: [PD] Support tp for pd BEFORE CODE: class NixlChannel: """Provides the primitives to send the data and process the received data. It will have some internal threads to handle the dat...
initialize tp_rank for both sender and receiver
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[LookupServerInterface] = None if self.enable_p2p: self.lookup_server = RedisLookupServer(config) # avoid circular import # First Party from lmcache.v1.cache_controller import ...
nitpick: it's safer to check both conditions here: config.enable_nixl and config.nixl_role == "receiver"
multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[LookupServerInterface] = None if self.enable_p2p: self.lookup_server = RedisLookupServer(config) # avoid circular import # First Party from lmcache.v1.cache_controller import ...
@@ -119,7 +119,9 @@ def __init__( ) # HACK: remove this in the future - self.remove_after_retrieve = config.enable_nixl + # NOTE (Jiayi): This is currently used to support + # dropping the kv cache in nixl backend at decoder. + self.remove_after_retrieve = config.nixl_rol...
lmcache/v1/cache_engine.py
26
Python
0.357
nitpick
104
51
51
false
[Core] Make PD and offloading compatible
1,112
LMCache/LMCache
4,864
Python
vladnosiv
YaoJiayi
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [Core] Make PD and offloading compatible BEFORE CODE: multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[LookupServerInterface] = None if self.enable_p2p: ...
nitpick: it's safer to check both conditions here: config.enable_nixl and config.nixl_role == "receiver"
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: # First Party from lmcache.v1.storage_backend.nixl_backend import NixlBackend storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend( config, metadata ) assert config.nixl_buffer_device is not None # T...
what are the restrictions here so as not to include all other features? I tested a similar code and did not see any problems when turning on offloading to disk too
) else: # First Party from lmcache.v1.storage_backend.nixl_backend import NixlBackend storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend( config, metadata ) assert config.nixl_buffer_device is not None # T...
@@ -63,29 +63,27 @@ def CreateStorageBackends( storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend( config, metadata, memory_allocator ) - assert config.nixl_buffer_device is not None - return storage_backends - - # First Party - ...
lmcache/v1/storage_backend/__init__.py
26
Python
0.357
question
163
51
51
false
[Core] Make PD and offloading compatible
1,112
LMCache/LMCache
4,864
Python
vladnosiv
YaoJiayi
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/__init__.py PR Title: [Core] Make PD and offloading compatible BEFORE CODE: ) else: # First Party from lmcache.v1.storage_backend.nixl_backend import NixlBackend storage_backen...
what are the restrictions here so as not to include all other features? I tested a similar code and did not see any problems when turning on offloading to disk too
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if dst_device == "cuda": dst_device = f"cuda:{torch.cuda.current_device()}" storage_backends: OrderedDict[str, StorageBackendInterface] = OrderedDict() if config.enable_nixl: if config.enable_xpyd: # First Party from lmcache.v1.storage_backend.nixl_backend_v3 import...
this is a bit unclear: previously, I could have omitted to specify the inclusion of local_cpu and the rest of the engines would have received it anyway as a buffer, now it requires explicit indication.
if dst_device == "cuda": dst_device = f"cuda:{torch.cuda.current_device()}" storage_backends: OrderedDict[str, StorageBackendInterface] = OrderedDict() if config.enable_nixl: if config.enable_xpyd: # First Party from lmcache.v1.storage_backend.nixl_backend_v3 import...
@@ -63,29 +63,27 @@ def CreateStorageBackends( storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend( config, metadata, memory_allocator ) - assert config.nixl_buffer_device is not None - return storage_backends - - # First Party - ...
lmcache/v1/storage_backend/__init__.py
26
Python
0.5
suggestion
201
51
51
false
[Core] Make PD and offloading compatible
1,112
LMCache/LMCache
4,864
Python
vladnosiv
YaoJiayi
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/__init__.py PR Title: [Core] Make PD and offloading compatible BEFORE CODE: if dst_device == "cuda": dst_device = f"cuda:{torch.cuda.current_device()}" storage_backends: OrderedDict[str, StorageBackendInterface] = Or...
this is a bit unclear: previously, I could have omitted to specify the inclusion of local_cpu and the rest of the engines would have received it anyway as a buffer, now it requires explicit indication.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
storage_backends: OrderedDict[str, StorageBackendInterface] = OrderedDict() if config.enable_nixl: if config.enable_xpyd: # First Party from lmcache.v1.storage_backend.nixl_backend_v3 import NixlBackend storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend...
by the way, it seems there is a place for funny behavior: now it is possible to create a decode node with a local CPU cache, since there is no more validation. however, due to deletion when retrieving, such a cache will work 1 time. maybe I don't see any other limiting factors right away
storage_backends: OrderedDict[str, StorageBackendInterface] = OrderedDict() if config.enable_nixl: if config.enable_xpyd: # First Party from lmcache.v1.storage_backend.nixl_backend_v3 import NixlBackend storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend...
@@ -63,29 +63,29 @@ def CreateStorageBackends( storage_backends["NixlBackend"] = NixlBackend.CreateNixlBackend( config, metadata, memory_allocator ) - assert config.nixl_buffer_device is not None - return storage_backends - - # First Party - ...
lmcache/v1/storage_backend/__init__.py
26
Python
0.429
performance
288
51
51
false
[Core] Make PD and offloading compatible
1,112
LMCache/LMCache
4,864
Python
vladnosiv
YaoJiayi
Review this pull request change. Language: Python File: lmcache/v1/storage_backend/__init__.py PR Title: [Core] Make PD and offloading compatible BEFORE CODE: storage_backends: OrderedDict[str, StorageBackendInterface] = OrderedDict() if config.enable_nixl: if config.enable_xpyd: # Firs...
by the way, it seems there is a place for funny behavior: now it is possible to create a decode node with a local CPU cache, since there is no more validation. however, due to deletion when retrieving, such a cache will work 1 time. maybe I don't see any other limiting factors right away
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
location = self.storage_manager.contains(key) if location is None: # TODO(Jiayi): Need to refactor P2P as a storage backend to # clean up the following code. if self.enable_p2p: fu...
The git diff is not so smart, the true diff for this code block is that I just only add a `if not self.save_only_first_rank or self.metadata.is_first_rank():` outside, so i have to add a tab for each line.
reordered_chunks: List[Tuple[CacheEngineKey, MemoryObj, int, int]] = [] if not self._is_passive(): reordered_chunks = self._process_tokens_internal( tokens, mask, ret_mask, **kwargs, ) if self.save_only_first...
@@ -429,69 +441,143 @@ def retrieve( reordered_memory_objs = [] reordered_starts = [] reordered_ends = [] - for start, end, key in self.token_database.process_tokens( - tokens=tokens, mask=mask - ): - assert isinstance(key, CacheEngineKey) - - if...
lmcache/v1/cache_engine.py
26
Python
0.571
suggestion
205
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
maobaolong
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: location = self.storage_manager.contains(key) if location is None: # TODO(Jiayi): Need to...
The git diff is not so smart, the true diff for this code block is that I just only add a `if not self.save_only_first_rank or self.metadata.is_first_rank():` outside, so i have to add a tab for each line.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# NOTE: Unix systems use fork by default multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[LookupServerInterface] = None if self.enable_p2p: self.lookup_server = RedisLookupServer(config) # avoid circular import # First Part...
`config.nixl_role == "receiver"` is for making cpu offload and disaggregated prefill compatible.
self.enable_p2p = config.enable_p2p self.enable_controller = config.enable_controller # NOTE: Unix systems use fork by default multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[LookupServerInterface] = None if self.enable_p2p: ...
@@ -119,11 +130,7 @@ def __init__( ) # HACK: remove this in the future - # NOTE (Jiayi): This is currently used to support - # dropping the kv cache in nixl backend at decoder. - self.remove_after_retrieve = ( - config.enable_nixl and config.nixl_role == "receiver" - ...
lmcache/v1/cache_engine.py
26
Python
0.357
suggestion
96
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
Shaoting-Feng
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: # NOTE: Unix systems use fork by default multiprocessing.set_start_method("spawn", force=True) self.lookup_server: Optional[Loo...
`config.nixl_role == "receiver"` is for making cpu offload and disaggregated prefill compatible.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
dtype=torch.uint8, device=corrected_device, ) nixl_cpu_mem_allocator = NixlCPUMemoryAllocator() nixl_cpu_mem_allocator.init_nixl_memory_allocator( buffer, torch.Size(metadata.kv_shape), ...
I suggest we set this as default behavior for MLA models
if self.lmcache_worker is not None: self.lmcache_worker.close() self.storage_manager.close() self.memory_allocator.close() logger.info("LMCacheEngine closed.") def _process_tokens_internal( self, tokens, mask, ret_mask, **kwarg...
@@ -807,6 +911,19 @@ def _Create_memory_allocator( return CuFileMemoryAllocator(config.cufile_buffer_size * 1024**2) max_local_cpu_size = config.max_local_cpu_size + if config.extra_config: + save_only_first_rank = config.extra_config.get( + "save_only_first_rank...
lmcache/v1/cache_engine.py
26
Python
0.214
suggestion
56
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
Shaoting-Feng
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: dtype=torch.uint8, device=corrected_device, ) nixl_cpu_mem_allocator = NixlCPUMem...
I suggest we set this as default behavior for MLA models
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# Copyright 2024-2025 LMCache Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Do other rank workers still need to allocate a cpu buffer?
if config.weka_path is not None or config.gds_path is not None: assert config.cufile_buffer_size is not None return CuFileMemoryAllocator(config.cufile_buffer_size * 1024**2) max_local_cpu_size = config.max_local_cpu_size save_only_first_rank_default = True if metadata....
@@ -807,6 +911,19 @@ def _Create_memory_allocator( return CuFileMemoryAllocator(config.cufile_buffer_size * 1024**2) max_local_cpu_size = config.max_local_cpu_size + if config.extra_config: + save_only_first_rank = config.extra_config.get( + "save_only_first_rank...
lmcache/v1/cache_engine.py
26
Python
0.214
question
58
1,007
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
Shaoting-Feng
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: # Copyright 2024-2025 LMCache Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
Do other rank workers still need to allocate a cpu buffer?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if location not in key_mapping: key_mapping[location] = [key] start_mapping[location] = [start] end_mapping[location] = [end] continue assert location is not None key_map...
I think `torch.distributed.broadcast` can be called the same on both the sender and the receiver, so do we still need to check if `self.metadata.is_first_rank()`?
if self.remove_after_retrieve and not self._is_passive(): self.storage_manager.remove(key) memory_obj.ref_count_down() retrieved_tokens = torch.sum(ret_mask) self.stats_monitor.on_retrieve_finished(monitor_req_id, retrieved_tokens) logger.info( ...
@@ -429,69 +439,143 @@ def retrieve( reordered_memory_objs = [] reordered_starts = [] reordered_ends = [] - for start, end, key in self.token_database.process_tokens( - tokens=tokens, mask=mask - ): - assert isinstance(key, CacheEngineKey) - - if...
lmcache/v1/cache_engine.py
26
Python
0.643
question
162
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
Shaoting-Feng
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: if location not in key_mapping: key_mapping[location] = [key] start_mapping[location]...
I think `torch.distributed.broadcast` can be called the same on both the sender and the receiver, so do we still need to check if `self.metadata.is_first_rank()`?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
or len(reordered_keys) != len(reordered_ends) or len(reordered_keys) != len(reordered_memory_objs) ): logger.warning( f"reordered_keys,reordered_starts,reordered_ends," f"reordered_memory_objs hav...
I wonder if it’s possible to broadcast after calling LMCache’s kernel to transfer `memory_obj` from CPU to GPU, instead of using `tensor.to`, since it’s faster.
:param **kwargs: The additional arguments for the storage backend which will be passed into the gpu_connector. return: A generator that yields Optional[torch.Tensor]. The tensor will be the boolean mask indicating which tokens are retrieved and will only be returned...
@@ -429,69 +439,143 @@ def retrieve( reordered_memory_objs = [] reordered_starts = [] reordered_ends = [] - for start, end, key in self.token_database.process_tokens( - tokens=tokens, mask=mask - ): - assert isinstance(key, CacheEngineKey) - - if...
lmcache/v1/cache_engine.py
26
Python
0.714
performance
160
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
Shaoting-Feng
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: or len(reordered_keys) != len(reordered_ends) or len(reordered_keys) != len(reordered_memory_objs) ...
I wonder if it’s possible to broadcast after calling LMCache’s kernel to transfer `memory_obj` from CPU to GPU, instead of using `tensor.to`, since it’s faster.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
tokens: Optional[torch.Tensor] = None, hashes: Optional[List[int]] = None, offsets: Optional[List[int]] = None, mask: Optional[torch.Tensor] = None, **kwargs, ) -> None: """Store the tokens/hashes and mask into the cache engine. :param Optional[torch.Tensor] ...
Can we add a helper function in CacheEngine with a name like `is_passive`: ``` def is_passive(self): """A 'passive' CacheEngine means that the node itself will not store/retrieve the data directly, but from the "active" worker (i.e., rank 0 in MLA) """ return self.save_only_fi...
self.post_inited = False gc.collect() if not config.py_enable_gc: gc.disable() def post_init(self, **kwargs) -> None: if not self.post_inited: logger.info("Post-initializing LMCacheEngine") self.gpu_connector.initialize_kvcaches_ptr(**kwargs) ...
@@ -178,6 +192,9 @@ def store( :raises: ValueError if the number of Falses in the mask is not a multiple of the chunk size. """ + if self.save_only_first_rank and not self.metadata.is_first_rank():
lmcache/v1/cache_engine.py
26
Python
0.786
performance
471
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: tokens: Optional[torch.Tensor] = None, hashes: Optional[List[int]] = None, offsets: Optional[List[int]] = None, mask: Opt...
Can we add a helper function in CacheEngine with a name like `is_passive`: ``` def is_passive(self): """A 'passive' CacheEngine means that the node itself will not store/retrieve the data directly, but from the "active" worker (i.e., rank 0 in MLA) """ return self.save_only_fi...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
and the Falses will ALWAYS be at the PREFIX of the tensor. :param **kwargs: The additional arguments for the storage backend which will be passed into the gpu_connector. Should include KV cache specific information (e.g., paged KV buffer and the page tables). ...
Similar to the above suggestion, we can do: ```suggestion if not self.is_passive(): ```
next(mem_obj_generator) self.storage_manager.batched_put(keys[layer_id], memory_objs[layer_id]) else: # If no cache are found, we still need to yield to avoid # `StopIteration` for layer_id in range(self.num_layers): yield ...
@@ -409,77 +426,29 @@ def retrieve( ret_mask = torch.zeros_like(tokens, dtype=torch.bool, device="cpu") - key_mapping: Dict[str, List[CacheEngineKey]] = {} - start_mapping: Dict[str, List[int]] = {} - end_mapping: Dict[str, List[int]] = {} - reordered_keys = [] reorde...
lmcache/v1/cache_engine.py
26
Python
0.714
suggestion
100
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: and the Falses will ALWAYS be at the PREFIX of the tensor. :param **kwargs: The additional arguments for the storage backend which ...
Similar to the above suggestion, we can do: ```suggestion if not self.is_passive(): ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
reordered_ends, ret_mask, ) if self.save_only_first_rank: self._broadcast_or_receive_memory_objs( reordered_keys, reordered_starts, reordered_ends, reordered_memory_objs, ret_...
```suggestion if self.remove_after_retrieve and not self.is_passive() ```
Should include KV cache specific information (e.g., paged KV buffer and the page tables). :return: the boolean mask indicating which tokens are retrieved. The length of the mask should be the same as the tokens. On CPU. :raises: ValueError if the number of Falses in...
@@ -491,7 +460,9 @@ def retrieve( # TODO(Jiayi): Remove the following for loop with batched operations for key, memory_obj in zip(reordered_keys, reordered_memory_objs, strict=False): - if self.remove_after_retrieve: + if self.remove_after_retrieve and ( + not se...
lmcache/v1/cache_engine.py
26
Python
0.643
suggestion
87
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: reordered_ends, ret_mask, ) if self.save_only_first_rank: self._broadcast_or_receive_mem...
```suggestion if self.remove_after_retrieve and not self.is_passive() ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# synchronize the last layer next(mem_obj_consumer) retrieved_tokens = torch.sum(ret_mask) self.stats_monitor.on_retrieve_finished(monitor_req_id, retrieved_tokens) logger.debug( f"Retrieved {retrieved_tokens} " f"out of {num_required_tokens} " ...
```suggestion if self.is_passive(): return ```
mem_obj_consumer = self.gpu_connector.batched_to_gpu(starts, ends, **kwargs) next(mem_obj_consumer) to_count_down = [] for layer_id in range(self.num_layers): tasks = next(get_generator) assert None not in tasks yield Non...
@@ -623,6 +594,9 @@ def prefetch( """Launch the prefetching process in the storage manager to load the KV to the local CPU memory """ + if self.save_only_first_rank: + if not self.metadata.is_first_rank(): + return
lmcache/v1/cache_engine.py
26
Python
0.571
suggestion
70
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: # synchronize the last layer next(mem_obj_consumer) retrieved_tokens = torch.sum(ret_mask) self.stats_monitor.on_retrie...
```suggestion if self.is_passive(): return ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if self.enable_p2p: self.distributed_server.close() if self.lmcache_worker is not None: self.lmcache_worker.close() self.storage_manager.close() self.memory_allocator.close() logger.info("LMCacheEngine closed.") def _process_tokens_internal( ...
Can we add a docstring for this function to briefly describe what this function does, and what side-effect this function will have on the input parameters (`reordered_keys`, `reordered_memory_objs`, ...)
@_lmcache_nvtx_annotate def clear( self, tokens: Optional[Union[torch.Tensor, List[int]]] = None, locations: Optional[List[str]] = None, tags: OrderedDict = None, # TODO: need to clean by tags ) -> int: if self.save_only_first_rank: if self.metadata.is_fi...
@@ -857,6 +846,163 @@ def close(self) -> None: logger.info("LMCacheEngine closed.") + def _process_tokens_internal( + self, + tokens, + mask, + reordered_keys, + reordered_memory_objs, + reordered_starts, + reordered_ends, + ret_mask, + ):
lmcache/v1/cache_engine.py
26
Python
0.714
suggestion
203
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: if self.enable_p2p: self.distributed_server.close() if self.lmcache_worker is not None: self.lmcache_worker.clos...
Can we add a docstring for this function to briefly describe what this function does, and what side-effect this function will have on the input parameters (`reordered_keys`, `reordered_memory_objs`, ...)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# receive metadata metadata_dict = self.broadcast_object_fn( None, self.metadata.first_rank ) if metadata_dict is None: logger.warning( f"rank={self.metadata.worker...
Also, it would be great if we could have a docstring for this function.
logger.warn( "The cache block is in the storage, but it can't be retrieved" ) if ( last_failed_block_start is None or last_failed_block_start < start ): ...
@@ -857,6 +846,163 @@ def close(self) -> None: logger.info("LMCacheEngine closed.") + def _process_tokens_internal( + self, + tokens, + mask, + reordered_keys, + reordered_memory_objs, + reordered_starts, + reordered_ends, + ret_mask, + ): + ...
lmcache/v1/cache_engine.py
26
Python
0.286
suggestion
71
51
51
false
[VLLM|CacheEngine]support only save on rank 0 for DS MLA
1,128
LMCache/LMCache
4,864
Python
ApostaC
maobaolong
Review this pull request change. Language: Python File: lmcache/v1/cache_engine.py PR Title: [VLLM|CacheEngine]support only save on rank 0 for DS MLA BEFORE CODE: # receive metadata metadata_dict = self.broadcast_object_fn( None, self.metadata.first_ra...
Also, it would be great if we could have a docstring for this function.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.