llama_eval.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Set to "true" to enable debug mode with detailed prints
  2. DEBUG_MODE="false"
  3. eval_path='../data/dev_20240627/dev.json'
  4. db_root_path='../data/dev_20240627/dev_databases/'
  5. ground_truth_path='../data/'
  6. # Llama models on Llama API
  7. # YOUR_API_KEY='YOUR_LLAMA_API_KEY'
  8. # model='Llama-3.3-8B-Instruct'
  9. #model='Llama-3.3-70B-Instruct'
  10. #model='Llama-4-Maverick-17B-128E-Instruct-FP8'
  11. #model='Llama-4-Scout-17B-16E-Instruct-FP8'
  12. # Llama model on Hugging Face Hub https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct
  13. # YOUR_API_KEY='huggingface'
  14. # model='meta-llama/Llama-3.1-8B-Instruct'
  15. # Fine-tuned Llama models locally
  16. YOUR_API_KEY='finetuned'
  17. model='../fine-tuning/llama31-8b-text2sql-fft-nonquantized-cot-epochs-3'
  18. data_output_path="./output/$model/"
  19. echo "Text2SQL using $model"
  20. python3 -u llama_text2sql.py --db_root_path ${db_root_path} --api_key ${YOUR_API_KEY} \
  21. --model ${model} --eval_path ${eval_path} --data_output_path ${data_output_path}
  22. # Check if llama_text2sql.py exited successfully
  23. if [ $? -eq 0 ]; then
  24. echo "llama_text2sql.py completed successfully. Proceeding with evaluation..."
  25. # Add --debug flag if DEBUG_MODE is true
  26. if [ "$DEBUG_MODE" = "true" ]; then
  27. python3 -u text2sql_eval.py --db_root_path ${db_root_path} --predicted_sql_path ${data_output_path} \
  28. --ground_truth_path ${ground_truth_path} \
  29. --diff_json_path ${eval_path} --debug
  30. else
  31. python3 -u text2sql_eval.py --db_root_path ${db_root_path} --predicted_sql_path ${data_output_path} \
  32. --ground_truth_path ${ground_truth_path} \
  33. --diff_json_path ${eval_path}
  34. fi
  35. echo "Done evaluating $model."
  36. else
  37. echo "Error: llama_text2sql.py failed with exit code $?. Skipping evaluation."
  38. exit 1
  39. fi