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

Set encoding to avoid Encoding::CompatibilityError #9

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

keyasuda
Copy link
Contributor

This PR is to avoid following error on LLaMACpp.generate.

/home/keyasuda/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/llama_cpp-0.5.1/lib/llama_cpp.rb:107:in `delete_prefix': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
	from /home/keyasuda/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/llama_cpp-0.5.1/lib/llama_cpp.rb:107:in `generate'
	from test2.rb:8:in `<main>'

Test script is like following:

require 'llama_cpp'

params = LLaMACpp::ContextParams.new
params.seed = 42
model = LLaMACpp::Model.new(model_path: ARGV[0], params: params)
context = LLaMACpp::Context.new(model: model)
prompt = '[INST] <<SYS>>あなたは誠実で優秀な日本人のアシスタントです。<</SYS>>明日の天気は?[/INST]'
puts LLaMACpp.generate(context, prompt, n_threads: 16, n_predict: 256)

Copy link
Owner

@yoshoku yoshoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@yoshoku yoshoku merged commit 77613a3 into yoshoku:main Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants