|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 ! n8 C u2 x% l( P( r
/ K# o2 O, e0 K5 ^9 H
================6 T2 o- |$ I" c8 Y( A7 c
Nvidia NIM service, deepseek :: {7 R3 b* k+ s
================
4 V6 t- `( Z8 e z' b5 [; }https://build.nvidia.com/deepseek-ai/deepseek-r1 R$ V+ a$ E3 L% @. R5 G% I' K. w
0 q& ]4 ?# L* k0 w! g5 `7 Z0 b0 N
from openai import OpenAI6 R0 L' J; s8 S6 q0 g
0 g7 O! ]+ C7 H+ I3 a6 Q) c5 Y5 h! M# }
client = OpenAI(
: ]! Z0 x/ c3 B. D! [! C( ]' t base_url = "https://integrate.api.nvidia.com/v1",
" H+ a& Y* ~4 j api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"* @: ]) e. L- f) w6 \1 b
)
. c* t; n! d' ?- l9 o* K( `$ Q; E( U+ D" J/ h8 ~
completion = client.chat.completions.create(
) j3 [# J( L2 _+ }3 e model="deepseek-ai/deepseek-r1",
1 e( s( w, A7 \; A; |# r messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],
! m w# M$ i) V: @ temperature=0.6,
3 T, q! y, g/ W' F1 f a8 g4 W top_p=0.7,( o3 j2 N, k9 M1 U8 b9 c- B% O+ n
max_tokens=4096,
4 ?5 E1 V7 i3 Y9 O stream=True5 b( t6 \1 y7 p0 F
)
. C1 T) t& K6 ^9 n6 e
* L H0 M% o3 [; b* V. \2 tfor chunk in completion:9 o6 a5 L2 o: h3 ?" R$ M8 U
if chunk.choices[0].delta.content is not None:
$ P. x$ a0 r. `, z3 }8 A print(chunk.choices[0].delta.content, end="")* X7 x0 } Z2 h7 h6 h# D, o) K
" j; V# b6 h2 _$ e1 k9 v6 k0 P================
@2 Q" g! N' {; @2 t7 PChat Deepseek
. {% ?2 _( i2 C1 ~9 {2 l" \, `================
% i+ L1 ?- _) |6 _, w; D, E: J( a5 u" F$ C6 B# {
Which number is larger, 9.11 or 9.8?
, g. g6 q" G: o1 Z' y* L/ P" ~- p L# }, |8 o. z
To determine which number is larger between 9.11 and 9.8, let's compare them step by step.
: n1 A7 J2 j9 q" T# Q( B. u2 a2 n; a0 N9 m: I
Compare the Whole Number Parts:" ?& d$ d9 L( Y4 W2 [
8 Z4 N" k9 o' P
Both numbers have the same whole number part: 9.
7 `- n, [! B, _' g8 `
4 Y6 X, v. w" i2 q8 g# d2 J Compare the Decimal Parts:
3 F" O. @& g; M8 H; m8 b& c' L% {# S
9.11 has a decimal part of 0.11.
: G1 U" r H- }: y; Q6 e5 Q4 u& I* L# A* n' F0 L5 r) u! o1 W% E
9.8 can be written as 9.80 to have the same number of decimal places.
# }7 V6 ~) O) W" }. C1 j2 I; N5 r9 ^
Now, compare 0.11 and 0.80:
+ w2 l# s1 |$ j5 G: c `
2 r( K, L k: N4 M+ \# D 0.80 is greater than 0.11.
/ N: d% R' Q- _) G/ p% L3 Z7 x+ q2 R) ?( v4 i- d' C$ J; g
Conclusion:
% M/ \, Y. w4 W. M3 k) d( W! l4 r2 p/ `3 R6 m9 c9 v
Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
7 z/ d5 S3 A Y) z8 Q! k3 P2 W, B& \) {, @4 u
9.8 is larger
4 I0 k( \$ d, H$ F% A& K
" x' M. U0 `2 i! s/ f( V$ m5 _================, D+ L$ K+ O: B1 ]
Chat OpenAI, Reason8 z( l7 T" @3 L3 ?8 l0 _) f
================6 E! B% w: G j8 V3 J3 i8 J$ K$ {
3 h/ b7 ]$ j+ G1 ~" d" y: |8 T
To determine which number is larger, we compare the two numbers digit by digit:7 K4 x) _. `, T& V; S( |" t& c
% ?/ |, j" O* z$ c; M% ?, h5 x9 v8 A
1. Both numbers have the same whole number part (9)./ J# p, Y5 z1 ]3 l5 g, @# ?
2. Next, look at the decimal parts:; T8 q; e; E3 ~/ x
- For 9.11, the tenths digit is 1.
! \8 a0 { g' [, o+ s - For 9.8, the tenths digit is 8 (which can be thought of as 9.80).5 X, Q) ] j |9 e- w" B9 i5 I" j
3. Since 8 is greater than 1, 9.8 is larger than 9.11.
4 g* n% {, [5 m
3 g0 i8 ~! M* k+ c/ q; y4 mTherefore, **9.8 is larger than 9.11**.
- X9 `) s- Q H8 p* z0 {3 c: V R |
评分
-
查看全部评分
|