Skip to content

Commit

Permalink
Revert "fix includes with help from include-what-you-use"
Browse files Browse the repository at this point in the history
This reverts commit 635e9fa.
  • Loading branch information
cebtenzzre committed Nov 30, 2023
1 parent f30b4e6 commit f595b69
Show file tree
Hide file tree
Showing 57 changed files with 222 additions and 298 deletions.
18 changes: 6 additions & 12 deletions common/common.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
#include "common.h"
#include "ggml.h"
#include "llama.h"
#include "log.h"
#include "sampling.h"

#include <algorithm>
#include <cctype>
#include <chrono>
#include <cinttypes>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <exception>
#include <fstream>
#include <iterator>
#include <iostream>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cinttypes>

#if defined(__APPLE__) && defined(__MACH__)
#include <sys/types.h>
Expand All @@ -40,7 +32,9 @@
#include <fcntl.h>
#include <io.h>
#else
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
#endif

#if defined(_MSC_VER)
Expand Down
11 changes: 6 additions & 5 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
#pragma once

#include "llama.h"

#include "sampling.h"

#define LOG_NO_FILE_LINE_FUNCTION
#include "log.h"

#include <cmath>
#include <cstdint>
#include <cstdio>
#include <random>
#include <string>
#include <tuple>
#include <vector>
#include <random>
#include <thread>
#include <unordered_map>
#include <tuple>

#ifdef _WIN32
#define DIRECTORY_SEPARATOR '\\'
Expand Down Expand Up @@ -67,7 +68,7 @@ struct gpt_params {
int32_t yarn_orig_ctx = 0; // YaRN original context length
int8_t rope_scaling_type = LLAMA_ROPE_SCALING_UNSPECIFIED;

// sampling parameters
// // sampling parameters
struct llama_sampling_params sparams;

std::string model = "models/7B/ggml-model-f16.gguf"; // model path
Expand Down
11 changes: 6 additions & 5 deletions common/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#else
#include <clocale>
#include <cstdio>
#include <cwchar>

#include <climits>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <termios.h>
#endif

#define ANSI_COLOR_RED "\x1b[31m"
Expand Down
1 change: 1 addition & 0 deletions common/grammar-parser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "grammar-parser.h"
#include <cstdint>
#include <cwchar>
#include <string>
#include <utility>
#include <stdexcept>
Expand Down
7 changes: 2 additions & 5 deletions common/grammar-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
// space ::= [ \t\n]*

#pragma once

#include "llama.h"

#include <cstdint>
#include <cstdio>
#include <vector>
#include <map>
#include <cstdint>
#include <string>
#include <vector>

namespace grammar_parser {
struct parse_state {
Expand Down
6 changes: 0 additions & 6 deletions common/sampling.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#include "common.h"
#include "sampling.h"

#include <algorithm>
#include <cstdio>
#include <map>
#include <utility>

struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_params & params) {
struct llama_sampling_context * result = new llama_sampling_context();

Expand Down
8 changes: 5 additions & 3 deletions common/sampling.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "grammar-parser.h"
#include "llama.h"

#include <cstdint>
#include "grammar-parser.h"

#include <string>
#include <unordered_map>
#include <vector>
#include <unordered_map>

// sampling parameters
typedef struct llama_sampling_params {
Expand Down Expand Up @@ -56,6 +56,8 @@ struct llama_sampling_context {
std::vector<llama_token_data> cur;
};

#include "common.h"

// Create a new sampling context instance.
struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_params & params);

Expand Down
14 changes: 2 additions & 12 deletions common/train.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#include "common.h"
#include "ggml.h"
#include "llama.h"
#include "train.h"
#include "common.h"

#include <algorithm>
#include <cerrno>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <locale>
#include <random>
#include <sstream>
#include <functional>

struct random_normal_distribution {
std::mt19937 gen;
Expand Down
9 changes: 4 additions & 5 deletions common/train.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

#pragma once

#include "llama.h"

#include <cstddef>
#include <cstdint>
#include <random>
#include <string>
#include <random>
#include <vector>

#include "ggml.h"
#include "llama.h"

typedef std::string mt19937_state;

struct train_state {
Expand Down
6 changes: 2 additions & 4 deletions examples/baby-llama/baby-llama.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include "ggml.h"
#include "train.h"

#include <algorithm>
#include <vector>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <random>
#include <vector>

#if defined(_MSC_VER)
Expand Down
5 changes: 2 additions & 3 deletions examples/batched-bench/batched-bench.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "common.h"
#include "ggml.h"
#include "llama.h"

#include <algorithm>
#include <cstdint>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>

// mutates the input string
Expand Down
4 changes: 1 addition & 3 deletions examples/batched/batched.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "common.h"
#include "ggml.h"
#include "llama.h"

#include <algorithm>
#include <cstdint>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>

Expand Down
19 changes: 17 additions & 2 deletions examples/beam-search/beam-search.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
#include "common.h"
#include "llama.h"

#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include <signal.h>
#include <unistd.h>
#elif defined (_WIN32)
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
#include <signal.h>
#endif

// Used for debugging to print out beam tokens.
struct ostream_beam_view {
llama_context * ctx;
Expand Down
15 changes: 12 additions & 3 deletions examples/benchmark/benchmark-matmult.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#include "common.h"
#include "ggml.h"

#include <cinttypes>
#include <locale.h>
#include <assert.h>
#include <math.h>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cinttypes>
#include <unordered_map>
#include <queue>
#include <string.h>
#include <cassert>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>

#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
Expand Down
19 changes: 8 additions & 11 deletions examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
#include "common.h"
#include "ggml.h"
#include "llama.h"
#include "common.h"

#include <algorithm>
#include <unordered_map>
#include <vector>
#include <cassert>
#include <cerrno>
#include <climits>
#include <cmath>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <ctime>
#include <random>
#include <stdexcept>
#include <sstream>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

// GGUF keys & tensor names.

Expand Down
5 changes: 0 additions & 5 deletions examples/embedding/embedding.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#include "common.h"
#include "llama.h"

#include <algorithm>
#include <cstdio>
#include <ctime>
#include <random>
#include <tuple>
#include <vector>

#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
Expand Down
9 changes: 2 additions & 7 deletions examples/export-lora/export-lora.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@

#include "common.h"
#include "ggml.h"
#include "ggml-alloc.h"

#include <algorithm>
#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#include <thread>
#include <vector>

static const size_t tensor_alignment = 32;

Expand Down
20 changes: 10 additions & 10 deletions examples/finetune/finetune.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include "common.h"
#include "ggml-alloc.h"
#include "ggml.h"
#include "ggml-alloc.h"
#include "llama.h"
#include "common.h"
#include "train.h"

#include <algorithm>
#include <cerrno>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <unordered_map>
#include <vector>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdarg>
#include <ctime>
#include <random>
#include <stdexcept>
#include <algorithm>
#include <string>
#include <vector>

#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
Expand Down
Loading

0 comments on commit f595b69

Please sign in to comment.