From 63c204c79e03b32351177817f78a3503a30a3624 Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Wed, 18 Oct 2023 11:27:23 +0100 Subject: [PATCH] Add a mention to the replit-code model in the readme. (#1121) --- README.md | 2 + .../examples/replit-code/README.md | 47 +++++++++---------- candle-examples/examples/replit-code/main.rs | 2 +- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 8bc324bd..db2eb5db 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ We also provide a some command line based examples using state of the art models - [Mistral7b-v0.1](./candle-examples/examples/mistral/): a 7b general LLM with performance larger than all publicly available 13b models as of 2023-09-28. - [StarCoder](./candle-examples/examples/bigcode/): LLM specialized to code generation. +- [Replit-code-v1.5](./candle-examples/examples/replit-code/): a 3.3b LLM specialized for code completion. - [Quantized LLaMA](./candle-examples/examples/quantized/): quantized version of the LLaMA model using the same quantization techniques as [llama.cpp](https://github.com/ggerganov/llama.cpp). @@ -155,6 +156,7 @@ If you have an addition to this list, please submit a pull request. - Phi v1.5. - Mistral 7b v0.1. - StableLM-3B-4E1T. + - Replit-code-v1.5-3B. - T5. - Bert. - Whisper (multi-lingual support). diff --git a/candle-examples/examples/replit-code/README.md b/candle-examples/examples/replit-code/README.md index 84ed4c1c..b576c511 100644 --- a/candle-examples/examples/replit-code/README.md +++ b/candle-examples/examples/replit-code/README.md @@ -9,37 +9,32 @@ in `bfloat16` (so the GPU version will only work on recent nvidia cards). ```bash cargo run --example replit-code --release -- --prompt 'def fibonacci(n): ' ``` -This produces the following output which actually doesn't generate the fibonacci -series properly. +This produces the following output. ``` def fibonacci(n): # write Fibonacci series up to n """Print a Fibonacci series up to n.""" - - assert type(n) == int, "n must be an integer" - - if (type(fib_list)==None or len==0 ): - fib_list = [1] - - for i in range((len-2)): # start at 2nd element of list and go until end. - n += 1 - - print("Fibonacci number",n,"is:",i) - -def main(): - """Call the functions.""" - - userInput=input('Enter a positive integer: ') - - fibonacci(userInput) - + a, b = 0, 1 + while a < n: + print(a, end=' ') + a, b = b, a+b + print() - - - +def fibonacci_loop(n): # write Fibonacci series up to n + """Print a Fibonacci series up to n.""" + result = [] + a, b = 0, 1 + while a < n: + result.append(a) + a, b = b, a+b + return result -if __name__ == '__main__': # only run if this file is called directly. - print("This program prints out Fibonacci numbers.") - main() + +def fibonacci_generator(n): # write Fibonacci series up to n + """Print a Fibonacci series up to n.""" + a, b = 0, 1 + while a < n: + yield a + a, b = b, a+b ``` diff --git a/candle-examples/examples/replit-code/main.rs b/candle-examples/examples/replit-code/main.rs index 87b7d216..82c6c980 100644 --- a/candle-examples/examples/replit-code/main.rs +++ b/candle-examples/examples/replit-code/main.rs @@ -155,7 +155,7 @@ struct Args { tokenizer: Option, /// Penalty to be applied for repeating tokens, 1. means no penalty. - #[arg(long, default_value_t = 1.1)] + #[arg(long, default_value_t = 1.)] repeat_penalty: f32, /// The context size to consider for the repeat penalty.