|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 ' y: L3 {/ g1 P0 {! W' N: M
# M5 h# Q& _+ K! U3 m u5 M================! M& Z) d; p6 e, ~9 |
Nvidia NIM service, deepseek :
, W# S. E: O9 L p! ^' |( w1 K1 p================
, A8 o5 P- H5 }https://build.nvidia.com/deepseek-ai/deepseek-r1! ^2 m/ E/ W( W, v% v) X- q$ o! M
3 ?' q* r4 ]4 ?. p
5 G9 P6 [$ V( @0 @1 zfrom openai import OpenAI
) ]1 G8 S$ D9 Y8 S- ?) H: J
: E1 A4 S, i. |9 R+ w3 Hclient = OpenAI(* W' N. G" P- R
base_url = "https://integrate.api.nvidia.com/v1",+ e: s, e. _% ~- A
api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"5 D: D6 H# @7 p( a
)
& x9 f. p6 ]! S9 d( t: E# p5 L1 s3 @. u
completion = client.chat.completions.create(/ w0 Q* V& \. X( t
model="deepseek-ai/deepseek-r1",
' h! f# e& |: v3 J messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],
9 L3 n8 C4 {5 J% D M: V$ Z temperature=0.6,8 f2 W; A- D* [# d& D9 P
top_p=0.7,/ H' ~: r9 g6 ?% e5 z. d
max_tokens=4096,, N( V& R: |; F0 s& D( `& e
stream=True7 Z' F/ ]- ]- t- M/ S# X8 I7 e/ K L
)
' S2 r- {4 _2 C& _1 B- p" g! {7 e% n: F! M: Q( s, q" m
for chunk in completion:
. m+ X, q* c9 v7 i if chunk.choices[0].delta.content is not None:
6 _' M, p$ E' M+ u r4 H; r print(chunk.choices[0].delta.content, end="")0 b# y* h# K- Z# |
3 z1 Z5 y+ E, Q. F
================
1 o% x3 q5 v5 k MChat Deepseek
: ]: L0 V( V! [' S a- \$ ?================
, {1 [" @% l) ^: b) z5 |" a) c" b) I* l& Y) c4 Q/ C( h$ k- n9 d
Which number is larger, 9.11 or 9.8?: \; I! i T y0 m' R$ K8 Q ?; Q' C8 H+ j0 B
! s% l1 n; C* M+ a! z* d3 U, B: i0 F9 VTo determine which number is larger between 9.11 and 9.8, let's compare them step by step.8 l% t% L( j/ V' S8 }
) @ k& B* x5 k+ ^# j |/ S2 \
Compare the Whole Number Parts:* ]" f( u' ?8 ^6 I) C
' ~9 I/ ]5 c, P
Both numbers have the same whole number part: 9.
2 `0 e6 P* M( X) i4 d( {7 P! V, L, h1 x6 b9 a2 l2 J$ n
Compare the Decimal Parts:
\- O3 ~" e: J8 d+ { [
7 N$ z8 P( j" Q2 T 9.11 has a decimal part of 0.11.% O8 U2 Y, t: q4 _: C9 i3 ]. s
: l' g& U) b5 Z: e& |6 \* y 9.8 can be written as 9.80 to have the same number of decimal places.
8 Y% D2 S; ?( X, i( K% w
+ u! E! [9 J5 |9 ]5 P' u Now, compare 0.11 and 0.80:
/ P- y6 @# D1 u, J0 U: _" |) j( p; }: y1 ?* C' m
0.80 is greater than 0.11.
* E- F/ h& b$ w: v$ y- v4 O Y+ T6 }' f( T
Conclusion:3 X8 a7 g9 e; J3 W1 G" \
' Q2 |5 s! f3 G r Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
; @9 n+ {! l1 Y7 B7 e) r) T/ H
/ D/ {% x( K0 S1 r9.8 is larger
8 F" X3 ] [- f2 A; O2 K' ]9 a5 C
================
, s% z0 j: Z" g( J# n( u/ Z9 FChat OpenAI, Reason4 l' e. e7 z4 F/ A
================7 S c6 }# [; T3 K
# [ c0 h7 O1 W# s. m6 xTo determine which number is larger, we compare the two numbers digit by digit:, ^0 r. R8 A t7 v! Z, {" `' {
$ D% ^4 R- q$ t5 M% W9 s: A1. Both numbers have the same whole number part (9).
& T7 f! _6 c$ D1 l" t2. Next, look at the decimal parts:
! O9 ?$ l1 f: V% j- G, R4 w - For 9.11, the tenths digit is 1.0 Y, d, x+ ~. P# d% ~8 O4 w
- For 9.8, the tenths digit is 8 (which can be thought of as 9.80).6 t; K2 ]6 r& C5 F: C% m, O
3. Since 8 is greater than 1, 9.8 is larger than 9.11.9 r2 ?* t8 b# O
, q2 c0 _/ A- \Therefore, **9.8 is larger than 9.11**.
) p: Q, K" y! x- F0 e0 [( [ |
评分
-
查看全部评分
|