StentorLabs commited on
Commit
bcc05ba
·
verified ·
1 Parent(s): 0ca9d04

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +130 -34
README.md CHANGED
@@ -707,45 +707,141 @@ The table below compares Portimbria-150M against models of similar scale using p
707
 
708
  ### Evaluation Setup (for Portimbria-150M)
709
 
710
- The following scripts were used to produce benchmark results, run on Kaggle with 2 GPUs:
711
 
712
  ```python
713
- import os
714
-
715
- # Install dependencies
716
- !pip install -q -U accelerate transformers huggingface_hub
717
- !pip install -q -U git+https://github.com/EleutherAI/lm-evaluation-harness.git
718
-
719
- # Environment setup
720
- os.environ["HF_TOKEN"] = "YOUR_HF_TOKEN_HERE"
721
- os.environ["WANDB_DISABLED"] = "true"
722
- os.environ["NCCL_P2P_DISABLE"] = "1"
723
- os.environ["NCCL_IB_DISABLE"] = "1"
724
- !huggingface-cli login --token {os.environ["HF_TOKEN"]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
  ```
726
 
727
- **Zero-shot tasks:**
728
 
729
- ```bash
730
- accelerate launch --multi_gpu --num_processes=2 -m lm_eval \
731
- --model hf \
732
- --model_args pretrained=StentorLabs/Portimbria-150M,dtype=float16,trust_remote_code=True \
733
- --tasks hellaswag,arc_easy,arc_challenge,piqa,mmlu,commonsense_qa,triviaqa,winogrande,openbookqa \
734
- --batch_size auto \
735
- --output_path ./portimbria_zeroshot_results
736
- ```
737
-
738
- **GSM8K (5-shot):**
739
-
740
- ```bash
741
- accelerate launch --multi_gpu --num_processes=2 -m lm_eval \
742
- --model hf \
743
- --model_args pretrained=StentorLabs/Portimbria-150M,dtype=float16,trust_remote_code=True \
744
- --tasks gsm8k \
745
- --num_fewshot 5 \
746
- --batch_size auto \
747
- --output_path ./portimbria_gsm8k_results
748
- ```
749
 
750
  ---
751
 
 
707
 
708
  ### Evaluation Setup (for Portimbria-150M)
709
 
710
+ Benchmarks were run on Kaggle with 2× Tesla T4 GPUs using the script below. No API token is required — the model is public. Each benchmark block runs independently so a single failure never stops the rest.
711
 
