Skip to content

Commit

Permalink
Merge pull request janhq#6 from janhq/add_inference_sd_cpp
Browse files Browse the repository at this point in the history
Add inference sd cpp
  • Loading branch information
hiro-v authored Aug 24, 2023
2 parents 6446f06 + e345a44 commit 8204f64
Show file tree
Hide file tree
Showing 58 changed files with 14,065 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
KEYCLOAK_VERSION=22.0.0
POSTGRES_DB_NAME=your_db_name
POSTGRES_PASSWORD=your_db_pw
POSTGRES_USERNAME=your_db_username
POSTGRES_PORT=your_db_port
KC_DB_SCHEMA=public
KEYCLOAK_ADMIN=your_keycloak_admin_username
KEYCLOAK_ADMIN_PASSWORD=your_keycloak_admin_password

# Inference
## LLM
MODEL_URL=https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/resolve/main/llama-2-7b-chat.ggmlv3.q4_1.bin
LLM_MODEL_FILE=$(basename $MODEL_URL)

## SD
MODEL_URL=https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
SD_MODEL_FILE=$(basename $MODEL_URL)
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.vscode
.env

# Jan inference
jan-inference/llm/models/**
jan-inference/llm/.env
jan-inference/llm/.env

jan-inference/sd/models/**
jan-inference/sd/output/**
jan-inference/sd/.env
jan-inference/sd/sd
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "jan-inference/sd/sd_cpp"]
path = jan-inference/sd/sd_cpp
url = https://github.com/leejet/stable-diffusion.cpp
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
newadr:
@echo "Initiating an ADR..."
@read -p "Enter ADR number (e.g. 001): " number; \
read -p "Enter ADR title: " title; \
cp $(CURDIR)/adr/adr-template.md $(CURDIR)/adr/adr-$${number}-$${title}.md
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ Jan is a monorepo that pulls in the following submodules

```shell
├── docker-compose.yml
├── jan-mobile
├── jan-web
├── jan-backend
├── jan-inference
├── jan-docs
├── adrs # Architecture Decision Records
├── mobile-client
├── web-client
├── app-backend
├── inference-backend
├── docs # Developer Docs
├── adrs # Architecture Decision Records
```

18 changes: 18 additions & 0 deletions adr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Architectural Decision Records (ADR)

This is a repo of key architecture decisions for Jan. [Read more about ADRs](https://github.com/joelparkerhenderson/architecture-decision-record)


### Get started:

```sh
# In root:
make newadr
```

### Template:
- **Status**: `pending`, `approved`, or `rejected`
- **Context**: a clearly defined problem/goal
- **Decisions**: the proposed architecture choices & changes
- **Consequences**: pros and cons of the decision
- **References**: any relevant materials to read
24 changes: 24 additions & 0 deletions adr/adr-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ADR {ADR-NUM}: {TITLE}

## Changelog
- {date}: {changelog}

## Status

What is the status, such as proposed, accepted, rejected, deprecated, superseded, etc.?

{Proposed|Accepted|Rejected}

## Context

What is the issue that we're seeing that is motivating this decision or change?

## Decision

What is the change that we're proposing and/or doing?

## Consequences

What becomes easier or more difficult to do because of this change?

## Reference
63 changes: 63 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# docker version
version: "3"

volumes:
keycloak_postgres_data:

services:
keycloak:
image: quay.io/keycloak/keycloak:${KEYCLOAK_VERSION-22.0.0}
command: start-dev
environment:
KC_DB: postgres
KC_DB_URL_HOST: keycloak_postgres
KC_DB_URL_DATABASE: ${POSTGRES_DB_NAME:-keycloak}
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
KC_DB_USERNAME: ${POSTGRES_USERNAME:-postgres}
KC_DB_SCHEMA: ${KC_DB_SCHEMA:-public}
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin}
ports:
- "8080:8080"
depends_on:
keycloak_postgres:
condition: service_healthy
networks:
jan_community:

keycloak_postgres:
image: postgres:13
command: postgres -c 'max_connections=200' && postgres -c 'shared_buffers=24MB'
environment:
# Environment Variables expecially for Postgres
POSTGRES_DB: ${POSTGRES_DB_NAME:-keycloak}
POSTGRES_USER: ${POSTGRES_USERNAME:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
PGDATA: /data/postgres
PGPORT: ${POSTGRES_PORT:-5432}
healthcheck:
test: "exit 0"
volumes:
- keycloak_postgres_data:/data/postgres
ports:
- ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}
networks:
jan_community:

keycloak_config_cli:
image: adorsys/keycloak-config-cli:latest
depends_on:
- keycloak
volumes:
- ./conf/keycloak_conf:/config
environment:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_USER: ${KEYCLOAK_ADMIN-admin}
KEYCLOAK_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin}
KEYCLOAK_AVAILABILITYCHECK_ENABLED: 'true'
KEYCLOAK_AVAILABILITYCHECK_TIMEOUT: 120s
IMPORT_FILES_LOCATIONS: '/config/*'
DEBUG: 'true'

networks:
jan_community:
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
4 changes: 4 additions & 0 deletions docs/docs/about/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
sidebar_position: 1
title: Overview
---
5 changes: 5 additions & 0 deletions docs/docs/about/company/01-story.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Story
---

TODO: a month by month recap
3 changes: 3 additions & 0 deletions docs/docs/about/company/02-team.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Team
---
7 changes: 7 additions & 0 deletions docs/docs/about/company/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Company",
"position": 2,
"link": {
"type": "generated-index"
}
}
3 changes: 3 additions & 0 deletions docs/docs/about/handbook/01-how-we-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: How We Work
---
3 changes: 3 additions & 0 deletions docs/docs/about/handbook/02-team-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Team Structure
---
7 changes: 7 additions & 0 deletions docs/docs/about/handbook/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Handbook",
"position": 5,
"link": {
"type": "generated-index"
}
}
7 changes: 7 additions & 0 deletions docs/docs/about/roadmap/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Roadmap",
"position": 4,
"link": {
"type": "generated-index"
}
}
3 changes: 3 additions & 0 deletions docs/docs/about/roadmap/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Roadmap
---
4 changes: 4 additions & 0 deletions docs/docs/about/strategy/01-mission-and-vision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Mission & Vision
---

4 changes: 4 additions & 0 deletions docs/docs/about/strategy/02-customer-persona.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Customer Persona
---

3 changes: 3 additions & 0 deletions docs/docs/about/strategy/03-business-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Business Model
---
3 changes: 3 additions & 0 deletions docs/docs/about/strategy/04-brand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Brand
---
3 changes: 3 additions & 0 deletions docs/docs/about/strategy/05-okrs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: OKRs
---
7 changes: 7 additions & 0 deletions docs/docs/about/strategy/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Strategy",
"position": 3,
"link": {
"type": "generated-index"
}
}
6 changes: 6 additions & 0 deletions docs/docs/changelog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 1
---

# Changelog
TODO
6 changes: 6 additions & 0 deletions docs/docs/developer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 1
---

# Developer
TODO
7 changes: 7 additions & 0 deletions docs/docs/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 1
slug: /
---

# Getting Started
Hi there
6 changes: 6 additions & 0 deletions docs/docs/guides/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 1
---

# Guides
TODO
6 changes: 6 additions & 0 deletions docs/docs/reference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 1
---

# Reference
TODO
Loading

0 comments on commit 8204f64

Please sign in to comment.