Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove debugPetOnlyMode and forceAll debug scaffolding

Amrithesh Kakkoth Enteb30a0181cfaa
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
index 3314810b7b..21fb090788 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
@@ -50,7 +50,6 @@ class MLService {
bool get showClusteringIsHappening => _clusteringIsHappening;
bool debugIndexingDisabled = false;
- bool debugPetOnlyMode = false;
bool _clusteringIsHappening = false;
bool _mlControllerStatus = false;
bool _isIndexingOrClusteringRunning = false;
@@ -273,11 +272,7 @@ class MLService {
await MLIndexingIsolate.instance.ensureDownloadedModels();
}
final Stream<List<FileMLInstruction>> instructionStream =
- fetchEmbeddingsAndInstructions(
- fileDownloadMlLimit,
- mode: mode,
- forceAll: debugPetOnlyMode,
- );
+ fetchEmbeddingsAndInstructions(fileDownloadMlLimit, mode: mode);
int fileAnalyzedCount = 0;
final Stopwatch stopwatch = Stopwatch()..start();
@@ -541,12 +536,6 @@ class MLService {
Future<bool> processImage(FileMLInstruction instruction) async {
bool actuallyRanML = false;
- // In pet-only mode, skip faces and clip to only run pet recognition
- if (debugPetOnlyMode) {
- instruction.shouldRunFaces = false;
- instruction.shouldRunClip = false;
- }
-
final mlDataDB = _dbForMode(instruction.mode);
try {
final String filePath = await getImagePathForML(instruction.file);
diff --git a/mobile/apps/photos/lib/services/machine_learning/semantic_search/semantic_search_service.dart b/mobile/apps/photos/lib/services/machine_learning/semantic_search/semantic_search_service.dart
index 49f3f35c8b..9a4c6be837 100644
--- a/mobile/apps/photos/lib/services/machine_learning/semantic_search/semantic_search_service.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/semantic_search/semantic_search_service.dart
@@ -17,7 +17,6 @@ import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/services/machine_learning/ml_computer.dart";
import "package:photos/services/machine_learning/ml_result.dart";
-import "package:photos/services/machine_learning/ml_service.dart";
import "package:photos/services/machine_learning/semantic_search/clip/clip_image_encoder.dart";
import "package:photos/services/machine_learning/semantic_search/query_result.dart";
import "package:photos/services/search_service.dart";
@@ -328,10 +327,6 @@ class SemanticSearchService {
}
Future<void> _loadTextModel({bool delay = false}) async {
- if (MLService.instance.debugPetOnlyMode) {
- _logger.info("Skipping ClipText load (debugPetOnlyMode)");
- return;
- }
_logger.info("Initializing ClipText");
try {
if (delay) await Future.delayed(const Duration(seconds: 5));
diff --git a/mobile/apps/photos/lib/utils/ml_util.dart b/mobile/apps/photos/lib/utils/ml_util.dart
index ade612d5d8..922656ea8a 100644
--- a/mobile/apps/photos/lib/utils/ml_util.dart
+++ b/mobile/apps/photos/lib/utils/ml_util.dart
@@ -96,9 +96,7 @@ Future<IndexStatus> getIndexStatus() async {
int _lastFetchTimeForOthersIndexed = 0;
/// Return a list of file instructions for files that should be indexed for ML
-Future<List<FileMLInstruction>> getFilesForMlIndexing({
- bool forceAll = false,
-}) async {
+Future<List<FileMLInstruction>> getFilesForMlIndexing() async {
_logger.info('getFilesForMlIndexing called');
final mlDataDB = MLDataDB.instance;
final time = DateTime.now();
@@ -130,9 +128,9 @@ Future<List<FileMLInstruction>> getFilesForMlIndexing({
}
queuedFiledIDs.add(enteFile.uploadedFileID!);
- final shouldRunFaces = forceAll ||
+ final shouldRunFaces =
_shouldRunIndexing(enteFile, faceIndexedFileIDs, faceMlVersion);
- final shouldRunClip = forceAll ||
+ final shouldRunClip =
_shouldRunIndexing(enteFile, clipIndexedFileIDs, clipMlVersion);
if (!shouldRunFaces && !shouldRunClip) {
continue;
@@ -160,9 +158,9 @@ Future<List<FileMLInstruction>> getFilesForMlIndexing({
continue;
}
queuedFiledIDs.add(enteFile.uploadedFileID!);
- final shouldRunFaces = forceAll ||
+ final shouldRunFaces =
_shouldRunIndexing(enteFile, faceIndexedFileIDs, faceMlVersion);
- final shouldRunClip = forceAll ||
+ final shouldRunClip =
_shouldRunIndexing(enteFile, clipIndexedFileIDs, clipMlVersion);
if (!shouldRunFaces && !shouldRunClip) {
continue;
@@ -206,9 +204,7 @@ Future<List<FileMLInstruction>> getFilesForMlIndexing({
return [...splitResult.matched, ...splitResult.unmatched];
}
-Future<List<FileMLInstruction>> getOfflineFilesForMlIndexing({
- bool forceAll = false,
-}) async {
+Future<List<FileMLInstruction>> getOfflineFilesForMlIndexing() async {
_logger.info('getOfflineFilesForMlIndexing called');
final mlDataDB = MLDataDB.offlineInstance;
final Map<int, int> faceIndexedFileIDs = await mlDataDB.faceIndexedFileIds();
@@ -247,18 +243,16 @@ Future<List<FileMLInstruction>> getOfflineFilesForMlIndexing({
continue;
}
queuedFileIDs.add(localIntId);
- final shouldRunFaces = forceAll ||
- _shouldRunIndexingWithFileId(
- localIntId,
- faceIndexedFileIDs,
- faceMlVersion,
- );
- final shouldRunClip = forceAll ||
- _shouldRunIndexingWithFileId(
- localIntId,
- clipIndexedFileIDs,
- clipMlVersion,
- );
+ final shouldRunFaces = _shouldRunIndexingWithFileId(
+ localIntId,
+ faceIndexedFileIDs,
+ faceMlVersion,
+ );
+ final shouldRunClip = _shouldRunIndexingWithFileId(
+ localIntId,
+ clipIndexedFileIDs,
+ clipMlVersion,
+ );
if (!shouldRunFaces && !shouldRunClip) {
continue;
}
@@ -281,12 +275,10 @@ Future<List<FileMLInstruction>> getOfflineFilesForMlIndexing({
Stream<List<FileMLInstruction>> fetchEmbeddingsAndInstructions(
int yieldSize, {
required MLMode mode,
- bool forceAll = false,
}) async* {
- if (mode == MLMode.offline || forceAll) {
- final List<FileMLInstruction> filesToIndex = mode == MLMode.offline
- ? await getOfflineFilesForMlIndexing(forceAll: forceAll)
- : await getFilesForMlIndexing(forceAll: forceAll);
+ if (mode == MLMode.offline) {
+ final List<FileMLInstruction> filesToIndex =
+ await getOfflineFilesForMlIndexing();
final List<List<FileMLInstruction>> chunks = filesToIndex.chunks(yieldSize);
for (final batch in chunks) {
yield batch;