summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-09-24 18:19:05 +0100
committerGitHub <noreply@github.com>2023-09-24 18:19:05 +0100
commit1ce7fe25436db6afc1076e5e2a678ec6e129d95f (patch)
treef8ddd0d1614f1e1c977ce720ede6970f81fafbb9
parent402ddcfcb471bedee4600c258cccd9344b3e25ce (diff)
downloadcandle-1ce7fe25436db6afc1076e5e2a678ec6e129d95f.tar.gz
candle-1ce7fe25436db6afc1076e5e2a678ec6e129d95f.tar.bz2
candle-1ce7fe25436db6afc1076e5e2a678ec6e129d95f.zip
Add more examples to the phi readme. (#956)
-rw-r--r--candle-examples/examples/phi/README.md22
1 files changed, 21 insertions, 1 deletions
diff --git a/candle-examples/examples/phi/README.md b/candle-examples/examples/phi/README.md
index cdd32404..bbc252d6 100644
--- a/candle-examples/examples/phi/README.md
+++ b/candle-examples/examples/phi/README.md
@@ -1,6 +1,11 @@
# 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
@@ -20,4 +25,19 @@ def is_prime(n):
if n % i == 0:
return False
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]
```