-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.cpp
50 lines (33 loc) · 906 Bytes
/
testing.cpp
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
#include <iostream>
#include <string>
#include <fstream>
#include "rwkv.h"
#include "chrono"
// #include "sampler/sample.hpp"
#include "tokenizer/tokenizer.hpp"
#include "thread"
#include "atomic"
#include "sampler/sample.h"
#include "tensor/operators/threading/threading.h"
int main( int argc, char** argv ){
std::string path = "./model.safetensors";
if (argc > 1)
{
path = argv[1];
}
size_t threads = 8;
if (argc > 2)
{
threads = std::stoi(argv[2]);
}
RWKV model(path, threads, true);
auto pool = get_threadpool();
// model.cuda();
auto logits = model({{0}});
pool->debug(model.blocks[0].attshift.state[0], "attshift state");
pool->debug(model.blocks[0].ffnshift.state[0], "ffnshift state");
pool->debug(model.blocks[0].att.state[0], "att state");
pool->start();
pool->sync(true);
pool->stop();
}