Add more examples to the phi readme. (#956)

This commit is contained in:
Laurent Mazare
2023-09-24 18:19:05 +01:00
committed by GitHub
parent 402ddcfcb4
commit 1ce7fe2543

View File

@ -1,6 +1,11 @@
# candle-phi: 1.3b LLM with state of the art performance for <10b models. # candle-phi: 1.3b LLM with state of the art performance for <10b models.
[phi-1.5](https://huggingface.co/microsoft/phi-1_5). [Phi-1.5](https://huggingface.co/microsoft/phi-1_5) is a language model using
only 1.3 billion parameters but with state of the art performance compared to
models with up to 10 billion parameters.
The candle implementation provides both the standard version as well as a
quantized variant.
## Running some example ## Running some example
@ -20,4 +25,19 @@ def is_prime(n):
if n % i == 0: if n % i == 0:
return False return False
return True return True
$ cargo run --example phi --release -- \
--prompt "Explain how to find the median of an array and write the corresponding python function.\nAnswer:" \
--quantized --sample-len 200
Explain how to find the median of an array and write the corresponding python function.
Answer: The median is the middle value in an array. If the array has an even number of elements, the median is the average of the two middle values.
def median(arr):
arr.sort()
n = len(arr)
if n % 2 == 0:
return (arr[n//2 - 1] + arr[n//2]) / 2
else:
return arr[n//2]
``` ```