|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑
/ o& C8 Z9 @5 F$ U
0 i0 c5 B, V* ]4 C, X* ]* ?. c================
% K [& b9 [* Q1 tNvidia NIM service, deepseek :, X; h8 e$ V3 t1 G' s/ S* q
================* c2 r6 }2 Z" R) T9 { |: h: s
https://build.nvidia.com/deepseek-ai/deepseek-r1
. `, G c5 s( _+ J
+ b/ M6 c1 \, |6 l
8 v5 n9 F" k! K* \$ c/ rfrom openai import OpenAI& R0 L. ^4 B n. c, ?
1 M0 y& Q2 v- N8 [" C. z4 nclient = OpenAI(
* ?& V# X3 s: L _6 T base_url = "https://integrate.api.nvidia.com/v1",) q- W1 l* B, n+ m1 B
api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC" o& @0 _# M. r2 _
)
0 ^6 z) m9 z/ c
: `, ` ~" X8 v8 u' h1 q) qcompletion = client.chat.completions.create(
9 \6 P! A: U) Q7 \8 Z3 N model="deepseek-ai/deepseek-r1",
9 }2 n4 U) m, {7 d messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],
+ t x! O" ]* R temperature=0.6,
* Y# F# z, ~( i5 I* N( y top_p=0.7,( P) C+ v$ @: m9 S4 ], n9 e
max_tokens=4096,
& h- j. b, M. d2 _+ P" i1 T6 L9 V stream=True/ q- p% z6 ]& F
)
% f& ~ h' W5 J: X" e
& i7 G2 u+ Z2 d- v1 }! M1 k) \8 f% {for chunk in completion:
+ x; l; ]. y5 y3 V# X- i if chunk.choices[0].delta.content is not None:
- a+ j$ ?/ C h print(chunk.choices[0].delta.content, end="")
" T, Z7 C) t8 y7 K2 b
' h6 `# t. _# W* y- y================( a Z1 ?& z# k. O9 G9 q& r9 z
Chat Deepseek
% r6 J5 r1 J; K0 Q$ a* L================
1 R4 ^: B9 A4 A) N) X! k8 l) l! D- {/ t5 B, c, l! X2 Q) g" i
Which number is larger, 9.11 or 9.8?
3 D: i+ f! y- a; p/ X5 ?* Z3 p' C- y( R7 |
To determine which number is larger between 9.11 and 9.8, let's compare them step by step.
: q/ B$ p1 B8 C- x& J
0 a) F6 b5 C8 t0 f Compare the Whole Number Parts:
# `/ G6 e, m" u: \0 g7 D6 S9 n' ?- Y, q1 |4 Y: g
Both numbers have the same whole number part: 9.
2 q% Z { n0 w3 c; f
) C. C* o0 X& x- @3 D* W Compare the Decimal Parts:
5 L1 ^6 T1 e8 u
! w! h3 T$ ~1 E' ]7 {, r! c 9.11 has a decimal part of 0.11.$ Z9 W* o$ \ p9 V6 c2 S0 C
) R* s* M. [6 a" S# N; ?# U
9.8 can be written as 9.80 to have the same number of decimal places.5 R+ o& b0 X% Q& M, Y
+ @6 ^" O/ R2 c8 H; A
Now, compare 0.11 and 0.80:# x4 q& I5 {4 x' `9 ]% Q
9 t$ E4 N/ |6 r! C+ y; y% E
0.80 is greater than 0.11.7 s$ i0 Y1 ~, h' r: L' _
( H* |1 m# K4 P) J5 {7 U+ `$ ? Conclusion:
7 ^9 a; t, J- d5 E3 G% E( S+ [
5 M% G8 Q. U+ \: B7 ~ w! @$ C4 U Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
5 g! H$ ?! x7 p2 G. r5 Z9 W
* ?& [7 d, f! s' o; x3 N% O9.8 is larger
& V# [. X a- w) R7 V. ?5 m7 l( ~' L$ [" x
================( f, |( o1 G. D3 d5 y/ ?& o
Chat OpenAI, Reason. o" \9 R( P$ ]
================
- @# j$ b- G+ C- e$ y2 z
# |8 S$ c9 h, j! YTo determine which number is larger, we compare the two numbers digit by digit:4 l5 P4 j7 i8 e
$ \5 u2 E. j% T# a; A B. k5 a1. Both numbers have the same whole number part (9).4 O# P! s& W; ~& t0 Y$ \( e
2. Next, look at the decimal parts:
" l" V# P7 f5 I4 ` - For 9.11, the tenths digit is 1., {, J. n; p. Y( o9 X5 u. {3 Q
- For 9.8, the tenths digit is 8 (which can be thought of as 9.80).
/ Z9 K X: ^1 f$ w2 q! a2 v! k$ w3. Since 8 is greater than 1, 9.8 is larger than 9.11.( U- ]7 ?7 f) u( ^9 C1 H
, N6 Z# V G! X0 E. w+ oTherefore, **9.8 is larger than 9.11**.
8 _# K& r" r; ? |
评分
-
查看全部评分
|