• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rendezqueue / rendezllama / 21032293656

15 Jan 2026 12:21PM UTC coverage: 90.293% (+20.8%) from 69.536%
21032293656

push

github

grencez
update(llama.cpp): with EXAONE-MoE model support

2000 of 2215 relevant lines covered (90.29%)

38.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/test/language/inference_test.cc
1
#include "src/chat/display.hh"
2
#include "src/chat/opt.hh"
3
#include "src/chat/trajectory.hh"
4
#include "src/language/inference.hh"
5
#include "src/language/vocabulary.hh"
6

7
#include <cassert>
8
#include <iostream>
9
#include <tuple>
10
#include <vector>
11

12
#include <fildesh/fildesh.h>
13

14
#include "llama.h"
15

16
using rendezllama::ChatDisplay;
17
using rendezllama::ChatOptions;
18
using rendezllama::ChatTrajectory;
19
using rendezllama::Inference;
20
using rendezllama::Vocabulary;
21

22
static
23
  void
24
noop_log_callback(enum ggml_log_level level, const char* text, void* user_data)
180✔
25
{
26
  (void) level;
180✔
27
  (void) text;
180✔
28
  (void) user_data;
180✔
29
}
180✔
30

31
static void test_antiprompt_suffix() {
1✔
32
  std::set<std::string> antiprompts;
1✔
33
  antiprompts.insert("User:");
2✔
34
  antiprompts.insert("\nUser:");
2✔
35

36
  // Case: No match
37
  assert(rendezllama::antiprompt_suffix("Hello World", antiprompts).empty());
1✔
38

39
  // Case: Exact match
40
  assert(rendezllama::antiprompt_suffix("User:", antiprompts) == "User:");
1✔
41

42
  // Case: Suffix match
43
  assert(rendezllama::antiprompt_suffix("Hello User:", antiprompts) == "User:");
1✔
44

45
  // Case: Longest match check (order in set matters)
46
  // "User:" is a suffix of "\nUser:" but "\nUser:" is longer.
47
  // In std::set, "\nUser:" (byte 10) comes before "User:" (byte 85).
48
  // The function iterates and returns the first match.
49
  // "\nUser:" should be checked first.
50
  assert(rendezllama::antiprompt_suffix("Hello\nUser:", antiprompts) == "\nUser:");
1✔
51

52
  // Case: Partial match should fail
53
  assert(rendezllama::antiprompt_suffix("User", antiprompts).empty());
1✔
54
}
1✔
55

56
static void inference_test(const std::string& model_filename) {
1✔
57
  llama_log_set(noop_log_callback, NULL);
1✔
58

59
  ChatOptions opt;
1✔
60
  opt.model_filename = model_filename;
1✔
61
  // Initialize infer_via with default Sampling to avoid assertion failure in Inference::reinitialize.
62
  opt.infer_via.emplace<rendezllama::inference::Sampling>();
1✔
63
  // Workaround for potential crash with default boundary prefix "☺".
64
  opt.substitution.boundary_prefix = ":";
1✔
65

66
  struct llama_model* model = nullptr;
1✔
67
  struct llama_context* ctx = nullptr;
1✔
68
  std::tie(model, ctx) = rendezllama::make_llama_context(opt);
1✔
69
  assert(model);
1✔
70
  assert(ctx);
1✔
71

72
  Vocabulary vocabulary(model, opt.substitution.boundary_prefix);
1✔
73
  Inference inference(vocabulary);
1✔
74
  ChatTrajectory chat_traj(vocabulary.bos_token_id());
1✔
75
  ChatDisplay chat_disp;
1✔
76
  // Use /dev/null for display to avoid spamming test output, we check tokens programmatically.
77
  chat_disp.out_ = open_FildeshOF("/dev/null");
1✔
78

79
  // Add a simple prompt to start generation.
80
  // "Once upon a time"
81
  chat_traj.tokenize_append("Once upon a time", vocabulary);
1✔
82
  chat_disp.show_new(chat_traj, vocabulary);
1✔
83

84
  using rendezllama::inference::AdjustViaKind;
1✔
85
  using rendezllama::inference::Sampling;
1✔
86
  using rendezllama::inference::Mirostat;
1✔
87

88
  std::vector<Sampling> samplings;
1✔
89
  // Temperature
90
  {
1✔
91
    Sampling s;
1✔
92
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::temperature>, 0.8f);
1✔
93
    samplings.push_back(s);
1✔
94
  }
×
95
  // Top K
96
  {
1✔
97
    Sampling s;
1✔
98
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::top_k>, 40u);
1✔
99
    samplings.push_back(s);
1✔
100
  }
×
101
  // Top P
102
  {
1✔
103
    Sampling s;
1✔
104
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::top_p>, 0.9f);
1✔
105
    samplings.push_back(s);
1✔
106
  }
×
107
  // Min P
108
  {
1✔
109
    Sampling s;
1✔
110
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::min_p>, 0.05f);
1✔
111
    samplings.push_back(s);
1✔
112
  }
×
113
   // Typical P
114
  {
1✔
115
    Sampling s;
1✔
116
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::typical_p>, 0.9f);
1✔
117
    samplings.push_back(s);
1✔
118
  }
×
119
  // Mirostat V2
120
  {
1✔
121
    Sampling s;
1✔
122
    s.pick_via = Mirostat{2, 5.0f, 0.1f};
1✔
123
    samplings.push_back(s);
1✔
124
  }
×
125
  // Penalties
126
  {
1✔
127
    Sampling s;
1✔
128
    rendezllama::inference::PenalizeWith p;
1✔
129
    p.window_length = 5;
1✔
130
    p.repetition = 1.1f;
1✔
131
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::penalize_with>, p);
1✔
132
    samplings.push_back(s);
1✔
133
  }
×
134
  // Dry
135
  {
1✔
136
    Sampling s;
1✔
137
    rendezllama::inference::Dry d;
1✔
138
    d.multiplier = 0.8f;
1✔
139
    d.base = 1.75f;
1✔
140
    d.allowed_length = 2;
1✔
141
    d.window_length = 0; // Default
1✔
142
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::dry>, d);
1✔
143
    samplings.push_back(s);
1✔
144
  }
×
145
  // XTC
146
  {
1✔
147
    Sampling s;
1✔
148
    rendezllama::inference::Xtc x;
1✔
149
    x.threshold = 0.1f;
1✔
150
    x.probability = 0.5f;
1✔
151
    s.adjust_thru.emplace_back(std::in_place_index<AdjustViaKind::xtc>, x);
1✔
152
    samplings.push_back(s);
1✔
153
  }
×
154

155
  // Iterate through different sampling options.
156
  for (const auto& sampling : samplings) {
10✔
157
    opt.infer_via = sampling;
9✔
158
    if (!inference.commit_to_context(ctx, chat_disp, chat_traj, opt, model)) {
9✔
159
      break;
160
    }
161
    inference.sample_to_trajectory(chat_traj, ctx, false);
9✔
162
    chat_disp.show_new(chat_traj, vocabulary);
9✔
163
  }
164

165
  llama_free(ctx);
1✔
166
  llama_model_free(model);
1✔
167
}
1✔
168

169
int main(int argc, char** argv)
1✔
170
{
171
  rendezllama::GlobalScope rendezllama_global_scope;
1✔
172
  assert(argc == 2);
1✔
173
  test_antiprompt_suffix();
1✔
174
  inference_test(argv[1]);
2✔
175
  return 0;
1✔
176
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc