Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinilm
Commits
fabfa2e2
"include/git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "1d53731f2c210557caab5660dbe2c578dce6114f"
Commit
fabfa2e2
authored
Jun 04, 2025
by
Pan Zezhong
Browse files
use int64 for random sample
parent
b0010cbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
src/models/jiuge/jiuge.cpp
src/models/jiuge/jiuge.cpp
+5
-4
No files found.
src/models/jiuge/jiuge.cpp
View file @
fabfa2e2
...
...
@@ -135,8 +135,9 @@ void inferDeviceBatch(const JiugeMeta &meta, DeviceResource &rsrc,
auto
gate_up_buf
=
Tensor
::
buffer
(
dt_logits
,
{
ntok
,
2
*
di
},
stream
);
auto
o_buf
=
Tensor
::
buffer
(
dt_logits
,
{
ntok
,
nh
*
dh
},
stream
);
auto
prob_buf
=
Tensor
::
buffer
(
dt_logits
,
{
nreq
,
dvoc
},
stream
);
auto
result_buf
=
Tensor
::
buffer
(
INFINI_DTYPE_U32
,
{
nreq
},
stream
);
auto
result_cpu
=
std
::
vector
<
uint32_t
>
(
nreq
);
auto
result_buf
=
Tensor
::
buffer
(
INFINI_DTYPE_I64
,
{
nreq
},
stream
);
auto
result_cpu
=
std
::
vector
<
int64_t
>
(
nreq
);
// Prepare inputs
auto
batch_pos_ids
=
std
::
vector
<
uint32_t
>
(
ntok
);
size_t
req_start
=
0
;
...
...
@@ -270,7 +271,7 @@ void inferDeviceBatch(const JiugeMeta &meta, DeviceResource &rsrc,
infiniopRandomSampleDescriptor_t
desc_sample
;
RUN_INFINI
(
infiniopCreateRandomSampleDescriptor
(
rsrc
.
handle
,
&
desc_sample
,
TensorDesc
::
create
(
INFINI_DTYPE_
U32
,
{},
{})
->
get
(),
TensorDesc
::
create
(
INFINI_DTYPE_
I64
,
{},
{})
->
get
(),
TensorDesc
::
create
(
dt_logits
,
{
dvoc
},
{
1
})
->
get
()));
RUN_INFINI
(
infiniopGetRandomSampleWorkspaceSize
(
desc_sample
,
&
temp_size
));
workspace_size
=
std
::
max
(
workspace_size
,
temp_size
);
...
...
@@ -398,7 +399,7 @@ void inferDeviceBatch(const JiugeMeta &meta, DeviceResource &rsrc,
}
RUN_INFINI
(
infinirtStreamSynchronize
(
stream
));
RUN_INFINI
(
infinirtMemcpy
(
result_cpu
.
data
(),
result_buf
->
data
(),
sizeof
(
u
int
32
_t
)
*
nreq
,
INFINIRT_MEMCPY_D2H
));
sizeof
(
int
64
_t
)
*
nreq
,
INFINIRT_MEMCPY_D2H
));
for
(
uint32_t
req
=
0
;
req
<
nreq
;
req
++
)
{
ans
[
req
]
=
result_cpu
[
req
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment