input.go 1023 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package input
  2. // Input represents one token in the input stream
  3. type Input struct {
  4. // Token is a single element of text.
  5. Token int32
  6. // Multimodal is opaque data representing a non-text
  7. // element such as an image (or part of one if the image
  8. // can be processed in pieces). It may be either together
  9. // with Token or on its own.
  10. Multimodal any
  11. // MultimodalHash is a unique representation of the data
  12. // stored in Multimodal, used for caching and comparing
  13. // equality.
  14. MultimodalHash uint64
  15. }
  16. // MultimodalIndex is a multimodal element (such as an image)
  17. // together with an index into the slice of Inputs with the
  18. // corresponding token. Note that the index is not the same
  19. // as the position - to find that use the index with the
  20. // Positions slice.
  21. type MultimodalIndex struct {
  22. Index int
  23. Multimodal any
  24. }
  25. // Options contains the inputs for a model forward pass
  26. type Options struct {
  27. Inputs []int32
  28. Multimodal []MultimodalIndex
  29. Positions []int32
  30. Sequences []int
  31. Outputs []int32
  32. }