mirror of
https://github.com/yalue/onnxruntime_go.git
synced 2025-11-02 11:34:16 +08:00
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:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user