Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

workloads.sh 2.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  1. #!/bin/bash
  2. export PYTHONPATH=$PYTHONPATH:$PWD
  3. export RAY_AIR_REENABLE_DEPRECATED_SYNC_TO_HEAD_NODE=1
  4. mkdir results
  5. # Test data
  6. export RESULTS_FILE=results/test_data_results.txt
  7. export DATASET_LOC="https://raw.githubusercontent.com/GokuMohandas/Made-With-ML/main/datasets/dataset.csv"
  8. pytest --dataset-loc=$DATASET_LOC tests/data --verbose --disable-warnings > $RESULTS_FILE
  9. cat $RESULTS_FILE
  10. # Test code
  11. export RESULTS_FILE=results/test_code_results.txt
  12. python -m pytest tests/code --verbose --disable-warnings > $RESULTS_FILE
  13. cat $RESULTS_FILE
  14. # Train
  15. export EXPERIMENT_NAME="llm"
  16. export RESULTS_FILE=results/training_results.json
  17. export DATASET_LOC="https://raw.githubusercontent.com/GokuMohandas/Made-With-ML/main/datasets/dataset.csv"
  18. export TRAIN_LOOP_CONFIG='{"dropout_p": 0.5, "lr": 1e-4, "lr_factor": 0.8, "lr_patience": 3}'
  19. python madewithml/train.py \
  20. --experiment-name "$EXPERIMENT_NAME" \
  21. --dataset-loc "$DATASET_LOC" \
  22. --train-loop-config "$TRAIN_LOOP_CONFIG" \
  23. --num-workers 1 \
  24. --cpu-per-worker 10 \
  25. --gpu-per-worker 1 \
  26. --num-epochs 10 \
  27. --batch-size 256 \
  28. --results-fp $RESULTS_FILE
  29. # Get and save run ID
  30. export RUN_ID=$(python -c "import os; from madewithml import utils; d = utils.load_dict(os.getenv('RESULTS_FILE')); print(d['run_id'])")
  31. export RUN_ID_FILE=results/run_id.txt
  32. echo $RUN_ID > $RUN_ID_FILE # used for serving later
  33. # Evaluate
  34. export RESULTS_FILE=results/evaluation_results.json
  35. export HOLDOUT_LOC="https://raw.githubusercontent.com/GokuMohandas/Made-With-ML/main/datasets/holdout.csv"
  36. python madewithml/evaluate.py \
  37. --run-id $RUN_ID \
  38. --dataset-loc $HOLDOUT_LOC \
  39. --results-fp $RESULTS_FILE
  40. # Test model
  41. RESULTS_FILE=results/test_model_results.txt
  42. pytest --run-id=$RUN_ID tests/model --verbose --disable-warnings > $RESULTS_FILE
  43. cat $RESULTS_FILE
  44. # Save to S3
  45. export MODEL_REGISTRY=$(python -c "from madewithml import config; print(config.MODEL_REGISTRY)")
  46. aws s3 cp $MODEL_REGISTRY s3://madewithml/$GITHUB_USERNAME/mlflow/ --recursive
  47. aws s3 cp results/ s3://madewithml/$GITHUB_USERNAME/results/ --recursive
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...