Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4d03d65
bench mark scripts
ved1beta Apr 30, 2025
18733f5
json removed
ved1beta Apr 30, 2025
b31236e
required changes
ved1beta May 5, 2025
e65b2be
read me commad fix '
ved1beta May 5, 2025
627a038
required changes
ved1beta May 5, 2025
2de1796
configs
ved1beta May 5, 2025
03dc404
readme
ved1beta May 5, 2025
ec00ec6
import handler
ved1beta May 6, 2025
9b476f2
required chnages
ved1beta May 24, 2025
92e1d64
base model name/path
ved1beta Jun 6, 2025
4b67c62
defualt json
ved1beta Jun 6, 2025
338d9ad
ruff
ved1beta Jun 6, 2025
75fdd77
format
ved1beta Jun 6, 2025
04069d8
updated read me
ved1beta Jun 6, 2025
bc6e729
Merge branch 'benchmark2scripts' of github.com:ved1beta/peft into ben…
ved1beta Jun 6, 2025
8c0f9cb
requested read me changes
ved1beta Jun 12, 2025
c2af755
[200~python3 run.py experiments/lora/lora_r8 --verbose
ved1beta Jun 12, 2025
e165516
individual results storage + requested chnages
ved1beta Jun 12, 2025
6054617
train parameters removed
ved1beta Jun 12, 2025
a441851
removed sample_config
ved1beta Jun 12, 2025
ffa2033
num inference and config removed
ved1beta Jun 12, 2025
58eacb9
model name change - removed selectPrompts
ved1beta Jun 12, 2025
2d34bc5
removed imports n related
ved1beta Jun 26, 2025
68f9496
timestams from file name removed
ved1beta Jun 26, 2025
2710e62
undo commit
ved1beta Jun 26, 2025
86d5215
overall section + required changes
ved1beta Jul 1, 2025
c6e2fbe
undo change info + peft_config.dict not none
ved1beta Jul 5, 2025
b792d3a
feat naming func according to peft method + minNewTokens=maxNewTokens
ved1beta Jul 8, 2025
ff7114d
to dict conversion removed
ved1beta Jul 26, 2025
12edab9
requested changes include:remove traceback,optional added,dtype error…
ved1beta Jul 26, 2025
b3858fc
run_base integreation
ved1beta Jul 26, 2025
7002a81
required read me changes
ved1beta Jul 26, 2025
2611c67
Overall Metrics format
ved1beta Jul 26, 2025
d58658d
changed branch logic to match MetaMathQA
ved1beta Jul 26, 2025
ecbcdba
removed
ved1beta Jul 26, 2025
4780ae5
ruff
ved1beta Jul 26, 2025
7b54782
max token vary 20-50-100
ved1beta Jul 26, 2025
ecc1382
requested chanegs
ved1beta Jul 29, 2025
b10f873
text_generation_benchmark
ved1beta Jul 29, 2025
7581b1d
Update method_comparison/text_generation_benchmark/run.py
ved1beta Jul 31, 2025
f3f992d
category_generation_params added to run_base + additional
ved1beta Jul 31, 2025
02c0872
style comments
ved1beta Aug 1, 2025
a3be879
.git keep added
ved1beta Aug 1, 2025
c309e02
ruff
ved1beta Aug 1, 2025
2f9a537
added cancelled_results/ temporary_results/
ved1beta Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
.git keep added
  • Loading branch information
ved1beta committed Aug 1, 2025
commit a3be879e4310854f94910435677f53a59b6546d1
Empty file.
2 changes: 1 addition & 1 deletion method_comparison/text_generation_benchmark/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def run_benchmark(
result.save()

start_time = time.perf_counter()
e_main_benchmark: Optional[Exception] = None # Initialize e for the main try-except
e_main_benchmark: Optional[Exception] = None

try:
print_fn("Initializing CUDA...")
Expand Down
17 changes: 0 additions & 17 deletions method_comparison/text_generation_benchmark/run_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,27 @@ def run_base_model_benchmark(benchmark_config: BenchmarkConfig, print_fn=print)

print_fn(f"Running base model benchmark for: {benchmark_config.model_id}")

# Initialize CUDA
print_fn("Initializing CUDA...")
init_cuda()

# Set random seed
set_seed(benchmark_config.seed)

# Load base model and tokenizer
print_fn(f"Loading base model: {benchmark_config.model_id}")
tokenizer = AutoTokenizer.from_pretrained(benchmark_config.model_id)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token

# Configure model loading parameters
model_kwargs = {
"device_map": "auto" if torch.cuda.is_available() else None,
}

# Add dtype configuration
if benchmark_config.dtype == "float32":
model_kwargs["torch_dtype"] = torch.float32
elif benchmark_config.dtype == "float16":
model_kwargs["torch_dtype"] = torch.float16
elif benchmark_config.dtype == "bfloat16":
model_kwargs["torch_dtype"] = torch.bfloat16

# Add quantization if needed
if benchmark_config.use_8bit:
model_kwargs["quantization_config"] = BitsAndBytesConfig(
load_in_8bit=True, llm_int8_enable_fp32_cpu_offload=True
Expand All @@ -88,14 +82,11 @@ def run_base_model_benchmark(benchmark_config: BenchmarkConfig, print_fn=print)
bnb_4bit_quant_type="nf4",
)

# Load the base model
model = AutoModelForCausalLM.from_pretrained(benchmark_config.model_id, **model_kwargs)

# Track memory after base model load
ram, gpu_allocated, gpu_reserved = get_memory_usage()
print_fn(f"Memory after model load - RAM: {ram:.2f}MB, GPU: {gpu_allocated:.2f}MB")

# Prepare benchmark prompts
print_fn("Preparing benchmark prompts...")
prompts = prepare_benchmark_prompts(
config=benchmark_config.to_dict(),
Expand All @@ -116,7 +107,6 @@ def run_base_model_benchmark(benchmark_config: BenchmarkConfig, print_fn=print)
category_generation_params=benchmark_config.category_generation_params,
)

# Create result structure
result = {
"model_id": benchmark_config.model_id,
"benchmark_config": benchmark_config.to_dict(),
Expand All @@ -134,11 +124,9 @@ def run_base_model_benchmark(benchmark_config: BenchmarkConfig, print_fn=print)

def save_base_results(result: dict, model_id: str) -> str:
"""Save base model results with a filename based on model and config."""
# Create results directory for base models
base_results_dir = os.path.join(os.path.dirname(__file__), "base_results")
os.makedirs(base_results_dir, exist_ok=True)

# Create filename based on model and config
model_name = model_id.replace("/", "_").replace("-", "_")
filename = f"base_{model_name}.json"
filepath = os.path.join(base_results_dir, filename)
Expand All @@ -156,14 +144,12 @@ def main():
parser.add_argument("--force", "-f", action="store_true", help="Force re-run even if results exist")
args = parser.parse_args()

# Configure print function based on verbosity
print_fn = print if args.verbose else lambda *args, **kwargs: None

default_config_path = os.path.join(os.path.dirname(__file__), "default_benchmark_params.json")
benchmark_config = BenchmarkConfig.from_json(default_config_path)


# Check if results already exist
model_name = benchmark_config.model_id.replace("/", "_").replace("-", "_")
base_results_dir = os.path.join(os.path.dirname(__file__), "base_results")
filename = f"base_{model_name}.json"
Expand All @@ -176,14 +162,11 @@ def main():

print_fn(f"Running base model benchmark for: {benchmark_config.model_id}")

# Run the base model benchmark
result = run_base_model_benchmark(benchmark_config, print_fn=print_fn)

# Save results
saved_path = save_base_results(result, benchmark_config.model_id)
print(f"Base model results saved to: {saved_path}")

# Print summary
print("\nBase Model Benchmark Summary:")
print(f"Model: {result['model_id']}")
print(
Expand Down