Skip to content

Commit b596545

Browse files
authored
Install latest prerelease from huggingface_hub when installing transformers from main (#12395)
* Allow prerelease when installing transformers from main * maybe better * maybe better * and now? * just bored * should be better * works now
1 parent 0e12ba7 commit b596545

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

.github/workflows/pr_modular_tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ jobs:
110110
run: |
111111
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
112112
python -m uv pip install -e [quality,test]
113-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
114-
# pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
115-
# pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
113+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
114+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
116115
117116
- name: Environment
118117
run: |

.github/workflows/pr_tests.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ jobs:
116116
run: |
117117
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
118118
python -m uv pip install -e [quality,test]
119-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
120-
# pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
121-
# pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
119+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
120+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
122121
123122
- name: Environment
124123
run: |
@@ -254,10 +253,9 @@ jobs:
254253
python -m uv pip install -e [quality,test]
255254
# TODO (sayakpaul, DN6): revisit `--no-deps`
256255
python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps
257-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
258-
# python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
259-
# python -m uv pip install -U tokenizers
260-
# pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
256+
python -m uv pip install -U tokenizers
257+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
258+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
261259
262260
- name: Environment
263261
run: |

.github/workflows/pr_tests_gpu.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ jobs:
132132
run: |
133133
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
134134
python -m uv pip install -e [quality,test]
135-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
136-
# pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
137-
# pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
135+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
136+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
138137
139138
- name: Environment
140139
run: |
@@ -204,9 +203,8 @@ jobs:
204203
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
205204
python -m uv pip install -e [quality,test]
206205
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
207-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
208-
# pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
209-
# pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
206+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
207+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
210208
211209
- name: Environment
212210
run: |
@@ -268,8 +266,7 @@ jobs:
268266
- name: Install dependencies
269267
run: |
270268
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
271-
# Stopping this update temporarily until the Hub RC is fully shipped and integrated.
272-
# pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
269+
pip uninstall transformers -y && pip uninstall huggingface_hub -y && python -m uv pip install --prerelease allow -U transformers@git+https://github.com/huggingface/transformers.git
273270
python -m uv pip install -e [quality,test,training]
274271
275272
- name: Environment

tests/models/test_modeling_common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ def load_model(path):
243243
else:
244244
_ = load_model(repo_id)
245245

246-
warning_message = str(warning.warnings[0].message)
247-
self.assertIn("This serialization format is now deprecated to standardize the serialization", warning_message)
246+
warning_messages = " ".join(str(w.message) for w in warning.warnings)
247+
self.assertIn("This serialization format is now deprecated to standardize the serialization", warning_messages)
248248

249249
# Local tests are already covered down below.
250250
@parameterized.expand(
@@ -298,11 +298,13 @@ def test_local_files_only_with_sharded_checkpoint(self):
298298
raise_for_status=mock.Mock(side_effect=HfHubHTTPError("Server down", response=mock.Mock())),
299299
json=mock.Mock(return_value={}),
300300
)
301+
client_mock = mock.Mock()
302+
client_mock.get.return_value = error_response
301303

302304
with tempfile.TemporaryDirectory() as tmpdir:
303305
model = FluxTransformer2DModel.from_pretrained(repo_id, subfolder="transformer", cache_dir=tmpdir)
304306

305-
with mock.patch("requests.Session.get", return_value=error_response):
307+
with mock.patch("huggingface_hub.hf_api.get_session", return_value=client_mock):
306308
# Should fail with local_files_only=False (network required)
307309
# We would make a network call with model_info
308310
with self.assertRaises(OSError):

0 commit comments

Comments
 (0)