Skip to content

Use git-lfs for larger assets #7804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# Only affects text files and ignores other file types.
# For more info see: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/
* text=auto
docker/** text eol=lf
docker/** text eol=lf
tests/test_model_probe/stripped_models/** filter=lfs diff=lfs merge=lfs -text
3 changes: 2 additions & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ jobs:
PIP_USE_PEP517: '1'
steps:
- name: checkout
uses: actions/checkout@v4
# https://github.com/nschloe/action-cached-lfs-checkout
uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2

- name: check for changed python files
if: ${{ inputs.always_run != true }}
Expand Down
24 changes: 17 additions & 7 deletions docs/contributing/dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ If you just want to use Invoke, you should use the [launcher][launcher link].

2. [Fork and clone][forking link] the [InvokeAI repo][repo link].

3. Create an directory for user data (images, models, db, etc). This is typically at `~/invokeai`, but if you already have a non-dev install, you may want to create a separate directory for the dev install.

4. Follow the [manual install][manual install link] guide, with some modifications to the install command:
3. This repository uses Git LFS to manage large files. To ensure all assets are downloaded:
- Install git-lfs → [Download here](https://git-lfs.com/)
- Enable automatic LFS fetching for this repository:
```shell
git config lfs.fetchinclude "*"
```
- Fetch files from LFS (only needs to be done once; subsequent `git pull` will fetch changes automatically):
```
git lfs pull
```
4. Create an directory for user data (images, models, db, etc). This is typically at `~/invokeai`, but if you already have a non-dev install, you may want to create a separate directory for the dev install.

5. Follow the [manual install][manual install link] guide, with some modifications to the install command:

- Use `.` instead of `invokeai` to install from the current directory. You don't need to specify the version.

Expand All @@ -34,27 +44,27 @@ If you just want to use Invoke, you should use the [launcher][launcher link].
uv pip install -e ".[dev,test,docs,xformers]" --python 3.11 --python-preference only-managed --index=https://download.pytorch.org/whl/cu124 --reinstall
```

5. At this point, you should have Invoke installed, a venv set up and activated, and the server running. But you will see a warning in the terminal that no UI was found. If you go to the URL for the server, you won't get a UI.
6. At this point, you should have Invoke installed, a venv set up and activated, and the server running. But you will see a warning in the terminal that no UI was found. If you go to the URL for the server, you won't get a UI.

This is because the UI build is not distributed with the source code. You need to build it manually. End the running server instance.

If you only want to edit the docs, you can stop here and skip to the **Documentation** section below.

6. Install the frontend dev toolchain:
7. Install the frontend dev toolchain:

- [`nodejs`](https://nodejs.org/) (v20+)

- [`pnpm`](https://pnpm.io/8.x/installation) (must be v8 - not v9!)

7. Do a production build of the frontend:
8. Do a production build of the frontend:

```sh
cd <PATH_TO_INVOKEAI_REPO>/invokeai/frontend/web
pnpm i
pnpm build
```

8. Restart the server and navigate to the URL. You should get a UI. After making changes to the python code, restart the server to see those changes.
9. Restart the server and navigate to the URL. You should get a UI. After making changes to the python code, restart the server to see those changes.

## Updating the UI

Expand Down
9 changes: 5 additions & 4 deletions tests/test_model_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,19 @@ def test_regression_against_model_probe(datadir: Path, override_model_loading):
The test paths are gathered from the 'test_model_probe' directory.
"""
configs_with_tests = set()
model_paths = ModelSearch().search(datadir / "stripped_models")
fake_hash = "abcdefgh" # skip hashing to make test quicker

model_paths = ModelSearch().search(datadir)
for path in model_paths:
legacy_config = new_config = None

try:
legacy_config = ModelProbe.probe(path)
legacy_config = ModelProbe.probe(path, {"hash": fake_hash})
except InvalidModelConfigException:
pass

try:
new_config = ModelConfigBase.classify(path)
new_config = ModelConfigBase.classify(path, hash=fake_hash)
except InvalidModelConfigException:
pass

Expand All @@ -176,7 +177,7 @@ def test_regression_against_model_probe(datadir: Path, override_model_loading):
config_type = type(legacy_config or new_config)
configs_with_tests.add(config_type)

untested_configs = ModelConfigBase.all_config_classes() - configs_with_tests
untested_configs = ModelConfigBase.all_config_classes() - configs_with_tests - {MinimalConfigExample}
logger = InvokeAILogger.get_logger(__file__)
logger.warning(f"Function test_regression_against_model_probe missing test case for: {untested_configs}")

Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/test_model_probe/stripped_models/Lineart/config.json
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/test_model_probe/stripped_models/RealESRGAN_x2plus.pth
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown