@@ -2972,7 +2972,7 @@ Add the following function in the module App.Image:
2972
2972
2973
2973
{:ok , %GenMagic .Result {} = res} ->
2974
2974
require Logger
2975
- Logger .warning (%{ gen_magic_response: res} )
2975
+ Logger .warning (" ⚠️ MIME type error: #{ inspect ( res) } " )
2976
2976
{:error , " Not acceptable." }
2977
2977
end
2978
2978
end
@@ -3074,7 +3074,7 @@ def handle_progress(:image_list, entry, socket) when entry.done? do
3074
3074
# Otherwise, if there was an error uploading the image, we log the error and show it to the person.
3075
3075
else
3076
3076
%{error: reason} ->
3077
- Logger .info ( " Error uploading image. #{ inspect (reason)} " )
3077
+ Logger .warning ( " ⚠️ Error uploading image. #{ inspect (reason)} " )
3078
3078
{:noreply , push_event (socket, " toast" , %{message: " Image couldn't be uploaded to S3.\n #{ reason } " })}
3079
3079
3080
3080
_ ->
@@ -3616,7 +3616,7 @@ def check_models_on_startup do
3616
3616
App .Models .verify_and_download_models ()
3617
3617
|> case do
3618
3618
{:error , msg} ->
3619
- Logger .warning ( msg)
3619
+ Logger .error ( " ⚠️ #{ msg } " )
3620
3620
System .stop (0 )
3621
3621
3622
3622
:ok ->
@@ -3908,7 +3908,7 @@ defmodule App.Models do
3908
3908
# It will load the model and the respective the featurizer, tokenizer and generation config if needed,
3909
3909
# and return a map with all of these at the end.
3910
3910
defp load_offline_model (model) do
3911
- Logger .info (" Loading #{ model.name } ..." )
3911
+ Logger .info (" ℹ️ Loading #{ model.name } ..." )
3912
3912
3913
3913
# Loading model
3914
3914
loading_settings = {:hf , model.name, cache_dir: model.cache_path, offline: true }
@@ -3957,7 +3957,7 @@ defmodule App.Models do
3957
3957
# Downloads the models according to a given %ModelInfo struct.
3958
3958
# It will load the model and the respective the featurizer, tokenizer and generation config if needed.
3959
3959
defp download_model (model) do
3960
- Logger .info (" Downloading #{ model.name } ..." )
3960
+ Logger .info (" ℹ️ Downloading #{ model.name } ..." )
3961
3961
3962
3962
# Download model
3963
3963
downloading_settings = {:hf , model.name, cache_dir: model.cache_path}
@@ -3999,7 +3999,7 @@ defmodule App.Models do
3999
3999
end
4000
4000
else
4001
4001
_ ->
4002
- Logger . info ( " No dowlnoad " )
4002
+ # No download
4003
4003
:ok
4004
4004
end
4005
4005
end
@@ -4189,7 +4189,7 @@ defmodule App.KnnIndex do
4189
4189
4190
4190
# If the index file does exist, we compare the one with teh table and check for incoherences.
4191
4191
true ->
4192
- Logger .info (" Index file found on disk. Let's compare it with the database..." )
4192
+ Logger .info (" ℹ️ Index file found on disk. Let's compare it with the database..." )
4193
4193
4194
4194
App .Repo .get_by (App .HnswlibIndex , id: 1 )
4195
4195
|> case do
@@ -4214,7 +4214,7 @@ defmodule App.KnnIndex do
4214
4214
HNSWLib .Index .get_current_count (index),
4215
4215
true <-
4216
4216
index_count == db_count do
4217
- Logger .info (" Integrity: " <> " \u 2705. " )
4217
+ Logger .info (" ℹ️ Integrity: ✅ " )
4218
4218
{:ok , {index, schema, space}}
4219
4219
4220
4220
# If it fails, we return an error.
@@ -4224,7 +4224,7 @@ defmodule App.KnnIndex do
4224
4224
{:error , " Integrity error. The count of images from index differs from the database." }}
4225
4225
4226
4226
{:error , msg} ->
4227
- Logger .warning ( inspect ( msg) )
4227
+ Logger .error ( " ⚠️ #{ msg } " )
4228
4228
{:stop , {:error , msg}}
4229
4229
end
4230
4230
end
@@ -4260,7 +4260,7 @@ defmodule App.KnnIndex do
4260
4260
HNSWLib .Index .get_current_count (index),
4261
4261
:ok <-
4262
4262
HNSWLib .Index .save_index (index, @saved_index ) do
4263
- Logger . info ( " idx: #{ idx } " )
4263
+
4264
4264
{:reply , {:ok , idx}, state}
4265
4265
else
4266
4266
{:error , msg} ->
@@ -4275,8 +4275,7 @@ defmodule App.KnnIndex do
4275
4275
def handle_call ({:knn_search , input}, _ , {index, _ , _ } = state) do
4276
4276
# We search for the nearest neighbors of the input embedding.
4277
4277
case HNSWLib .Index .knn_query (index, input, k: 1 ) do
4278
- {:ok , labels, distances} ->
4279
- Logger .info (inspect (distances))
4278
+ {:ok , labels, _distances } ->
4280
4279
4281
4280
response =
4282
4281
labels[0 ]
@@ -4297,7 +4296,7 @@ defmodule App.KnnIndex do
4297
4296
def handle_call (:not_empty , _ , {index, _ , _ } = state) do
4298
4297
case HNSWLib .Index .get_current_count (index) do
4299
4298
{:ok , 0 } ->
4300
- Logger .warning (" Empty index." )
4299
+ Logger .warning (" ⚠️ Empty index." )
4301
4300
{:reply , :error , state}
4302
4301
4303
4302
{:ok , _ } ->
@@ -4388,20 +4387,20 @@ defmodule App.HnswlibIndex do
4388
4387
|> case do
4389
4388
# If the table is empty
4390
4389
nil ->
4391
- Logger .info (" No index file found in DB. Creating new one..." )
4390
+ Logger .info (" ℹ️ No index file found in DB. Creating new one..." )
4392
4391
create (space, dim, max_elements)
4393
4392
4394
4393
# If the table is not empty but has no file
4395
4394
response when response.file == nil - >
4396
- Logger .info (" Empty index file in DB. Recreating one..." )
4395
+ Logger .info (" ℹ️ Empty index file in DB. Recreating one..." )
4397
4396
4398
4397
# Purge the table and create a new file row in it
4399
4398
App .Repo .delete_all (App .HnswlibIndex )
4400
4399
create (space, dim, max_elements)
4401
4400
4402
4401
# If the table is not empty and has a file
4403
4402
index_db ->
4404
- Logger .info (" Index file found in DB. Loading it..." )
4403
+ Logger .info (" ℹ️ Index file found in DB. Loading it..." )
4405
4404
4406
4405
# We get the path of the index
4407
4406
with path <- App .KnnIndex .index_path (),
@@ -4575,11 +4574,11 @@ defmodule App.Application do
4575
4574
App .Models .verify_and_download_models ()
4576
4575
|> case do
4577
4576
{:error , msg} ->
4578
- Logger .warning ( msg)
4577
+ Logger .error ( " ⚠️ #{ msg } " )
4579
4578
System .stop (0 )
4580
4579
4581
4580
:ok ->
4582
- Logger .info (" Models: " <> " \u 2705 " )
4581
+ Logger .info (" ℹ️ Models: ✅ " )
4583
4582
:ok
4584
4583
end
4585
4584
end
@@ -5030,8 +5029,6 @@ def handle_info({ref, %{chunks: [%{text: text}]} = result}, %{assigns: assigns}
5030
5029
)}
5031
5030
# record without entries
5032
5031
{:not_empty_index , :error } ->
5033
- Logger .debug (" No entries in Index" )
5034
-
5035
5032
{:noreply ,
5036
5033
assign (socket,
5037
5034
mic_off?: false ,
@@ -5362,7 +5359,7 @@ def handle_progress(:image_list, entry, socket) when entry.done? do
5362
5359
5363
5360
# Otherwise, if there was an error uploading the image, we log the error and show it to the person.
5364
5361
%{error: errors} ->
5365
- Logger .warning (" Error uploading image. #{ inspect (errors)} " )
5362
+ Logger .warning (" ⚠️ Error uploading image. #{ inspect (errors)} " )
5366
5363
{:noreply , push_event (socket, " toast" , %{message: " Image couldn't be uploaded to S3" })}
5367
5364
end
5368
5365
end
@@ -5436,13 +5433,13 @@ def handle_upload({:ok, %{path: path, tensor: tensor, image_info: image_info} =
5436
5433
5437
5434
# If S3 upload fails, we return error
5438
5435
{:error , reason} ->
5439
- Logger .warning (" Error uploading image: #{ inspect (reason)} " )
5436
+ Logger .warning (" ⚠️ Error uploading image: #{ inspect (reason)} " )
5440
5437
{:postpone , %{error: " Bucket error" }}
5441
5438
end
5442
5439
end
5443
5440
5444
5441
def handle_upload ({:error , error}) do
5445
- Logger .warning (" Error creating partial image: #{ inspect (error)} " )
5442
+ Logger .warning (" ⚠️ Error creating partial image: #{ inspect (error)} " )
5446
5443
{:postpone , %{error: " Error creating partial image" }}
5447
5444
end
5448
5445
```
0 commit comments