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
wangsen
MinerU
Commits
2785f604
Commit
2785f604
authored
Jun 17, 2025
by
myhloli
Browse files
fix: support NPU device in UnimernetModel initialization
parent
3cdcd76c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
mineru/model/mfr/unimernet/Unimernet.py
mineru/model/mfr/unimernet/Unimernet.py
+1
-1
No files found.
mineru/model/mfr/unimernet/Unimernet.py
View file @
2785f604
...
@@ -21,7 +21,7 @@ class MathDataset(Dataset):
...
@@ -21,7 +21,7 @@ class MathDataset(Dataset):
class
UnimernetModel
(
object
):
class
UnimernetModel
(
object
):
def
__init__
(
self
,
weight_dir
,
_device_
=
"cpu"
):
def
__init__
(
self
,
weight_dir
,
_device_
=
"cpu"
):
from
.unimernet_hf
import
UnimernetModel
from
.unimernet_hf
import
UnimernetModel
if
_device_
.
startswith
(
"mps"
):
if
_device_
.
startswith
(
"mps"
)
or
_device_
.
startswith
(
"npu"
)
:
self
.
model
=
UnimernetModel
.
from_pretrained
(
weight_dir
,
attn_implementation
=
"eager"
)
self
.
model
=
UnimernetModel
.
from_pretrained
(
weight_dir
,
attn_implementation
=
"eager"
)
else
:
else
:
self
.
model
=
UnimernetModel
.
from_pretrained
(
weight_dir
)
self
.
model
=
UnimernetModel
.
from_pretrained
(
weight_dir
)
...
...
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