-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.h
More file actions
59 lines (49 loc) · 1.53 KB
/
Copy pathsession.h
File metadata and controls
59 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "model-registry.h"
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace umm {
struct image_input {
int width;
int height;
std::vector<uint8_t> rgb;
};
struct image_options {
int width = 0; // Zero selects the model default.
int height = 0;
int steps = 50;
float guidance = 4.0f;
float image_guidance = 1.5f;
float flow_shift = 3.0f;
int64_t seed = 42;
bool think = false;
int max_think_tokens = 1024;
};
struct image_result {
int width;
int height;
std::vector<uint8_t> rgb;
std::string reasoning;
std::vector<int32_t> reasoning_tokens;
std::vector<int32_t> prefix_tokens;
};
class session {
public:
// Accept a model package directory, or an understanding GGUF and optional generation checkpoint.
session(const std::string & model, const std::string & generation_model = "");
~session();
session(const session &) = delete;
session & operator=(const session &) = delete;
bool supports(model_capability capability) const;
std::string text(const std::string & prompt, int max_tokens = 256);
std::string understand(const image_input & image, const std::string & prompt,
int max_tokens = 256, bool think = false);
image_result image(const std::string & prompt, const image_options & options = {});
image_result edit(const image_input & image, const std::string & prompt, const image_options & options = {});
private:
struct impl;
std::unique_ptr<impl> impl_;
};
}