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
chenpangpang
open-webui
Commits
69083b64
Commit
69083b64
authored
Jul 15, 2024
by
Timothy J. Baek
Browse files
revert
parent
feba1f2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
backend/apps/rag/utils.py
backend/apps/rag/utils.py
+3
-6
No files found.
backend/apps/rag/utils.py
View file @
69083b64
...
@@ -326,25 +326,22 @@ def get_model_path(model: str, update_model: bool = False):
...
@@ -326,25 +326,22 @@ def get_model_path(model: str, update_model: bool = False):
local_files_only
=
not
update_model
local_files_only
=
not
update_model
local_model_path
=
os
.
path
.
join
(
cache_dir
,
model
)
snapshot_kwargs
=
{
snapshot_kwargs
=
{
"cache_dir"
:
cache_dir
,
"cache_dir"
:
cache_dir
,
"local_files_only"
:
local_files_only
,
"local_files_only"
:
local_files_only
,
}
}
log
.
debug
(
f
"model:
{
model
}
"
)
log
.
debug
(
f
"model:
{
model
}
"
)
log
.
debug
(
f
"local_model_path:
{
local_model_path
}
"
)
log
.
debug
(
f
"snapshot_kwargs:
{
snapshot_kwargs
}
"
)
log
.
debug
(
f
"snapshot_kwargs:
{
snapshot_kwargs
}
"
)
# Inspiration from upstream sentence_transformers
# Inspiration from upstream sentence_transformers
if
(
if
(
os
.
path
.
exists
(
local_model_path
)
os
.
path
.
exists
(
model
)
or
(
"
\\
"
in
model
or
model
.
count
(
"/"
)
>
1
)
or
(
"
\\
"
in
model
or
model
.
count
(
"/"
)
>
1
)
and
local_files_only
and
local_files_only
):
):
# If fully qualified path exists, return input, else set repo_id
# If fully qualified path exists, return input, else set repo_id
return
local_model_path
return
model
elif
"/"
not
in
model
:
elif
"/"
not
in
model
:
# Set valid repo_id for model short-name
# Set valid repo_id for model short-name
model
=
"sentence-transformers"
+
"/"
+
model
model
=
"sentence-transformers"
+
"/"
+
model
...
@@ -358,7 +355,7 @@ def get_model_path(model: str, update_model: bool = False):
...
@@ -358,7 +355,7 @@ def get_model_path(model: str, update_model: bool = False):
return
model_repo_path
return
model_repo_path
except
Exception
as
e
:
except
Exception
as
e
:
log
.
exception
(
f
"Cannot determine model snapshot path:
{
e
}
"
)
log
.
exception
(
f
"Cannot determine model snapshot path:
{
e
}
"
)
return
local_model_path
return
model
def
generate_openai_embeddings
(
def
generate_openai_embeddings
(
...
...
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