|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 , X6 n! C6 ^5 x1 _& P3 N
6 e" e$ E; V. X) H2 @; b# g" G, }================) f/ @) D, c2 l
Nvidia NIM service, deepseek :
$ {4 o ~- q, O/ M. U* ~3 N/ J================8 \2 c; o( w1 {5 ~- {% A
https://build.nvidia.com/deepseek-ai/deepseek-r1
' Z$ Q( B2 [9 H+ ~) U5 q
; N5 q3 F2 k6 |1 ^3 l& [, \0 b
# a4 e3 F; {# d; Q$ k1 Hfrom openai import OpenAI) I& z/ }, ]: L! a: y
$ c+ G& o* X. \9 N qclient = OpenAI(" P, @1 w+ A) c9 ?
base_url = "https://integrate.api.nvidia.com/v1",
6 u% \- ^" D9 S1 ~ api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
4 Q8 j: \- o/ s9 I)0 @0 P3 g0 X7 M
3 e( p7 g0 F' C9 k# C! {completion = client.chat.completions.create(
$ i) H9 {- r: R; d, h$ V model="deepseek-ai/deepseek-r1",& e8 s- b- P2 I; g& g0 [
messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}]," c, o: Z+ H- t* g, j0 Y5 o* Q
temperature=0.6,; @0 B) L$ Y5 X4 C5 C
top_p=0.7,
F# D# ?6 B) I/ U max_tokens=4096,
3 D) W" [; n2 L8 T6 Y- y& k$ } stream=True/ K9 m3 x$ k9 C8 R" N
)
% H2 d/ R9 W) o3 E9 a8 W# R7 C3 s- D( L8 R! k- `
for chunk in completion:
$ h( G( M8 ^* V! ] if chunk.choices[0].delta.content is not None:0 Y) X: ~) N8 e& `) ?
print(chunk.choices[0].delta.content, end="")
% Y2 s* D- l4 }8 S( @- W& S% h! h ?% l! R2 l5 v
================
) R/ D/ l! [& ?' NChat Deepseek
3 n3 l6 t4 M8 D9 S0 n. E================. y8 `" Q3 M# i. s# D, \, v
( j% j, @7 M, r" ?
Which number is larger, 9.11 or 9.8?& `% Q. L8 u: x9 Z5 S
; d1 I- F: V7 m2 o9 A1 i6 NTo determine which number is larger between 9.11 and 9.8, let's compare them step by step.
5 S8 x- r* H- g, T$ }0 {, y+ d, Y8 H: i1 t4 x
Compare the Whole Number Parts:
+ X# ?0 | M L! K$ f- s9 X2 P% r
6 n! r- Z9 E$ R Both numbers have the same whole number part: 9.
9 G8 V1 j0 @9 P9 {5 F2 H) p, c
# P: H J" r) V Compare the Decimal Parts:
( C' P. I N4 ]4 r
$ V1 w, \) c& Q, N 9.11 has a decimal part of 0.11.) B5 D9 l" G' s
: l1 I& q8 d. W! Z; I
9.8 can be written as 9.80 to have the same number of decimal places.
" {' {1 @" d6 U
" w, M: O1 j, B Now, compare 0.11 and 0.80:9 Z( ?5 A$ s Y* N
9 G/ Q; U3 W: P. ~- {' e( O
0.80 is greater than 0.11.( M4 q) f8 }' C8 u M, a& n" m
7 s/ G5 R, ~% _5 _4 E1 k+ D. h
Conclusion:
+ r; b$ w) d- \ {& `$ A" K0 [& t9 H+ t& T
Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger.% s8 H- d4 g! g: n4 z9 v: m- A
5 `, r" w9 ]; J# v1 C j9.8 is larger: M9 d, x$ }4 h3 w" I, X" ]
' N2 A( u( H7 Q) J3 K
================1 `) L2 j5 j) p5 y$ ^
Chat OpenAI, Reason9 ~% F% ]; I. \6 k! Q
================+ C/ y* B- v- d# X
- F7 m+ j: Q1 O$ J
To determine which number is larger, we compare the two numbers digit by digit:9 S8 Q. I5 Y4 ]4 g" T% O* j
1 d% e0 ~0 h+ z0 g6 z
1. Both numbers have the same whole number part (9).
4 |9 P6 N6 Q1 M; F, V# |2 i% Q+ y+ s2. Next, look at the decimal parts:& O5 |* U: w& a/ W: Y
- For 9.11, the tenths digit is 1.
; v2 o2 C% Q# `/ r; } - For 9.8, the tenths digit is 8 (which can be thought of as 9.80).
. u5 j0 K3 S$ E- G3 G! I8 ?- c3. Since 8 is greater than 1, 9.8 is larger than 9.11., k* x0 s- C8 Y( z) a' ^
1 Q8 ~! ^3 ~4 }# r, @" I$ iTherefore, **9.8 is larger than 9.11**.3 x: _: E7 J5 {. G8 B1 B
|
评分
-
查看全部评分
|