You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

textToImage.go 1.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package textInference
  2. import (
  3. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/database"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/inference"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/strategy"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  9. )
  10. const (
  11. TEXTTOIMAGE = "text-to-image"
  12. TEXTTOIMAGE_AiTYPE = "14"
  13. )
  14. type TextToImage struct {
  15. clusters []*strategy.AssignedCluster
  16. storage *database.AiStorage
  17. opt *option.InferOption
  18. }
  19. func (t *TextToImage) SaveAiTask(id int64, adapterName string) error {
  20. for _, c := range t.clusters {
  21. clusterName, _ := t.storage.GetClusterNameById(c.ClusterId)
  22. t.opt.Replica = c.Replicas
  23. err := t.storage.SaveAiTask(id, t.opt, adapterName, c.ClusterId, clusterName, "", constants.Saved, "")
  24. if err != nil {
  25. return err
  26. }
  27. }
  28. return nil
  29. }
  30. func (t *TextToImage) UpdateStatus(aiTaskList []*models.TaskAi, adapterName string) error {
  31. return nil
  32. }
  33. func (t *TextToImage) AppendRoute(urls []*inference.InferUrl) error {
  34. for i, _ := range urls {
  35. urls[i].Url = urls[i].Url + inference.FORWARD_SLASH + TEXTTOIMAGE
  36. }
  37. return nil
  38. }
  39. func (t *TextToImage) AiType() string {
  40. return TEXTTOIMAGE_AiTYPE
  41. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.