Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
336
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
23
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
68208786
Unverified
Commit
68208786
authored
2 months ago
by
anatawa12
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: unable to use AiService on arm64 (#15261)
parent
b1616018
No related branches found
No related tags found
2 merge requests
!927
2025.2.2
,
!886
Merge upstream 2025.2.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
packages/backend/src/core/AiService.ts
+18
-3
18 additions, 3 deletions
packages/backend/src/core/AiService.ts
with
19 additions
and
3 deletions
CHANGELOG.md
+
1
−
0
View file @
68208786
...
...
@@ -36,6 +36,7 @@
-
Fix: disableClustering設定時の初期化ロジックを調整( #15223 )
-
Fix: ActivityPubリクエストかどうかの判定が正しくない問題を修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/869)
-
Fix: AIセンシティブ判定が arm64 環境で動作しない問題を修正
## 2024.11.0
...
...
This diff is collapsed.
Click to expand it.
packages/backend/src/core/AiService.ts
+
18
−
3
View file @
68208786
...
...
@@ -15,7 +15,7 @@ import { bindThis } from '@/decorators.js';
const
_filename
=
fileURLToPath
(
import
.
meta
.
url
);
const
_dirname
=
dirname
(
_filename
);
const
REQUIRED_CPU_FLAGS
=
[
'
avx2
'
,
'
fma
'
];
const
REQUIRED_CPU_FLAGS
_X64
=
[
'
avx2
'
,
'
fma
'
];
let
isSupportedCpu
:
undefined
|
boolean
=
undefined
;
@
Injectable
()
...
...
@@ -31,8 +31,7 @@ export class AiService {
public
async
detectSensitive
(
path
:
string
):
Promise
<
nsfw
.
predictionType
[]
|
null
>
{
try
{
if
(
isSupportedCpu
===
undefined
)
{
const
cpuFlags
=
await
this
.
getCpuFlags
();
isSupportedCpu
=
REQUIRED_CPU_FLAGS
.
every
(
required
=>
cpuFlags
.
includes
(
required
));
isSupportedCpu
=
await
this
.
computeIsSupportedCpu
();
}
if
(
!
isSupportedCpu
)
{
...
...
@@ -64,6 +63,22 @@ export class AiService {
}
}
private
async
computeIsSupportedCpu
():
Promise
<
boolean
>
{
switch
(
process
.
arch
)
{
case
'
x64
'
:
{
const
cpuFlags
=
await
this
.
getCpuFlags
();
return
REQUIRED_CPU_FLAGS_X64
.
every
(
required
=>
cpuFlags
.
includes
(
required
));
}
case
'
arm64
'
:
{
// As far as I know, no required CPU flags for ARM64.
return
true
;
}
default
:
{
return
false
;
}
}
}
@
bindThis
private
async
getCpuFlags
():
Promise
<
string
[]
>
{
const
str
=
await
si
.
cpuFlags
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment