Upload 2 files
Browse files- app.py +3 -1
- joycaption_alpha_two_cli_mod.ipynb +45 -0
app.py
CHANGED
@@ -14,15 +14,17 @@ from typing import List, Union
|
|
14 |
import torchvision.transforms.functional as TVF
|
15 |
from peft import PeftModel
|
16 |
import gc
|
|
|
|
|
17 |
|
18 |
# Constants
|
19 |
IMAGE_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
20 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
21 |
BASE_DIR = Path(__file__).resolve().parent # Define the base directory
|
|
|
22 |
CLIP_PATH = "google/siglip-so400m-patch14-384"
|
23 |
DEFAULT_MODEL_PATH = "unsloth/Meta-Llama-3.1-8B-bnb-4bit"
|
24 |
#DEFAULT_MODEL_PATH = "Orenguteng/Llama-3.1-8B-Lexi-Uncensored-V2" # Works better but full weight.
|
25 |
-
CHECKPOINT_PATH = BASE_DIR / Path("cgrkzexw-599808")
|
26 |
LORA_PATH = CHECKPOINT_PATH / "text_model"
|
27 |
CAPTION_TYPE_MAP = {
|
28 |
"Descriptive": [
|
|
|
14 |
import torchvision.transforms.functional as TVF
|
15 |
from peft import PeftModel
|
16 |
import gc
|
17 |
+
import sys
|
18 |
+
IS_COLAB = 'google.colab' in sys.modules
|
19 |
|
20 |
# Constants
|
21 |
IMAGE_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
22 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
23 |
BASE_DIR = Path(__file__).resolve().parent # Define the base directory
|
24 |
+
CHECKPOINT_PATH = BASE_DIR / Path("cgrkzexw-599808") if not IS_COLAB else Path("/content/joy-caption-alpha-two-cli-mod/cgrkzexw-599808")
|
25 |
CLIP_PATH = "google/siglip-so400m-patch14-384"
|
26 |
DEFAULT_MODEL_PATH = "unsloth/Meta-Llama-3.1-8B-bnb-4bit"
|
27 |
#DEFAULT_MODEL_PATH = "Orenguteng/Llama-3.1-8B-Lexi-Uncensored-V2" # Works better but full weight.
|
|
|
28 |
LORA_PATH = CHECKPOINT_PATH / "text_model"
|
29 |
CAPTION_TYPE_MAP = {
|
30 |
"Descriptive": [
|
joycaption_alpha_two_cli_mod.ipynb
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {
|
7 |
+
"id": "ZgkQ4kDil23W"
|
8 |
+
},
|
9 |
+
"outputs": [],
|
10 |
+
"source": [
|
11 |
+
"!git clone https://huggingface.co/John6666/joy-caption-alpha-two-cli-mod/\n",
|
12 |
+
"!pip install -r /content/joy-caption-alpha-two-cli-mod/requirements.txt\n",
|
13 |
+
"!pip install bitsandbytes triton\n",
|
14 |
+
"!python /content/joy-caption-alpha-two-cli-mod/app.py"
|
15 |
+
]
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"cell_type": "code",
|
19 |
+
"execution_count": null,
|
20 |
+
"metadata": {
|
21 |
+
"id": "gPwD8BVsnU7p"
|
22 |
+
},
|
23 |
+
"outputs": [],
|
24 |
+
"source": [
|
25 |
+
"!python /content/joy-caption-alpha-two-cli-mod/app.py"
|
26 |
+
]
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"metadata": {
|
30 |
+
"accelerator": "GPU",
|
31 |
+
"colab": {
|
32 |
+
"gpuType": "T4",
|
33 |
+
"provenance": []
|
34 |
+
},
|
35 |
+
"kernelspec": {
|
36 |
+
"display_name": "Python 3",
|
37 |
+
"name": "python3"
|
38 |
+
},
|
39 |
+
"language_info": {
|
40 |
+
"name": "python"
|
41 |
+
}
|
42 |
+
},
|
43 |
+
"nbformat": 4,
|
44 |
+
"nbformat_minor": 0
|
45 |
+
}
|