712
  ```python
713
+ import os, time, subprocess, sys, json
714
+ from pathlib import Path
715
+
716
+ os.environ["WANDB_DISABLED"] = "true"
717
+ os.environ["NCCL_P2P_DISABLE"] = "1"
718
+ os.environ["NCCL_IB_DISABLE"] = "1"
719
+ os.environ["TOKENIZERS_PARALLELISM"] = "false"
720
+ os.environ["CUDA_LAUNCH_BLOCKING"] = "0"
721
+
722
+ subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U", "accelerate", "transformers"], check=True)
723
+ subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U",
724
+ "git+https://github.com/EleutherAI/lm-evaluation-harness.git"], check=True)
725
+
726
+ MODEL = "StentorLabs/Portimbria-150M"
727
+ DTYPE = "float16"
728
+ BATCH = "auto:64"
729
+ SEED = 42
730
+ GEN_GREEDY = "temperature=0,do_sample=False,max_new_tokens=1024"
731
+ OUT = "./results"
732
+ MODEL_ARGS = f"pretrained={MODEL},dtype={DTYPE},trust_remote_code=True"
733
+ NUM_PROCS = 2
734
+
735
+ LAUNCH_BASE = [
736
+ "accelerate", "launch",
737
+ "--multi_gpu", f"--num_processes={NUM_PROCS}",
738
+ "-m", "lm_eval",
739
+ "--model", "hf",
740
+ "--model_args", MODEL_ARGS,
741
+ "--batch_size", BATCH,
742
+ "--seed", str(SEED),
743
+ "--log_samples",
744
+ "--show_config",
745
+ "--cache_requests", "true",
746
+ ]
747
+
748
+ results_summary = {}
749
+
750
+ def banner(n, total, title, note=""):
751
+ print(f"\n{'='*60}")
752
+ print(f" BLOCK {n}/{total} — {title}")
753
+ if note:
754
+ print(f" {note}")
755
+ print(f"{'='*60}\n")
756
+
757
+ def run_block(block_name, n, total, title, note, tasks, num_fewshot,
758
+ output_subdir, extra_args=None):
759
+ banner(n, total, title, note)
760
+ t0 = time.time()
761
+ cmd = LAUNCH_BASE + [
762
+ "--tasks", tasks,
763
+ "--num_fewshot", str(num_fewshot),
764
+ "--output_path", f"{OUT}/{output_subdir}",
765
+ ]
766
+ if extra_args:
767
+ cmd += extra_args
768
+ try:
769
+ subprocess.run(cmd, check=True, text=True)
770
+ elapsed = (time.time() - t0) / 60
771
+ print(f"\n ✅ {block_name} done in {elapsed:.1f} min")
772
+ results_summary[block_name] = {"status": "ok", "elapsed_min": round(elapsed, 1)}
773
+ return True
774
+ except subprocess.CalledProcessError as e:
775
+ elapsed = (time.time() - t0) / 60
776
+ print(f"\n ❌ {block_name} FAILED (exit code {e.returncode}) after {elapsed:.1f} min")
777
+ print(f" Re-run command:\n {' '.join(cmd)}\n")
778
+ results_summary[block_name] = {
779
+ "status": "failed", "exit_code": e.returncode,
780
+ "elapsed_min": round(elapsed, 1), "rerun_cmd": " ".join(cmd),
781
+ }
782
+ return False
783
+ except Exception as exc:
784
+ elapsed = (time.time() - t0) / 60
785
+ results_summary[block_name] = {"status": "failed", "error": str(exc), "elapsed_min": round(elapsed, 1)}
786
+ return False
787
+
788
+ Path(OUT).mkdir(parents=True, exist_ok=True)
789
+
790
+ run_block("block1_0shot", 1, 7, "0-shot", "PIQA · OpenBookQA · TruthfulQA",
791
+ tasks="piqa,openbookqa,truthfulqa_mc2", num_fewshot=0, output_subdir="block1_0shot")
792
+ run_block("block2_5shot", 2, 7, "5-shot", "Winogrande · CommonsenseQA",
793
+ tasks="winogrande,commonsense_qa", num_fewshot=5, output_subdir="block2_5shot")
794
+ run_block("block3_10shot", 3, 7, "10-shot", "HellaSwag",
795
+ tasks="hellaswag", num_fewshot=10, output_subdir="block3_10shot")
796
+ run_block("block4_25shot", 4, 7, "25-shot", "ARC-Easy · ARC-Challenge",
797
+ tasks="arc_easy,arc_challenge", num_fewshot=25, output_subdir="block4_25shot")
798
+ run_block("block5_mmlu", 5, 7, "5-shot", "MMLU — 57 subtask aggregate",
799
+ tasks="mmlu", num_fewshot=5, output_subdir="block5_mmlu")
800
+ run_block("block6_triviaqa", 6, 7, "5-shot greedy", "TriviaQA",
801
+ tasks="triviaqa", num_fewshot=5, output_subdir="block6_triviaqa",
802
+ extra_args=["--gen_kwargs", GEN_GREEDY])
803
+ run_block("block7_gsm8k", 7, 7, "5-shot CoT greedy", "GSM8K",
804
+ tasks="gsm8k_cot", num_fewshot=5, output_subdir="block7_gsm8k",
805
+ extra_args=["--gen_kwargs", GEN_GREEDY])
806
+
807
+ passed = [k for k, v in results_summary.items() if v["status"] == "ok"]
808
+ failed = [k for k, v in results_summary.items() if v["status"] == "failed"]
809
+
810
+ print(f"\n{'='*60}\n ALL BLOCKS ATTEMPTED — {len(passed)}/7 succeeded\n{'='*60}")
811
+ for block, info in results_summary.items():
812
+ icon = "✅" if info["status"] == "ok" else "❌"
813
+ print(f" {icon} {block:<22} {info.get('elapsed_min', '—')} min")
814
+
815
+ if failed:
816
+ print(f"\n Failed blocks:")
817
+ for f in failed:
818
+ info = results_summary[f]
819
+ print(f" • {f}")
820
+ if "rerun_cmd" in info:
821
+ print(f" {info['rerun_cmd']}")
822
+
823
+ with open(f"{OUT}/run_summary.json", "w") as fh:
824
+ json.dump(results_summary, fh, indent=2)
825
+
826
+ if failed:
827
+ sys.exit(1)
828
  ```
829
 
830
+ **Metrics to report per task:**
831
 
832
+ | Task | Metric |
833
+ |---|---|
834
+ | PIQA | `acc_norm` |
835
+ | OpenBookQA | `acc_norm` |
836
+ | TruthfulQA | `mc2` |
837
+ | Winogrande | `acc` |
838
+ | CommonsenseQA | `acc` |
839
+ | HellaSwag | `acc_norm` |
840
+ | ARC-Easy | `acc_norm` |
841
+ | ARC-Challenge | `acc_norm` |
842
+ | MMLU | `acc` |
843
+ | TriviaQA | `exact_match` |
844
+ | GSM8K | `exact_match` |
 
 
 
 
 
 
 
845
 
846
  ---
847