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
infinicore
Commits
c973b0b9
Commit
c973b0b9
authored
Dec 01, 2025
by
Ceng23333
Committed by
thatPepe
Dec 01, 2025
Browse files
issue/691: 修复InfiniLM依赖问题
Signed-off-by:
Ceng23333
<
441651826@qq.com
>
parent
1c25a902
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
src/infinicore/pybind11/ops/rope.hpp
src/infinicore/pybind11/ops/rope.hpp
+5
-0
src/infinicore/tensor/copy.cc
src/infinicore/tensor/copy.cc
+1
-15
No files found.
src/infinicore/pybind11/ops/rope.hpp
View file @
c973b0b9
...
...
@@ -9,6 +9,11 @@ namespace py = pybind11;
namespace
infinicore
::
ops
{
inline
void
bind_rope
(
py
::
module
&
m
)
{
py
::
enum_
<
infinicore
::
nn
::
RoPE
::
Algo
>
(
m
,
"RoPEAlgo"
)
.
value
(
"GPT_J"
,
infinicore
::
nn
::
RoPE
::
Algo
::
GPT_J
)
.
value
(
"GPT_NEOX"
,
infinicore
::
nn
::
RoPE
::
Algo
::
GPT_NEOX
);
m
.
def
(
"rope"
,
&
op
::
rope
,
py
::
arg
(
"x"
),
...
...
src/infinicore/tensor/copy.cc
View file @
c973b0b9
...
...
@@ -22,21 +22,7 @@ void TensorImpl::copy_from(Tensor src) {
throw
std
::
runtime_error
(
"Cannot copy from tensor with different shape"
);
}
if
(
this
->
device
()
==
src
->
device
())
{
// If both tensors are contiguous, use direct memcpy (much faster and avoids rearrange issues)
if
(
this
->
is_contiguous
()
&&
src
->
is_contiguous
())
{
// Use nbytes() to get the actual tensor size
size_t
copy_size
=
std
::
min
(
this
->
nbytes
(),
src
->
nbytes
());
// For CPU-to-CPU copies, use regular memcpy. For device-to-device, use D2D memcpy
if
(
this
->
device
().
getType
()
==
Device
::
Type
::
CPU
)
{
context
::
memcpyH2H
(
this
->
data
(),
src
->
data
(),
copy_size
);
}
else
{
context
::
memcpyD2D
(
this
->
data
(),
src
->
data
(),
copy_size
);
}
}
else
{
op
::
rearrange_
(
Tensor
(
const_cast
<
TensorImpl
*>
(
this
)
->
shared_from_this
()),
src
);
}
}
else
{
if
(
!
src
->
is_contiguous
())
{
src
=
src
->
contiguous
();
...
...
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