Repository navigation
Description
What happened?
m alora upload --intrinsic deletes any README.md in your adapter directory and leaves a copy of io.yaml there. The upload succeeds and says nothing, so if that README was a model card you wrote, it's gone.
The cause is in cli/alora/intrinsic_uploader.py:103-108. The function already creates a staging directory, but it edits the source directory and then copies it into staging:
shutil.copy2(io_yaml, weight_path)
if "README.md" in os.listdir(weight_path):
os.remove(os.path.join(weight_path, "README.md"))
shutil.copytree(weight_path, target_dir, dirs_exist_ok=True)What did you expect to happen?
The adapter directory stays as it was. Only the staging copy gets io.yaml added and README.md left out:
shutil.copytree(weight_path, target_dir, dirs_exist_ok=True,
ignore=shutil.ignore_patterns("README.md"))
shutil.copy2(io_yaml, target_dir)A regression test can compare the contents of weight_path before and after the upload.
How can we reproduce it?
The Hub calls are mocked, so no token is needed and nothing is uploaded:
import os, tempfile
from types import SimpleNamespace
from unittest.mock import Mock
from cli.alora import intrinsic_uploader as u
d = tempfile.mkdtemp()
os.mkdir(f"{d}/w")
open(f"{d}/w/adapter_config.json", "w").write("{}")
open(f"{d}/w/README.md", "w").write("# my model card\n")
open(f"{d}/io.yaml", "w").write("x: 1\n")
u.get_token = Mock(return_value="t")
u.create_repo = Mock(return_value=SimpleNamespace(url="x"))
u.upload_folder = Mock()
u.upload_file = Mock()
print(sorted(os.listdir(f"{d}/w"))) # ['README.md', 'adapter_config.json']
u.upload_intrinsic(f"{d}/w", "org/a", "org/base", "alora", f"{d}/io.yaml")
print(sorted(os.listdir(f"{d}/w"))) # ['adapter_config.json', 'io.yaml']This uses get_token from #1798. Before that merges, patch HfFolder.get_token instead.
Mellea version
0.10.0.dev0 (main)Any environmental details we need to know?
macOS, Python 3.12, huggingface-hub 1.16.1. Only local file handling is involved, so the backend doesn't matter.
Anything else we need to know?
This has been there since #422. Related to #1620 (same command), but separate: #1620 is about the layout of the uploaded repo, this is about the uploader changing local files.
Activity
Seyamalam commentedon Nov 19, 2026
I'd like to pick this up — could you assign it to me?
Plan: keep the source directory untouched —
copytreeinto staging withignore_patterns("README.md"), thencopy2(io_yaml, target_dir)— plus a regression test asserting the adapter directory's contents are unchanged after upload (Hub calls mocked).fix(cli): leave adapter directory untouched on intrinsic upload (gene…
test(cli): add immutability and staging tests for intrinsic upload (g…
test(cli): add immutability and staging tests for intrinsic upload (g…
test(cli): add immutability and staging tests for intrinsic upload (g…