|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 7 z8 v* ?7 K& a8 P9 u7 n3 f* \% U4 j
* {+ S+ b$ p* A, H================
$ d7 q' j1 P' V( n$ r# `- JNvidia NIM service, deepseek :) y0 p1 E i# L9 B S$ L" i
================, {: k) i5 Z/ m4 k2 M
https://build.nvidia.com/deepseek-ai/deepseek-r1+ e- E7 e+ O, T4 G3 H3 W9 N
O$ w" M* p& \
) @( c, e5 y, X. V( I% Qfrom openai import OpenAI
1 F# K. B+ T6 h3 C* L U4 L7 Z$ t% X& T& G3 ?( z, n8 b: u: g4 u
client = OpenAI(
( y) D, Z3 O3 v# Q9 r( L! i3 S: ~ base_url = "https://integrate.api.nvidia.com/v1",
1 V5 Z0 ~, U9 t" ?% T, \ api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
( ~- v- K3 ^* T; A# Z, T% k" ~) k, g! h* D7 F- L' \! N
3 Q1 |( W! ]6 S2 M: V3 _
completion = client.chat.completions.create(. L1 p6 S! W7 z) ?# a
model="deepseek-ai/deepseek-r1",
5 h& ]$ {$ ^5 }3 O messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],
% R# n- x1 p. M3 n$ t' n4 q temperature=0.6,' t5 d0 s1 F8 J3 n }
top_p=0.7,
& V( l+ f/ Q5 d max_tokens=4096,
6 J* {. N! Q9 v# ^, l stream=True
! A, z4 F& L& \)
" B9 e) ^( G6 P, O1 u
, R/ ?* j& K c4 d4 Y5 Bfor chunk in completion:
7 i4 q4 r5 t0 {% R; R if chunk.choices[0].delta.content is not None:
7 T9 X }7 y5 } print(chunk.choices[0].delta.content, end="")( z' R8 P+ h2 G+ [$ A! A# K
; U c$ d+ v( |" O! B================/ k/ Q3 a# G: e6 x6 A
Chat Deepseek6 S9 ]5 F5 t, ]7 l
================
; P U3 ~( B. _2 {" d# }* ]
. G8 h+ q$ O; y2 X6 X- H* `: d% ZWhich number is larger, 9.11 or 9.8?
6 p- G9 M1 h: Y$ R8 |* M) d6 `7 j& \! B5 T+ r
To determine which number is larger between 9.11 and 9.8, let's compare them step by step.5 m% D3 Z/ D! u
^! F; b: U. l, z
Compare the Whole Number Parts:$ D, i6 {! z' a& c3 m& B1 z
0 w+ m3 f; m ^& w3 G3 h' S0 H Both numbers have the same whole number part: 9.0 f! m- B9 L) Z( R* V" X% }; |1 F
% D( H t" w& {5 N Compare the Decimal Parts:
+ o9 L2 u. Z! m) J6 V n( s
% ] P# W& C7 v( { 9.11 has a decimal part of 0.11.
! \( o. n- a3 m1 U" O' X9 w W
% X7 v; H9 d# D2 q: m, r- r 9.8 can be written as 9.80 to have the same number of decimal places.
- U6 {& O4 A! Y$ ], U
" }. N; d; w' Y: _. ? Now, compare 0.11 and 0.80:6 z8 W6 g1 c5 Q6 ~2 L; M
9 U6 c9 P* w6 O3 v0 v0 S: N
0.80 is greater than 0.11.
5 L1 G) {3 _! A. @$ G* Y- ]7 n( M3 h, u+ ^
Conclusion:. L0 o! t) K# c' |1 _
. ^9 G3 V \4 Z. g: [7 I5 X; s# F
Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
1 |0 a. n8 V9 I3 n7 K- [1 O+ ]8 l% d1 H8 r
9.8 is larger
/ i/ k0 ^, K6 q/ ^5 M
! p4 R3 ]: V6 i6 N3 O================
! K2 B! l: c$ e9 V7 c {, AChat OpenAI, Reason
, [+ x. }7 n5 W================
4 E. v% H# n5 Z, v
k# f5 d, W, j1 z3 z1 oTo determine which number is larger, we compare the two numbers digit by digit:
+ i; T) i2 T3 k" `: ], Z4 [
" a% X5 T6 D( n; y7 S" {1. Both numbers have the same whole number part (9).
6 F8 ~7 n- i/ x' Y; p3 Z* U2 j% ]2 P3 I2. Next, look at the decimal parts:# b: `, V- b; I, K' T3 `( n
- For 9.11, the tenths digit is 1.
/ `6 i. p6 a; H$ u3 R, a - For 9.8, the tenths digit is 8 (which can be thought of as 9.80).' Y: R2 {. x; U
3. Since 8 is greater than 1, 9.8 is larger than 9.11.! V: s6 q W* k7 X) \+ O% F
3 s- b2 `) l* X& O2 |- o
Therefore, **9.8 is larger than 9.11**.
" e, Q7 i0 o2 D- G H; w4 i |
评分
-
查看全部评分
|