red-candle 1.0.0.pre.2 → 1.0.0.pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +12 -0
- data/LICENSE +22 -0
- data/Rakefile +95 -0
- data/bin/console +11 -0
- data/bin/setup +17 -0
- data/ext/candle/rustfmt.toml +63 -0
- data/lib/candle/version.rb +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53283961925b76f6fdc39634e01d3d08f58805584488053f7e82fbd484b96b21
|
4
|
+
data.tar.gz: 91d3dae0c3c1f6686980708fc898132178454712fe9adf2a79d59f75038c21f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 809ab126883fc6a0b706f46b34922ccbbb5eb18b6b153b703404d17bdd2626a0bafe5cebbdd9168389c44f7506b4f0dabd2b9ed7a6ad6348b7406a899e3e5484
|
7
|
+
data.tar.gz: 1d908b031b207bf43e65d81c3f8ac34cd1451cdd38d32476a30e83c23b34c6148a2aa7e235b804ad47041b0d781b1ca36585c2c83b0fa7cd1e9ba26d7cbfc377
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 kojix2
|
4
|
+
Copyright (c) 2024 Christopher Petersen
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rake/extensiontask"
|
6
|
+
|
7
|
+
ENV['CANDLE_TEST_SKIP_LLM'] = 'true'
|
8
|
+
|
9
|
+
task default: :test
|
10
|
+
Rake::TestTask.new do |t|
|
11
|
+
t.deps << :compile
|
12
|
+
t.libs << "test"
|
13
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
14
|
+
end
|
15
|
+
|
16
|
+
spec = Bundler.load_gemspec("candle.gemspec")
|
17
|
+
Rake::ExtensionTask.new("candle", spec) do |c|
|
18
|
+
c.lib_dir = "lib/candle"
|
19
|
+
c.cross_compile = true
|
20
|
+
c.cross_platform = %w[
|
21
|
+
aarch64-linux
|
22
|
+
arm64-darwin
|
23
|
+
x64-mingw-ucrt
|
24
|
+
x64-mingw32
|
25
|
+
x86_64-darwin
|
26
|
+
x86_64-linux
|
27
|
+
x86_64-linux-musl
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Run device compatibility tests"
|
32
|
+
Rake::TestTask.new("test:device") do |t|
|
33
|
+
t.deps << :compile
|
34
|
+
t.libs << "test"
|
35
|
+
t.test_files = FileList["test/device_compatibility_test.rb"]
|
36
|
+
t.verbose = true
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Run benchmark tests"
|
40
|
+
Rake::TestTask.new("test:benchmark") do |t|
|
41
|
+
ENV['CANDLE_RUN_BENCHMARKS'] = 'true'
|
42
|
+
t.deps << :compile
|
43
|
+
t.libs << "test"
|
44
|
+
t.test_files = FileList["test/benchmarks/**/*_test.rb"]
|
45
|
+
t.verbose = true
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Run all tests including benchmarks"
|
49
|
+
task "test:all" => [:test, "test:benchmark"]
|
50
|
+
|
51
|
+
desc "Run tests on specific devices"
|
52
|
+
namespace :test do
|
53
|
+
%w[cpu metal cuda].each do |device|
|
54
|
+
desc "Run tests on #{device.upcase} only"
|
55
|
+
task "device:#{device}" => :compile do
|
56
|
+
ENV['CANDLE_TEST_DEVICES'] = device
|
57
|
+
Rake::Task["test:device"].invoke
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Run benchmarks with device tests"
|
63
|
+
task "test:device:benchmark" => :compile do
|
64
|
+
ENV['CANDLE_RUN_BENCHMARKS'] = 'true'
|
65
|
+
ENV['CANDLE_TEST_VERBOSE'] = 'true'
|
66
|
+
Rake::Task["test:device"].invoke
|
67
|
+
Rake::Task["test:benchmark"].invoke
|
68
|
+
end
|
69
|
+
|
70
|
+
namespace :doc do
|
71
|
+
task default: %i[rustdoc yard]
|
72
|
+
|
73
|
+
desc "Generate YARD documentation"
|
74
|
+
task :yard do
|
75
|
+
sh <<~CMD
|
76
|
+
yard doc \
|
77
|
+
--plugin rustdoc -- lib tmp/doc/candle.json
|
78
|
+
CMD
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "Generate Rust documentation as JSON"
|
82
|
+
task :rustdoc do
|
83
|
+
sh <<~CMD
|
84
|
+
cargo +nightly rustdoc \
|
85
|
+
--target-dir tmp/doc/target \
|
86
|
+
-p candle \
|
87
|
+
-- -Zunstable-options --output-format json \
|
88
|
+
--document-private-items
|
89
|
+
CMD
|
90
|
+
|
91
|
+
cp "tmp/doc/target/doc/candle.json", "tmp/doc/candle.json"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
task doc: "doc:default"
|
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "candle"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
# Check if Rust is installed
|
7
|
+
if ! command -v cargo &> /dev/null
|
8
|
+
then
|
9
|
+
echo "Rust is not installed. Please install Rust: https://www.rust-lang.org/tools/install"
|
10
|
+
exit 1
|
11
|
+
fi
|
12
|
+
|
13
|
+
# Install Ruby dependencies
|
14
|
+
bundle install
|
15
|
+
|
16
|
+
# Build Rust extension
|
17
|
+
bundle exec rake compile
|
@@ -0,0 +1,63 @@
|
|
1
|
+
max_width = 100
|
2
|
+
hard_tabs = false
|
3
|
+
tab_spaces = 4
|
4
|
+
newline_style = "Auto"
|
5
|
+
use_small_heuristics = "Default"
|
6
|
+
indent_style = "Block"
|
7
|
+
wrap_comments = false
|
8
|
+
format_code_in_doc_comments = false
|
9
|
+
comment_width = 80
|
10
|
+
normalize_comments = false
|
11
|
+
normalize_doc_attributes = false
|
12
|
+
format_strings = false
|
13
|
+
format_macro_matchers = false
|
14
|
+
format_macro_bodies = true
|
15
|
+
empty_item_single_line = true
|
16
|
+
struct_lit_single_line = true
|
17
|
+
fn_single_line = false
|
18
|
+
where_single_line = false
|
19
|
+
imports_indent = "Block"
|
20
|
+
imports_layout = "Mixed"
|
21
|
+
imports_granularity="Crate"
|
22
|
+
reorder_imports = true
|
23
|
+
reorder_modules = true
|
24
|
+
reorder_impl_items = false
|
25
|
+
type_punctuation_density = "Wide"
|
26
|
+
space_before_colon = false
|
27
|
+
space_after_colon = true
|
28
|
+
spaces_around_ranges = false
|
29
|
+
binop_separator = "Front"
|
30
|
+
remove_nested_parens = true
|
31
|
+
combine_control_expr = true
|
32
|
+
overflow_delimited_expr = false
|
33
|
+
struct_field_align_threshold = 0
|
34
|
+
enum_discrim_align_threshold = 0
|
35
|
+
match_arm_blocks = true
|
36
|
+
force_multiline_blocks = false
|
37
|
+
fn_params_layout = "Tall"
|
38
|
+
brace_style = "SameLineWhere"
|
39
|
+
control_brace_style = "AlwaysSameLine"
|
40
|
+
trailing_semicolon = true
|
41
|
+
trailing_comma = "Vertical"
|
42
|
+
match_block_trailing_comma = false
|
43
|
+
blank_lines_upper_bound = 1
|
44
|
+
blank_lines_lower_bound = 0
|
45
|
+
edition = "2021"
|
46
|
+
version = "One"
|
47
|
+
inline_attribute_width = 0
|
48
|
+
merge_derives = true
|
49
|
+
use_try_shorthand = false
|
50
|
+
use_field_init_shorthand = false
|
51
|
+
force_explicit_abi = true
|
52
|
+
condense_wildcard_suffixes = false
|
53
|
+
color = "Auto"
|
54
|
+
#required_version = "1.4.12"
|
55
|
+
unstable_features = false
|
56
|
+
disable_all_formatting = false
|
57
|
+
skip_children = false
|
58
|
+
hide_parse_errors = false
|
59
|
+
error_on_line_overflow = false
|
60
|
+
error_on_unformatted = false
|
61
|
+
ignore = []
|
62
|
+
emit_mode = "Files"
|
63
|
+
make_backup = false
|
data/lib/candle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red-candle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Petersen
|
@@ -36,10 +36,16 @@ extra_rdoc_files: []
|
|
36
36
|
files:
|
37
37
|
- Cargo.lock
|
38
38
|
- Cargo.toml
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE
|
39
41
|
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/setup
|
40
45
|
- ext/candle/Cargo.toml
|
41
46
|
- ext/candle/build.rs
|
42
47
|
- ext/candle/extconf.rb
|
48
|
+
- ext/candle/rustfmt.toml
|
43
49
|
- ext/candle/src/lib.rs
|
44
50
|
- ext/candle/src/llm/generation_config.rs
|
45
51
|
- ext/candle/src/llm/mistral.rs
|