|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑
1 o" c; s+ ~6 `' A5 c7 q7 S6 A: [
' i, P2 U% H+ N================
- `7 S# u9 Y9 SNvidia NIM service, deepseek :
, f) c& _1 l+ n3 z/ L================' c) M; m: H0 h8 S" L, `6 u* O
https://build.nvidia.com/deepseek-ai/deepseek-r1
- V1 W& h$ T( c0 j3 `, l* e$ f# Z( |/ P" c a2 M
# p$ B i; _1 o0 k9 }4 G9 M, N
from openai import OpenAI# g- h. i9 x. Q2 ^/ s
) O# }9 P3 X9 s" f6 Lclient = OpenAI(2 o U4 p* F1 w l( `6 C8 Q
base_url = "https://integrate.api.nvidia.com/v1",
" V) {9 L! K, \9 ^& v) x api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
$ ^6 t, F0 Y6 f9 p G, b)
3 U: |( h7 ~$ e9 b. F4 h4 P( o; q7 A, W6 [
completion = client.chat.completions.create(' s# T1 p# S* q; E' ~
model="deepseek-ai/deepseek-r1",! s) c5 Y1 _% L) ]
messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],8 C- R7 v" ~3 h. Q8 m$ T, Z
temperature=0.6,
6 S# N, s1 h! _# w# D# k top_p=0.7,( q% y. c" K2 L
max_tokens=4096,
6 l; B: q" c4 G stream=True
5 j4 k; g* a) ~4 h)
8 f* _ y/ b# X4 Z! T- T) y" z/ t$ \+ T0 p
for chunk in completion:
1 M) {0 q5 }# ]7 O$ I; ?, G( ` if chunk.choices[0].delta.content is not None:
+ [0 ]8 X4 ~* e) _- m; j% N* d, b ?4 ? print(chunk.choices[0].delta.content, end="")
& n* ]$ V) F2 J$ A
/ r; q! N: \: G( L1 s# ~7 G================3 z$ \5 @, e8 z- Z, q
Chat Deepseek
8 q! t. t2 K: r5 O Z================6 E I9 H2 z* c) I! z6 g
/ e8 o* C& w% o7 @! j5 ]Which number is larger, 9.11 or 9.8?! w* o& I/ @ W# B7 i4 k' U/ Y2 G
f3 T, L3 S4 X# B* J2 X3 _To determine which number is larger between 9.11 and 9.8, let's compare them step by step.. U0 m$ Z$ A/ t' t& i
4 I8 b# A P1 ?" W. b/ F, ~
Compare the Whole Number Parts:
9 s6 u4 m1 h0 X1 x z( D# `
+ Y* ]8 N& J) }) ?/ ~# J+ ~% W5 j, `! u Both numbers have the same whole number part: 9.9 q; K4 g+ m+ _4 B
+ h7 p$ H) U" l
Compare the Decimal Parts:6 W, `5 F+ P" J) P
0 G" P7 D+ b. I6 S( m- K
9.11 has a decimal part of 0.11.: l- `, K* r2 j3 R) U) n- U
: @: a* s- _; }6 O
9.8 can be written as 9.80 to have the same number of decimal places.
% S2 C# ^7 f, ?; b: [: i; y, J' f4 L1 J) b
Now, compare 0.11 and 0.80:8 ~% w' E0 S2 }- A3 J; B- W
( {" g, \0 P2 r. s; n; O) y 0.80 is greater than 0.11.! V! I, j- I0 }4 j1 ?
/ w4 W& S% I. j+ X3 _
Conclusion:
, [& e- y5 h; R2 O' S
! n2 F5 u- T1 h g/ E' s1 {, f/ Q Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
3 ^& z$ Q8 b$ v" d2 Q( E, y
- [( Z0 ^) [2 U, r( E: |9 y9 g9.8 is larger1 s( q) @; z4 ]. k( u. B! T
8 T5 ^, K* p" u8 g( ?0 A
================
3 _7 ]) ~2 Q9 E& ]6 sChat OpenAI, Reason7 v% B! p J) e9 {% N7 X
================1 K0 B* |5 O% I+ c
% e+ x5 j/ y- A5 Z* C) b" CTo determine which number is larger, we compare the two numbers digit by digit:
6 U9 V7 ~8 {6 A% O% j% J" S( j$ m+ ]* ?: ?
1. Both numbers have the same whole number part (9).
7 o v- R3 U. {! M. c$ W2. Next, look at the decimal parts:
) [- {' W) L2 \8 f - For 9.11, the tenths digit is 1.
4 ]+ i% n* h# q - For 9.8, the tenths digit is 8 (which can be thought of as 9.80).
# S: h- O/ a# Z& P' @2 T7 G6 k3. Since 8 is greater than 1, 9.8 is larger than 9.11./ ~) k, }! Q) y% D' O3 Z; C
* |( [0 b+ [, z9 ~Therefore, **9.8 is larger than 9.11**.
; @, ?+ p0 Z$ G+ J7 k- N |
评分
-
查看全部评分
|