Upload 3 files
Browse files- README.md +1 -1
- app.py +3 -1
- joycaption_alpha_one_cli_mod.ipynb +45 -0
README.md
CHANGED
|
@@ -5,7 +5,7 @@ language:
|
|
| 5 |
---
|
| 6 |
# Image Captioning App
|
| 7 |
|
| 8 |
-
This is a mod of [Wi-zz/joy-caption-pre-alpha](https://huggingface.co/Wi-zz/joy-caption-pre-alpha) and [fancyfeast/joy-caption-alpha-one](https://huggingface.co/spaces/fancyfeast/joy-caption-alpha-one). Thanks to [dominic1021](https://huggingface.co/dominic1021), [IceHibiki](https://huggingface.co/IceHibiki).
|
| 9 |
|
| 10 |
# Notice: I will contribute to Wi-zz after shaping the code.
|
| 11 |
|
|
|
|
| 5 |
---
|
| 6 |
# Image Captioning App
|
| 7 |
|
| 8 |
+
This is a mod of [Wi-zz/joy-caption-pre-alpha](https://huggingface.co/Wi-zz/joy-caption-pre-alpha) and [fancyfeast/joy-caption-alpha-one](https://huggingface.co/spaces/fancyfeast/joy-caption-alpha-one). Thanks to [dominic1021](https://huggingface.co/dominic1021), [IceHibiki](https://huggingface.co/IceHibiki), (BullseyeMxP)[https://huggingface.co/BullseyeMxP], [Wakeme](https://huggingface.co/Wakeme).
|
| 9 |
|
| 10 |
# Notice: I will contribute to Wi-zz after shaping the code.
|
| 11 |
|
app.py
CHANGED
|
@@ -14,12 +14,14 @@ from typing import List, Union
|
|
| 14 |
import torchvision.transforms.functional as TVF
|
| 15 |
from peft import PeftModel
|
| 16 |
import gc
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Constants
|
| 19 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 20 |
BASE_DIR = Path(__file__).resolve().parent # Define the base directory
|
| 21 |
CLIP_PATH = "google/siglip-so400m-patch14-384"
|
| 22 |
-
DEFAULT_MODEL_PATH = "unsloth/Meta-Llama-3.1-8B-bnb-4bit"
|
| 23 |
#DEFAULT_MODEL_PATH = "Orenguteng/Llama-3.1-8B-Lexi-Uncensored-V2" # Works better but full weight.
|
| 24 |
CHECKPOINT_PATH = BASE_DIR / Path("9em124t2-499968")
|
| 25 |
LORA_PATH = CHECKPOINT_PATH / "text_model"
|
|
|
|
| 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 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 22 |
BASE_DIR = Path(__file__).resolve().parent # Define the base directory
|
| 23 |
CLIP_PATH = "google/siglip-so400m-patch14-384"
|
| 24 |
+
DEFAULT_MODEL_PATH = "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit"
|
| 25 |
#DEFAULT_MODEL_PATH = "Orenguteng/Llama-3.1-8B-Lexi-Uncensored-V2" # Works better but full weight.
|
| 26 |
CHECKPOINT_PATH = BASE_DIR / Path("9em124t2-499968")
|
| 27 |
LORA_PATH = CHECKPOINT_PATH / "text_model"
|
joycaption_alpha_one_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-one-cli-mod/\n",
|
| 12 |
+
"!pip install -r /content/joy-caption-alpha-one-cli-mod/requirements.txt\n",
|
| 13 |
+
"!pip install bitsandbytes triton\n",
|
| 14 |
+
"!python /content/joy-caption-alpha-one-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-one-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 |
+
}
|