llama_eval.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. eval_path='../data/dev_20240627/dev.json'
  2. db_root_path='../data/dev_20240627/dev_databases/'
  3. ground_truth_path='../data/'
  4. # Llama models on Together
  5. #YOUR_API_KEY='YOUR_TOGETHER_API_KEY'
  6. #model='meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo'
  7. #model='meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo'
  8. #model='meta-llama/Llama-3.3-70B-Instruct-Turbo'
  9. #model='meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8'
  10. #model='meta-llama/Llama-4-Scout-17B-16E-Instruct'
  11. # Llama models on Llama API
  12. YOUR_API_KEY='YOUR_LLAMA_API_KEY'
  13. model='Llama-3.3-8B-Instruct'
  14. #model='Llama-3.3-70B-Instruct'
  15. #model='Llama-4-Maverick-17B-128E-Instruct-FP8'
  16. #model='Llama-4-Scout-17B-16E-Instruct-FP8'
  17. # Llama model on Hugging Face Hub
  18. # https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct
  19. # YOUR_API_KEY='huggingface'
  20. # model='meta-llama/Llama-3.1-8B-Instruct'
  21. # Fine-tuned Llama models locally
  22. #YOUR_API_KEY='finetuned'
  23. #model='../fine_tuning/llama31-8b-text2sql-fine-tuned'
  24. data_output_path="./output/$model/"
  25. echo "Text2SQL using $model"
  26. python3 -u llama_text2sql.py --db_root_path ${db_root_path} --api_key ${YOUR_API_KEY} \
  27. --model ${model} --eval_path ${eval_path} --data_output_path ${data_output_path}
  28. # Check if llama_text2sql.py exited successfully
  29. if [ $? -eq 0 ]; then
  30. echo "llama_text2sql.py completed successfully. Proceeding with evaluation..."
  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. echo "Done evaluating $model."
  35. else
  36. echo "Error: llama_text2sql.py failed with exit code $?. Skipping evaluation."
  37. exit 1
  38. fi