codellama-fine-tuning / QUICK_TEST_COMMAND.md
Prithvik-1's picture
Upload QUICK_TEST_COMMAND.md with huggingface_hub
597b65c verified

πŸš€ Quick Test Command for Single Training Sample

βœ… Updated Command (With Fixes Applied)

cd /workspace/ftt/codellama-migration && source /venv/main/bin/activate && python3 test_single_training_sample.py

This will:

  • Load the first training sample
  • Test with temperatures: 0.1, 0.2, 0.3
  • Show expected vs generated output
  • Help you find the best temperature

πŸ”§ Manual Test Command (Custom Temperature)

cd /workspace/ftt/codellama-migration
source /venv/main/bin/activate

# Extract sample #1 instruction
INSTRUCTION=$(sed -n '1p' datasets/processed/split/train.jsonl | python3 -c "import sys, json; print(json.load(sys.stdin)['instruction'])")

# Test with optimized parameters
python3 scripts/inference/inference_codellama.py \
    --mode local \
    --model-path training-outputs/codellama-fifo-v1 \
    --prompt "$INSTRUCTION" \
    --max-new-tokens 1000 \
    --temperature 0.1

🎯 Key Hyperparameter Changes Made

Parameter Old New Impact
Repetition Penalty 1.1 1.2 βœ… Prevents repetitive text
Prompt Format No EOS + EOS token βœ… Matches training format
Temperature 0.3 0.1 (recommended) βœ… More deterministic
Response Extraction Full decode New tokens only βœ… Cleaner output

πŸ“Š Expected Results

With these changes, you should see:

  • βœ… Verilog code generation (not text notes)
  • βœ… Complete modules (module ... endmodule)
  • βœ… No repetitive "Note:" statements
  • βœ… Better match with training data

πŸ” If Still Getting Text Instead of Code

Try these in order:

  1. Lower temperature to 0.05:

    --temperature 0.05
    
  2. Increase repetition penalty to 1.3: (Edit inference script or add as parameter)

  3. Check prompt format:

    • Ensure instruction matches training data exactly
    • No extra formatting or wrappers
  4. Verify training data format:

    • Should be: instruction + EOS + response + EOS
    • Response should start with ```verilog

Test and let me know the results!