File size: 3,972 Bytes
fb83c5b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
import gradio as gr
import toml
from .class_gui_config import KohyaSSGUIConfig
class HuggingFace:
def __init__(
self,
config: KohyaSSGUIConfig,
) -> None:
self.config = config
# Initialize the UI components
self.initialize_ui_components()
def initialize_ui_components(self) -> None:
# --huggingface_repo_id HUGGINGFACE_REPO_ID
# huggingface repo name to upload / huggingfaceにアップロードするリポジトリ名
# --huggingface_repo_type HUGGINGFACE_REPO_TYPE
# huggingface repo type to upload / huggingfaceにアップロードするリポジトリの種類
# --huggingface_path_in_repo HUGGINGFACE_PATH_IN_REPO
# huggingface model path to upload files / huggingfaceにアップロードするファイルのパス
# --huggingface_token HUGGINGFACE_TOKEN
# huggingface token / huggingfaceのトークン
# --huggingface_repo_visibility HUGGINGFACE_REPO_VISIBILITY
# huggingface repository visibility ('public' for public, 'private' or None for private) / huggingfaceにアップロードするリポジトリの公開設定('public'で公開、'private'またはNoneで非公開)
# --save_state_to_huggingface
# save state to huggingface / huggingfaceにstateを保存する
# --resume_from_huggingface
# resume from huggingface (ex: --resume {repo_id}/{path_in_repo}:{revision}:{repo_type}) / huggingfaceから学習を再開する(例: --resume {repo_id}/{path_in_repo}:{revision}:{repo_type})
# --async_upload upload to huggingface asynchronously / huggingfaceに非同期でアップロードする
with gr.Row():
self.huggingface_repo_id = gr.Textbox(
label="Huggingface repo id",
placeholder="huggingface repo id",
value=self.config.get("huggingface.repo_id", ""),
)
self.huggingface_token = gr.Textbox(
label="Huggingface token",
placeholder="huggingface token",
value=self.config.get("huggingface.token", ""),
)
with gr.Row():
# Repository settings
self.huggingface_repo_type = gr.Textbox(
label="Huggingface repo type",
placeholder="huggingface repo type",
value=self.config.get("huggingface.repo_type", ""),
)
self.huggingface_repo_visibility = gr.Textbox(
label="Huggingface repo visibility",
placeholder="huggingface repo visibility",
value=self.config.get("huggingface.repo_visibility", ""),
)
with gr.Row():
# File location in the repository
self.huggingface_path_in_repo = gr.Textbox(
label="Huggingface path in repo",
placeholder="huggingface path in repo",
value=self.config.get("huggingface.path_in_repo", ""),
)
with gr.Row():
# Functions
self.save_state_to_huggingface = gr.Checkbox(
label="Save state to huggingface",
value=self.config.get("huggingface.save_state_to_huggingface", False),
)
self.resume_from_huggingface = gr.Textbox(
label="Resume from huggingface",
placeholder="resume from huggingface",
value=self.config.get("huggingface.resume_from_huggingface", ""),
)
self.async_upload = gr.Checkbox(
label="Async upload",
value=self.config.get("huggingface.async_upload", False),
) |