Add CONTRIBUTING.md

- Decided to write down some contribution guidelines.

 - Clean up the files generated by onnxruntime_training_test.go.
This commit is contained in:
yalue
2024-07-20 20:56:54 -04:00
parent fb027886d1
commit 4dda46b3a6
3 changed files with 165 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"math"
"math/rand"
"os"
"path"
"testing"
)
@@ -271,17 +272,30 @@ func TestTraining(t *testing.T) {
}
// test the saving of the checkpoint state
errSaveCheckpoint := trainingSession.SaveCheckpoint(path.Join("test_data", "training_test", "finalCheckpoint"), false)
finalCheckpointPath := path.Join("test_data", "training_test", "finalCheckpoint")
errSaveCheckpoint := trainingSession.SaveCheckpoint(finalCheckpointPath, false)
if errSaveCheckpoint != nil {
t.Fatalf("Saving of checkpoint failed with error: %v", errSaveCheckpoint)
}
// test the saving of the model
errExport := trainingSession.ExportModel(path.Join("test_data", "training_test", "final_inference.onnx"), []string{"output"})
finalModelPath := path.Join("test_data", "training_test", "final_inference.onnx")
errExport := trainingSession.ExportModel(finalModelPath, []string{"output"})
if errExport != nil {
t.Fatalf("Exporting model failed with error: %v", errExport)
}
defer func() {
e := os.Remove(finalCheckpointPath)
if e != nil {
t.Errorf("Error removing final checkpoint file %s: %s", finalCheckpointPath, e)
}
e = os.Remove(finalModelPath)
if e != nil {
t.Errorf("Error removing final model file %s: %s", finalModelPath, e)
}
}()
// load the model back in and test in-sample predictions for the first batch
// (we care about correctness more than generalization here)
session, err := NewAdvancedSession(path.Join("test_data", "training_test", "final_inference.onnx"),