Skip to content

Auth check for HF repos + better errors - #1683

Open
O-J1 wants to merge 2 commits into
Nerogar:masterfrom
O-J1:hf-auth-check
Open

Auth check for HF repos + better errors#1683
O-J1 wants to merge 2 commits into
Nerogar:masterfrom
O-J1:hf-auth-check

Conversation

@O-J1

@O-J1 O-J1 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Users keep foot gunning on getting access to HF repos, including more experienced users. This attempts suppress the unnecessary parts of the error chain for hf auth. Also modifies the gitignore so that we dont try to commit users presets that sit in ./training_presets (but still track presets in sub folders)

  1. Launched UI
  2. Selected Krea 2 preset (I dont have access to it)
  3. Expectedly fails and prints out:
Traceback (most recent call last):
  File "C:\repos\OneTrainer\modules\ui\TrainUIController.py", line 247, in __training_thread_function_impl
    trainer.start()
    ~~~~~~~~~~~~~^^
  File "C:\repos\OneTrainer\modules\trainer\GenericTrainer.py", line 135, in start
    self.model = self.model_loader.load(
                 ~~~~~~~~~~~~~~~~~~~~~~^
        model_type=self.config.model_type,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        quantization=self.config.quantization,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\repos\OneTrainer\modules\modelLoader\GenericLoRAModelLoader.py", line 51, in load
    base_model_loader._validate_hf_repo_access(model_names.base_model)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\repos\OneTrainer\modules\modelLoader\mixin\HFModelLoaderMixin.py", line 81, in _validate_hf_repo_access
    raise e.with_traceback(None) from None
huggingface_hub.errors.GatedRepoError: 403 Client Error. (Request ID: Root=1-6a79c730-65e25faf298604fd20a3aeda;3e346efe-45a6-4544-90a5-86fdac5ab6fb)

Cannot access gated repo for url https://huggingface.co/api/models/krea/Krea-2-Raw/auth-check.
Access to model krea/Krea-2-Raw is restricted and you are not in the authorized list. Visit https://huggingface.co/krea/Krea-2-Raw to ask for access.

AI assistance

AI-assisted. First time trying this, something small scope. CGPT 5.6 Sol. Read every line and tested, online, offline and 'I have access' to the model

Comment thread .gitignore
config.json
secrets.json
*.zip
training_presets/*.json

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this intended? this would ignore new presets I created

@O-J1 O-J1 Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also modifies the gitignore so that we dont try to commit users presets that sit in ./training_presets (but still track presets in sub folders)

Intended, doesn’t do what you describe, tested, ignores only those directly in training_presets and has no recursive behaviour

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it ignore just #.json then please
user configs are already saved to training_configs not _presets
training_presets could still carry a .json file directly in the folder. just not currently because I've moved all to subfolders. if a model only has 1 preset I'd probably not put it in a subfolder

model.model_spec = self._load_default_model_spec(model_type)

if model_names.base_model is not None:
base_model_loader._validate_hf_repo_access(model_names.base_model)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these 3 are redudant. the model loader will eventually call one the submodule functions and reach validate_hf_repo_access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants