Skip to content

Commit ab03878

Browse files
committed
Make fine-tune and chat eval feature Podman ready
Signed-off-by: Anil Vishnoi <[email protected]>
1 parent eed416e commit ab03878

File tree

11 files changed

+201
-152
lines changed

11 files changed

+201
-152
lines changed

api-server/handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ func (srv *ILabServer) serveModelHandler(modelPath, port string, w http.Response
807807
}
808808

809809
cmdArgs := []string{
810-
"serve", "model",
811-
"--model", modelPath,
810+
"serve",
811+
"--model-path", modelPath,
812812
"--host", "0.0.0.0",
813813
"--port", port,
814814
}

deploy/podman/native/instructlab-ui.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ spec:
120120
secretKeyRef:
121121
name: ui-env
122122
key: IL_ENABLE_DEV_MODE
123+
- name: NEXT_PUBLIC_API_SERVER
124+
valueFrom:
125+
secretKeyRef:
126+
name: ui-env
127+
key: NEXT_PUBLIC_API_SERVER
123128
ports:
124129
- containerPort: 3000
125130
hostPort: 3000

deploy/podman/native/secret.yaml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ data:
88
NEXT_PUBLIC_TAXONOMY_ROOT_DIR: <TAXONOMY_ROOT_DIR>
99
NEXTAUTH_URL: <AUTH_URL>
1010
NEXTAUTH_SECRET: <AUTH_SECRET>
11+
NEXT_PUBLIC_API_SERVER: <API_SERVER_URL>
12+
1113
kind: Secret
1214
metadata:
1315
creationTimestamp: null

installers/podman/ilab-ui-native-installer.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ declare AUTH_SECRET="your_super_secret_random_string"
1717
declare DEV_MODE="false"
1818
declare EXPERIMENTAL_FEATURES=""
1919
declare PYENV_DIR=""
20+
declare API_SERVER_URL=""
2021

2122
BINARY_INSTALL_DIR=./
2223
IS_ILAB_INSTALLED="true"
@@ -350,6 +351,8 @@ if [[ "$COMMAND" == "install" ]]; then
350351
EXPERIMENTAL_FEATURES_B64=$(echo -n "false" | base64)
351352
fi
352353

354+
API_SERVER_URL_B64=$(echo -n "$API_SERVER_URL" | base64)
355+
353356
# Download secret.yaml file
354357
echo -e "${green}Downloading the secret.yaml sample file...${reset}\n"
355358
curl -o secret.yaml https://raw.githubusercontent.com/instructlab/ui/main/deploy/podman/native/secret.yaml.example
@@ -370,6 +373,7 @@ if [[ "$COMMAND" == "install" ]]; then
370373
sed -i "" "s|<AUTH_SECRET>|$AUTH_SECRET_B64|g" secret.yaml
371374
sed -i "" "s|<DEV_MODE>|$DEV_MODE_B64|g" secret.yaml
372375
sed -i "" "s|<EXPERIMENTAL_FEATURES>|$EXPERIMENTAL_FEATURES_B64|g" secret.yaml
376+
sed -i "" "s|<API_SERVER_URL>|$API_SERVER_URL_B64|g" secret.yaml
373377
else
374378
sed -i "s|<UI_DEPLOYMENT>|$UI_DEPLOYMENT_B64|g" secret.yaml
375379
sed -i "s|<USERNAME>|$USERNAME_B64|g" secret.yaml
@@ -379,6 +383,7 @@ if [[ "$COMMAND" == "install" ]]; then
379383
sed -i "s|<AUTH_SECRET>|$AUTH_SECRET_B64|g" secret.yaml
380384
sed -i "s|<DEV_MODE>|$DEV_MODE_B64|g" secret.yaml
381385
sed -i "s|<EXPERIMENTAL_FEATURES>|$EXPERIMENTAL_FEATURES_B64|g" secret.yaml
386+
sed -i "s|<API_SERVER_URL>|$API_SERVER_URL_B64|g" secret.yaml
382387
fi
383388

384389
if [[ "$IS_ILAB_INSTALLED" == "true" ]]; then
@@ -420,7 +425,7 @@ if [[ "$COMMAND" == "install" ]]; then
420425
# Check if VARIANT_ID is "rhel_ai"
421426
if [ "$VARIANT_ID" == "rhel_ai" ]; then
422427
echo -e "${green}Starting API server on OS: RHEL AI running on arch $ARCH ${reset}\n"
423-
nohup ./ilab-apiserver --taxonomy-path "$SELECTED_TAXONOMY_DIR" --rhelai "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
428+
nohup ./ilab-apiserver --taxonomy-path "$SELECTED_TAXONOMY_DIR" --rhelai --vllm "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
424429
else
425430
echo -e "${green}Starting API server on OS: $OS running on arch $ARCH ${reset}\n"
426431
nohup ./ilab-apiserver --base-dir "$DISCOVERED_PYENV_DIR" --taxonomy-path "$SELECTED_TAXONOMY_DIR" "$CUDA_FLAG" >$ILAB_APISERVER_LOG_FILE 2>&1 &
@@ -479,7 +484,7 @@ elif [[ "$COMMAND" == "uninstall" ]]; then
479484

480485
read -r -p "Are you sure you want to uninstall the InstructLab UI stack? (yes/no): " CONFIRM
481486
if [[ "$CONFIRM" != "yes" && "$CONFIRM" != "y" ]]; then
482-
echo -e "${green}Uninstallation aborted.${reset}\n"
487+
echo -e "${red}Uninstallation aborted.${reset}\n"
483488
exit 0
484489
fi
485490

src/app/api/envConfig/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export async function GET() {
1818
ENABLE_DEV_MODE: process.env.IL_ENABLE_DEV_MODE || 'false',
1919
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || '',
2020
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '',
21-
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO: process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs'
21+
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO:
22+
process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs',
23+
API_SERVER: process.env.NEXT_PUBLIC_API_SERVER
2224
};
2325

2426
return NextResponse.json(envConfig);

src/app/api/fine-tune/git/branches/route.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import fs from 'fs';
55
import path from 'path';
66

77
const REMOTE_TAXONOMY_ROOT_DIR = process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '';
8+
const REMOTE_TAXONOMY_REPO_CONTAINER_MOUNT_DIR = '/tmp/.instructlab-ui';
89

910
export async function GET() {
10-
const REPO_DIR = path.join(REMOTE_TAXONOMY_ROOT_DIR, '/taxonomy');
11+
const REPO_DIR = findTaxonomyRepoPath();
1112
try {
1213
console.log(`Checking local taxonomy directory for branches: ${REPO_DIR}`);
1314

@@ -63,3 +64,28 @@ export async function GET() {
6364
return NextResponse.json({ error: 'Failed to list branches from local taxonomy (fine-tune)' }, { status: 500 });
6465
}
6566
}
67+
68+
function findTaxonomyRepoPath(): string {
69+
let remoteTaxonomyRepoDirFinal: string = '';
70+
71+
const remoteTaxonomyRepoContainerMountDir = path.join(REMOTE_TAXONOMY_REPO_CONTAINER_MOUNT_DIR, '/taxonomy');
72+
const remoteTaxonomyRepoDir = path.join(REMOTE_TAXONOMY_ROOT_DIR, '/taxonomy');
73+
74+
// Check if there is taxonomy repository mounted in the container
75+
if (fs.existsSync(remoteTaxonomyRepoContainerMountDir) && fs.readdirSync(remoteTaxonomyRepoContainerMountDir).length !== 0) {
76+
remoteTaxonomyRepoDirFinal = remoteTaxonomyRepoContainerMountDir;
77+
console.log('Remote taxonomy repository ', remoteTaxonomyRepoDir, ' is mounted at:', remoteTaxonomyRepoDirFinal);
78+
} else {
79+
// If remote taxonomy is not mounted, it means it's local deployment and we can directly use the paths
80+
if (fs.existsSync(remoteTaxonomyRepoDir) && fs.readdirSync(remoteTaxonomyRepoDir).length !== 0) {
81+
remoteTaxonomyRepoDirFinal = remoteTaxonomyRepoDir;
82+
}
83+
}
84+
if (remoteTaxonomyRepoDirFinal === '') {
85+
console.warn('Remote taxonomy repository path does not exist.');
86+
return remoteTaxonomyRepoDirFinal;
87+
}
88+
89+
console.log('Remote taxonomy repository path:', remoteTaxonomyRepoDirFinal);
90+
return remoteTaxonomyRepoDirFinal;
91+
}

src/app/api/github/knowledge-files/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from 'next/server';
33
import { getToken } from 'next-auth/jwt';
44

55
const GITHUB_API_URL = 'https://api.github.com';
6-
const TAXONOMY_DOCUMENTS_REPO = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs';
6+
const TAXONOMY_DOCUMENTS_REPO = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs';
77
const BASE_BRANCH = 'main';
88

99
// Interface for the response

src/app/api/native/git/knowledge-files/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import http from 'isomorphic-git/http/node';
1010
// Constants for repository paths
1111
const TAXONOMY_DOCS_ROOT_DIR = process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '';
1212
const TAXONOMY_DOCS_CONTAINER_MOUNT_DIR = '/tmp/.instructlab-ui';
13-
const TAXONOMY_KNOWLEDGE_DOCS_REPO_URL = process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs';
13+
const TAXONOMY_KNOWLEDGE_DOCS_REPO_URL =
14+
process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'https://github.com/instructlab-public/taxonomy-knowledge-docs';
1415
const BASE_BRANCH = 'main';
1516

1617
// Interface for the response
@@ -223,10 +224,10 @@ async function cloneTaxonomyDocsRepo() {
223224
const taxonomyDocsDirectoryPath = path.join(remoteTaxonomyRepoDirFinal, '/taxonomy-knowledge-docs');
224225

225226
if (fs.existsSync(taxonomyDocsDirectoryPath)) {
226-
console.log(`Using existing taxonomy knowledge docs repository at ${remoteTaxonomyRepoDir}/taxonomy-knowledge-docs.`);
227+
console.log(`Using existing taxonomy knowledge docs repository at ${TAXONOMY_DOCS_ROOT_DIR}/taxonomy-knowledge-docs.`);
227228
return taxonomyDocsDirectoryPath;
228229
} else {
229-
console.log(`Taxonomy knowledge docs repository not found at ${taxonomyDocsDirectoryPath}. Cloning...`);
230+
console.log(`Taxonomy knowledge docs repository not found at ${TAXONOMY_DOCS_ROOT_DIR}/taxonomy-knowledge-docs. Cloning...`);
230231
}
231232

232233
try {

src/app/api/playground/chat/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function POST(req: NextRequest) {
2222

2323
const requestData = {
2424
model: modelName,
25-
messages,
25+
messages: messages,
2626
stream: true
2727
};
2828

src/components/Contribute/Knowledge/Native/DocumentInformation/DocumentInformation.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ const DocumentInformation: React.FC<Props> = ({
141141
if (response.status === 201) {
142142
const result = await response.json();
143143
console.log('Files uploaded result:', result);
144+
setKnowledgeDocumentRepositoryUrl(result.repoUrl);
145+
setKnowledgeDocumentCommit(result.commitSha);
146+
setDocumentName(result.documentNames.join(', ')); // Populate the patterns field
144147

145148
const alertInfo: AlertInfo = {
146149
type: 'success',

0 commit comments

Comments
 (0)