|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 * m$ |1 X6 g* ~. L& ?2 z
5 ], q& X7 [+ O. A4 I" @
================
) ]0 }6 d y1 d2 FNvidia NIM service, deepseek :' y: @8 U1 J- ~9 M
================8 r. A# E" ^. G+ @( ]# R
https://build.nvidia.com/deepseek-ai/deepseek-r12 M; Y$ @& o* e9 C" `4 `* H' h, q/ k
! ~# t. K* J; y
4 A0 p- g) Z, ^from openai import OpenAI/ y, J" v" @: N5 c$ [ a
7 G, E- ]& m& L$ h. M. c6 |; \, _* l
client = OpenAI(
2 z2 `: P+ B) E6 J+ z( ~& Y/ b base_url = "https://integrate.api.nvidia.com/v1",
5 B3 r! Y: q8 q& @9 s* V api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
0 S' E5 }' z' m, M x3 {* t)
- G* E4 c+ g9 L. k
/ T) O" L7 ?" S: ^# K9 d3 h9 h/ Ecompletion = client.chat.completions.create(
! I/ P. X! \/ `" L) S+ N: O# i, k8 J model="deepseek-ai/deepseek-r1",% R. Y) J! ^) Y+ y
messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],
; z4 G3 q/ a# n2 }5 u) g1 Q temperature=0.6,5 [6 J) R; V* c6 m& V% ?
top_p=0.7,
( u" C% h- {* D8 b1 C max_tokens=4096,
$ F1 u- V- n5 F6 t* R3 n9 c stream=True
8 n! ?5 R3 H; S! \( A; u)) P. e6 c$ I8 \' T
& g. d$ A3 P8 K# r4 |( R1 lfor chunk in completion:/ t( g- D y- J- v1 w9 ` y8 v& \
if chunk.choices[0].delta.content is not None:
4 _7 M- S, Q' ]# E print(chunk.choices[0].delta.content, end="")
* {- U% H% o+ Z( d" p& R% w' p1 G
# t A5 |: o/ R================$ _/ [/ P. a* \6 ]; f, m* c6 i
Chat Deepseek
# T- Y# Y2 ~4 `- h3 f4 F================
) Y6 m9 P0 T* Y8 v. j& k, |/ J* \2 R, x! I5 w0 w, A: B- `. `
Which number is larger, 9.11 or 9.8?0 Y. |( |% v# H7 U/ a
1 X p. O8 Q' S. `+ D6 h9 X
To determine which number is larger between 9.11 and 9.8, let's compare them step by step.* M Q2 @8 o, V/ `- \
7 R3 e" Q1 L$ A) k' d% M
Compare the Whole Number Parts:
9 H, G& s% Q6 t9 J
* I% Y' G ~# U ? Both numbers have the same whole number part: 9.1 p- J( D( g: n* b% O
9 A: w5 W1 Z* e2 z4 I
Compare the Decimal Parts:
1 r7 Q, q! S( }* {4 F5 _. M& p
. ?" i0 P, Q8 p 9.11 has a decimal part of 0.11.7 V9 _! k7 X# O; h: Y7 H1 v
, a0 L, ?% u: t& `
9.8 can be written as 9.80 to have the same number of decimal places.# X2 z' F6 x- i; s2 t5 I6 F
, L7 [* G+ x9 \1 j* w" s
Now, compare 0.11 and 0.80:
- o2 [& U, N6 D5 T4 i$ a
# Q# b/ G$ W% Y# g& ^ 0.80 is greater than 0.11.
& p g! P! s! P0 t3 o& M
) _6 ~2 X: o9 J Conclusion:. M6 R3 ?' L2 m/ c+ Q* z. K* H9 R
2 A3 s0 A* s1 A
Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.
9 ?2 R. }' C" W! M8 \+ K& t* J$ p1 B8 b) w% f' F
9.8 is larger, g' {; a8 o3 \ W
& X1 i9 V. F$ a, s================
- ]# N, I. t4 H; v6 ~Chat OpenAI, Reason" i8 Y! |/ J/ t
================
1 E' O( T& p# t; G" D1 J; O
/ m2 [ J! `+ D6 d" {) ATo determine which number is larger, we compare the two numbers digit by digit:0 l2 O8 s$ |) r+ m, |, v5 d
8 {7 t5 n; K- G4 O6 I1. Both numbers have the same whole number part (9).; Y" I9 m4 D& p2 i2 O. _# H
2. Next, look at the decimal parts:% Z/ u$ z+ b* I' N8 q
- For 9.11, the tenths digit is 1.
. C H. r8 u- _ - For 9.8, the tenths digit is 8 (which can be thought of as 9.80).) C* i8 Z6 ~+ q3 K( H
3. Since 8 is greater than 1, 9.8 is larger than 9.11.$ h) d+ r6 {& I P' [# [$ d
! y- A; Q$ `- x$ J( B* A! ~, Y2 n7 A; ]Therefore, **9.8 is larger than 9.11**.' a5 v6 O+ e8 K9 B# o
|
评分
-
查看全部评分
|