Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move headers from include/ to include/pytorch/tokenizers/ #20

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <re2/re2.h>

// Local
#include "result.h"
#include "tokenizer.h"
#include <pytorch/tokenizers/result.h>
#include <pytorch/tokenizers/tokenizer.h>

namespace tokenizers {
namespace detail {
Expand Down
2 changes: 1 addition & 1 deletion include/error.h → include/pytorch/tokenizers/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

#pragma once

#include <pytorch/tokenizers/log.h>
#include <stdint.h>
#include "log.h"

namespace tokenizers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include <re2/re2.h>

// Local
#include "detail/bpe_tokenizer_base.h"
#include "error.h"
#include "pre_tokenizer.h"
#include "result.h"
#include "token_decoder.h"
#include <pytorch/tokenizers/bpe_tokenizer_base.h>
#include <pytorch/tokenizers/error.h>
#include <pytorch/tokenizers/pre_tokenizer.h>
#include <pytorch/tokenizers/result.h>
#include <pytorch/tokenizers/token_decoder.h>

namespace tokenizers {
class HFTokenizer : public detail::BPETokenizerBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/
// @lint-ignore-every CLANGTIDY facebook-hte-RelativeInclude
#pragma once
#include <pytorch/tokenizers/tokenizer.h>
#include <memory>
#include "tokenizer.h"

namespace tokenizers {

Expand Down
1 change: 1 addition & 0 deletions include/log.h → include/pytorch/tokenizers/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion include/result.h → include/pytorch/tokenizers/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

#pragma once

#include <pytorch/tokenizers/error.h>
#include <cassert>
#include <new>
#include <utility>
#include "error.h"

namespace tokenizers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
// A tokenizer that works with sentencepiece. Used by Llama2.
#pragma once

#include <pytorch/tokenizers/tokenizer.h>
#include <memory>
#include <vector>
#include "sentencepiece_processor.h"
#include "tokenizer.h"
namespace tokenizers {

struct TokenIndex {
Expand Down
6 changes: 3 additions & 3 deletions include/tiktoken.h → include/pytorch/tokenizers/tiktoken.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "re2/re2.h"

// Local
#include "detail/bpe_tokenizer_base.h"
#include "result.h"
#include "tokenizer.h"
#include <pytorch/tokenizers/bpe_tokenizer_base.h>
#include <pytorch/tokenizers/result.h>
#include <pytorch/tokenizers/tokenizer.h>

namespace tokenizers {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

#pragma once

#include <pytorch/tokenizers/error.h>
#include <pytorch/tokenizers/result.h>
#include <string>
#include <vector>
#include "error.h"
#include "result.h"

namespace tokenizers {

Expand Down
2 changes: 1 addition & 1 deletion src/bpe_tokenizer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
// @lint-ignore-every LICENSELINT

#include "detail/bpe_tokenizer_base.h"
#include <pytorch/tokenizers/bpe_tokenizer_base.h>

// Standard
#include <inttypes.h>
Expand Down
2 changes: 1 addition & 1 deletion src/hf_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
// @lint-ignore-every LICENSELINT

#include "hf_tokenizer.h"
#include <pytorch/tokenizers/hf_tokenizer.h>

// Standard
#include <filesystem>
Expand Down
2 changes: 1 addition & 1 deletion src/llama2c_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
// @lint-ignore-every CLANGTIDY facebook-hte-RelativeInclude
#include "llama2c_tokenizer.h"
#include <pytorch/tokenizers/llama2c_tokenizer.h>
#include <cstring>

namespace tokenizers {
Expand Down
8 changes: 4 additions & 4 deletions src/pre_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "pre_tokenizer.h"

// Local
#include <pytorch/tokenizers/pre_tokenizer.h>
#include <pytorch/tokenizers/third-party/llama.cpp-unicode/unicode.h>

// Standard
#include <algorithm>
Expand All @@ -15,9 +18,6 @@
// Third Party
#include <nlohmann/json.hpp>

// Local
#include "unicode.h"

using json = nlohmann::json;

namespace tokenizers {
Expand Down
2 changes: 1 addition & 1 deletion src/sentencepiece.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// A tokenizer that works with sentencepiece.

#include "sentencepiece.h"
#include <pytorch/tokenizers/sentencepiece.h>
#include <cinttypes>
#include <string>
#include "third_party/absl/strings/str_replace.h"
Expand Down
4 changes: 2 additions & 2 deletions src/tiktoken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
limitations under the License.
*************************************************************************/

#include "tiktoken.h"
#include <pytorch/tokenizers/base64.h>
#include <pytorch/tokenizers/tiktoken.h>
#include <cinttypes>
#include <fstream>
#include <limits>
#include "base64.h"
#include "re2/re2.h"

namespace tokenizers {
Expand Down
4 changes: 2 additions & 2 deletions src/token_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
// @lint-ignore-every LICENSELINT

#include "token_decoder.h"
#include <pytorch/tokenizers/token_decoder.h>

// Standard
#include <cstdarg>
Expand All @@ -16,7 +16,7 @@
#include <nlohmann/json.hpp>

// Local
#include "unicode.h"
#include <pytorch/tokenizers/third-party/llama.cpp-unicode/unicode.h>

using json = nlohmann::json;

Expand Down
7 changes: 3 additions & 4 deletions targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ def define_common_targets():
runtime.cxx_library(
name = "headers",
exported_headers = subdir_glob([
("include", "*.h"),
("include", "**/*.h"),
("include", "pytorch/tokenizers/*.h"),
]),
header_namespace = "",
visibility = [
"@EXECUTORCH_CLIENTS",
],
header_namespace = "",
)

runtime.cxx_library(
Expand Down Expand Up @@ -66,7 +65,7 @@ def define_common_targets():
"third-party/llama.cpp-unicode/src/unicode-data.cpp",
],
exported_headers = subdir_glob([
("third-party/llama.cpp-unicode/include", "*.h"),
("include", "pytorch/tokenizers/third-party/llama.cpp-unicode/*.h"),
]),
header_namespace = "",
)
Expand Down
2 changes: 1 addition & 1 deletion test/test_base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include "base64.h"
#include <pytorch/tokenizers/base64.h>
#include "gtest/gtest.h"

namespace tokenizers {
Expand Down
2 changes: 1 addition & 1 deletion test/test_llama2c_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <TestResourceUtils/TestResourceUtils.h>
#endif
#include <gtest/gtest.h>
#include "llama2c_tokenizer.h"
#include <pytorch/tokenizers/llama2c_tokenizer.h>

using namespace ::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/test_pre_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <re2/re2.h>

// Local
#include "pre_tokenizer.h"
#include <pytorch/tokenizers/pre_tokenizer.h>

using json = nlohmann::json;
using namespace tokenizers;
Expand Down
2 changes: 1 addition & 1 deletion test/test_sentencepiece.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <TestResourceUtils/TestResourceUtils.h>
#endif
#include <gtest/gtest.h>
#include "sentencepiece.h"
#include <pytorch/tokenizers/sentencepiece.h>

namespace tokenizers {

Expand Down
2 changes: 1 addition & 1 deletion test/test_tiktoken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <TestResourceUtils/TestResourceUtils.h>
#endif
#include <gtest/gtest.h>
#include "tiktoken.h"
#include <pytorch/tokenizers/tiktoken.h>

using namespace ::testing;

Expand Down
2 changes: 1 addition & 1 deletion third-party/llama.cpp-unicode/src/unicode-data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SOFTWARE.

// generated with scripts/gen-unicode-data.py

#include "unicode-data.h"
#include <pytorch/tokenizers/third-party/llama.cpp-unicode/unicode-data.h>

#include <cstdint>
#include <unordered_map>
Expand Down
4 changes: 2 additions & 2 deletions third-party/llama.cpp-unicode/src/unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ SOFTWARE.
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#endif

#include "unicode.h"
#include "unicode-data.h"
#include <pytorch/tokenizers/third-party/llama.cpp-unicode/unicode.h>
#include <pytorch/tokenizers/third-party/llama.cpp-unicode/unicode-data.h>

#include <algorithm>
#include <cassert>
Expand Down