-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bug-fix] remove json marshall before task args hashing
- Loading branch information
Showing
2 changed files
with
21 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package models_test | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"h_relay/models" | ||
"testing" | ||
) | ||
|
||
func TestInferenceTaskHash(t *testing.T) { | ||
taskArgs := `{"base_model": "runwayml/stable-diffusion-v1-5", "prompt": "best quality, ultra high res, photorealistic++++, 1girl, off-shoulder sweater, smiling, faded ash gray messy bun hair+, border light, depth of field, looking at viewer, closeup", "negative_prompt": "paintings, sketches, worst quality+++++, low quality+++++, normal quality+++++, lowres, normal quality, monochrome++, grayscale++, skin spots, acnes, skin blemishes, age spot, glans", "task_config": {"num_images": 1, "safety_checker": false}}` | ||
taskArgsHash := `0xe8a09714ac70305cbc7c35202d5c77927b4390c0c26274fd33aadd9061d222ce` | ||
|
||
task := &models.InferenceTask{ | ||
TaskArgs: taskArgs, | ||
} | ||
|
||
generatedHash, err := task.GetTaskHash() | ||
assert.Nil(t, err, "error get task hash") | ||
assert.Equal(t, taskArgsHash, generatedHash.Hex()) | ||
} |