llama : clean-up

This commit is contained in:
Georgi Gerganov 2024-07-23 08:38:50 +03:00
parent dae3cae841
commit fe28a7b9d8
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
5 changed files with 20 additions and 29 deletions

View file

@ -3,24 +3,6 @@
#define LLAMA_API_INTERNAL
#include "llama.h"
#ifdef __has_include
#if __has_include(<unistd.h>)
#include <unistd.h>
#if defined(_POSIX_MAPPED_FILES)
#include <sys/mman.h>
#include <fcntl.h>
#endif
#if defined(_POSIX_MEMLOCK_RANGE)
#include <sys/resource.h>
#endif
#endif
#endif
// bump if necessary
#define LLAMA_MAX_NODES 8192
#define LLAMA_MAX_LAYERS 512
#define LLAMA_MAX_EXPERTS 160 // DeepSeekV2
#ifdef __GNUC__
#ifdef __MINGW32__
#define LLAMA_ATTRIBUTE_FORMAT(...) __attribute__((format(gnu_printf, __VA_ARGS__)))

View file

@ -18,8 +18,6 @@ struct llama_sampling {
}
};
struct llama_sampling * llama_get_sampling(struct llama_context * ctx);
//
// internal API
//

View file

@ -62,7 +62,6 @@ struct llama_vocab {
};
const struct llama_vocab * llama_get_vocab(const struct llama_context * ctx);
const struct llama_vocab * llama_get_vocab(const struct llama_model * model);
//
// internal API

View file

@ -36,6 +36,19 @@
// TODO: replace with ggml API call
#define QK_K 256
#ifdef __has_include
#if __has_include(<unistd.h>)
#include <unistd.h>
#if defined(_POSIX_MAPPED_FILES)
#include <sys/mman.h>
#include <fcntl.h>
#endif
#if defined(_POSIX_MEMLOCK_RANGE)
#include <sys/resource.h>
#endif
#endif
#endif
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
@ -87,6 +100,11 @@
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
// bump if necessary
#define LLAMA_MAX_NODES 8192
#define LLAMA_MAX_LAYERS 512
#define LLAMA_MAX_EXPERTS 160 // DeepSeekV2
//
// helpers
//
@ -16794,14 +16812,6 @@ const struct llama_vocab * llama_get_vocab(const struct llama_context * ctx) {
return &ctx->model.vocab;
}
const struct llama_vocab * llama_get_vocab(const struct llama_model * model) {
return &model->vocab;
}
struct llama_sampling * llama_get_sampling(struct llama_context * ctx) {
return &ctx->sampling;
}
struct llama_grammar * llama_get_grammar(struct llama_context * ctx) {
return &ctx->grammar;
}

View file

@ -4,6 +4,8 @@
#include <string>
#include <vector>
// TODO: prefix all symbols with "llama_"
struct codepoint_flags {
enum {
UNDEFINED = 0x0001,