Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tutorial-llm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
nomad-lab
ai-toolkit
tutorial-llm
Commits
553b38bb
Commit
553b38bb
authored
2 months ago
by
Adam Fekete
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
41eb070a
Branches
Branches containing commit
No related tags found
1 merge request
!4
Saturn adam
Pipeline
#265709
failed
2 months ago
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-9
1 addition, 9 deletions
.gitlab-ci.yml
api_writer/fast_app.py
+14
-14
14 additions, 14 deletions
api_writer/fast_app.py
api_writer/test_ui.py
+6
-17
6 additions, 17 deletions
api_writer/test_ui.py
with
21 additions
and
40 deletions
.gitlab-ci.yml
+
1
−
9
View file @
553b38bb
...
@@ -22,21 +22,13 @@ stages:
...
@@ -22,21 +22,13 @@ stages:
image
:
image
:
name
:
gcr.io/kaniko-project/executor:debug
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
entrypoint
:
[
"
"
]
variables
:
IMAGE_TAG
:
latest
GIT_SUBMODULE_STRATEGY
:
recursive
GIT_SUBMODULE_DEPTH
:
1
GIT_SUBMODULE_UPDATE_FLAGS
:
--jobs
4
before_script
:
before_script
:
-
echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
-
echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
build
:
extends
:
.build
script
:
script
:
-
/kaniko/executor
-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}
/jupyter
:${DOCKER_TAG}"
--destination "${CI_REGISTRY_IMAGE}:${DOCKER_TAG}"
rules
:
rules
:
-
changes
:
-
changes
:
-
${CI_PROJECT_DIR}/Dockerfile
-
${CI_PROJECT_DIR}/Dockerfile
...
...
This diff is collapsed.
Click to expand it.
api_writer/fast_app.py
+
14
−
14
View file @
553b38bb
import
gradio
as
gr
#
import gradio as gr
from
fastapi
import
FastAPI
#
from fastapi import FastAPI
from
api_writer.test_ui
import
demo
#
from api_writer.test_ui import demo
#
#
api
=
FastAPI
()
#
api = FastAPI()
#
#
@api.get
(
"
/
"
)
#
@api.get("/")
def
read_main
():
#
def read_main():
return
{
"
message
"
:
"
This is your main app
"
}
#
return {"message": "This is your main app"}
#
#
app
=
gr
.
mount_gradio_app
(
api
,
demo
,
path
=
"
/staging/llm-tutorial
"
)
#
app = gr.mount_gradio_app(api, demo, path="/staging/llm-tutorial")
This diff is collapsed.
Click to expand it.
api_writer/test_ui.py
+
6
−
17
View file @
553b38bb
...
@@ -6,16 +6,14 @@ import pandas as pd
...
@@ -6,16 +6,14 @@ import pandas as pd
from
copy
import
deepcopy
from
copy
import
deepcopy
from
opik
import
track
,
opik_context
from
opik
import
track
,
opik_context
from
api_writer.nomad_api
import
make_query
from
api_writer.nomad_api
import
make_query
from
api_writer.utils
import
add_values
,
check_keys
,
load_query
,
load_config
from
api_writer.utils
import
check_keys
,
load_query
,
load_config
if
os
.
getenv
[
"
USE_VLLM_API
"
]:
if
os
.
getenv
[
"
USE_VLLM_API
"
]:
from
api_writer.vllm_api
import
http_bot
from
api_writer.vllm_api
import
http_bot
else
:
else
:
from
api_writer.vllm_model
import
http_bot
from
api_writer.vllm_model
import
http_bot
search_link_url
=
"
https://nomad-lab.eu/prod/v1/gui/search/entries/entry/id/
"
print
(
"
Caching context...
"
)
http_bot
(
"
warmup
"
)
# try:
# try:
# os.environ["OPIK_API_KEY"]
# os.environ["OPIK_API_KEY"]
...
@@ -24,22 +22,13 @@ http_bot("warmup")
...
@@ -24,22 +22,13 @@ http_bot("warmup")
os
.
environ
[
"
OPIK_WORKSPACE
"
]
=
"
pilar12
"
os
.
environ
[
"
OPIK_WORKSPACE
"
]
=
"
pilar12
"
n
=
2
search_link_url
=
"
https://nomad-lab.eu/prod/v1/gui/search/entries/entry/id/
"
project_name
=
os
.
getenv
(
"
OPIK_PROJECT_NAME
"
,
"
NOMAD_Demo_test_ui
"
)
project_name
=
os
.
getenv
(
"
OPIK_PROJECT_NAME
"
,
"
NOMAD_Demo_test_ui
"
)
sampling_params
=
load_config
(
"
api_writer/sampling_params_2.yaml
"
)
sampling_params
=
load_config
(
"
api_writer/sampling_params_2.yaml
"
)
n
=
2
print
(
"
Caching context...
"
)
http_bot
(
"
warmup
"
)
def
format_num_response
(
response
):
response
=
response
[
response
.
index
(
"
JSON
"
)
+
5
:]
values
=
response
[
response
.
index
(
"'''"
)
+
3
:].
strip
().
split
(
"
\n
"
)
base_json
=
response
[:
response
.
index
(
"'''"
)].
strip
()
if
values
!=
[
""
]:
response
=
add_values
(
base_json
,
values
)
else
:
return
base_json
return
response
def
process_api_output
(
api_output
:
dict
)
->
pd
.
DataFrame
:
def
process_api_output
(
api_output
:
dict
)
->
pd
.
DataFrame
:
...
...
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