-
Notifications
You must be signed in to change notification settings - Fork 20
/
codellama.cpp
35 lines (31 loc) · 827 Bytes
/
codellama.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
struct Config : public llama::v2::Config
{
float rope_theta;
};
class Tokenizer : public llama::v2::Tokenizer
{
public:
Tokenizer(const Config &config)
: llama::v2::Tokenizer::Tokenizer(config)
{
sys_prompt = "";
}
};
class ConditionalGeneration : public llama::v2::ConditionalGeneration
{
public:
ConditionalGeneration() = default;
ConditionalGeneration(const Config &config)
: ConditionalGeneration(config, MODEL_TYPE_CODELLAMA)
{
}
ConditionalGeneration(const Config &config, ModelType type)
: llama::v2::ConditionalGeneration(config, type)
{
for (int i = 0; i < config.num_hidden_layers; i++)
{
auto &attention = transformer->layers[i].attention;
attention.freq_base = config.rope_theta;
}
}
};