mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 10:26:33 +00:00
Tweak the readme for phi and the default sample length. (#1450)
This commit is contained in:
@ -12,22 +12,19 @@ quantized variant.
|
||||
|
||||
For the v2 version.
|
||||
```bash
|
||||
$ cargo run --example phi --release -- --prompt "def print_prime(n): " --model 2
|
||||
def print_prime(n):
|
||||
if n <= 1:
|
||||
print("Not a prime number")
|
||||
else:
|
||||
for i in range(2, int(n**0.5)+1):
|
||||
if (n % i) == 0:
|
||||
print("Not a prime number")
|
||||
break
|
||||
else:
|
||||
print("Prime number")
|
||||
$ cargo run --example phi --release -- --model 2 \
|
||||
--prompt "A skier slides down a frictionless slope of height 40m and length 80m. What's the skier speed at the bottom?"
|
||||
|
||||
A skier slides down a frictionless slope of height 40m and length 80m. What's the skier speed at the bottom?
|
||||
|
||||
# Driver code
|
||||
n = 17
|
||||
print_prime(n)
|
||||
Solution:
|
||||
The potential energy of the skier is converted into kinetic energy as it slides down the slope. The formula for potential energy is mgh, where m is mass, g is acceleration due to gravity (9.8 m/s^2), and h is height. Since there's no friction, all the potential energy is converted into kinetic energy at the bottom of the slope. The formula for kinetic energy is 1/2mv^2, where v is velocity. We can equate these two formulas:
|
||||
mgh = 1/2mv^2
|
||||
Solving for v, we get:
|
||||
v = sqrt(2gh)
|
||||
Substituting the given values, we get:
|
||||
v = sqrt(2*9.8*40) = 28 m/s
|
||||
Therefore, the skier speed at the bottom of the slope is 28 m/s.
|
||||
```
|
||||
|
||||
For the v1.5 version.
|
||||
|
@ -160,7 +160,7 @@ struct Args {
|
||||
seed: u64,
|
||||
|
||||
/// The length of the sample to generate (in tokens).
|
||||
#[arg(long, short = 'n', default_value_t = 100)]
|
||||
#[arg(long, short = 'n', default_value_t = 5000)]
|
||||
sample_len: usize,
|
||||
|
||||
#[arg(long)]
|
||||
|
Reference in New Issue
Block a user