|
5 | 5 | from huggingface_hub.utils import HfHubHTTPError
|
6 | 6 | from torch import nn
|
7 | 7 |
|
8 |
| -from vllm.lora.utils import (get_lora_absolute_path, |
| 8 | +from vllm.lora.utils import (get_adapter_absolute_path, |
9 | 9 | parse_fine_tuned_lora_name, replace_submodule)
|
10 | 10 | from vllm.utils import LRUCache
|
11 | 11 |
|
@@ -187,53 +187,53 @@ def test_lru_cache():
|
187 | 187 | assert 6 in cache
|
188 | 188 |
|
189 | 189 |
|
190 |
| -# Unit tests for get_lora_absolute_path |
| 190 | +# Unit tests for get_adapter_absolute_path |
191 | 191 | @patch('os.path.isabs')
|
192 |
| -def test_get_lora_absolute_path_absolute(mock_isabs): |
| 192 | +def test_get_adapter_absolute_path_absolute(mock_isabs): |
193 | 193 | path = '/absolute/path/to/lora'
|
194 | 194 | mock_isabs.return_value = True
|
195 |
| - assert get_lora_absolute_path(path) == path |
| 195 | + assert get_adapter_absolute_path(path) == path |
196 | 196 |
|
197 | 197 |
|
198 | 198 | @patch('os.path.expanduser')
|
199 |
| -def test_get_lora_absolute_path_expanduser(mock_expanduser): |
| 199 | +def test_get_adapter_absolute_path_expanduser(mock_expanduser): |
200 | 200 | # Path with ~ that needs to be expanded
|
201 | 201 | path = '~/relative/path/to/lora'
|
202 | 202 | absolute_path = '/home/user/relative/path/to/lora'
|
203 | 203 | mock_expanduser.return_value = absolute_path
|
204 |
| - assert get_lora_absolute_path(path) == absolute_path |
| 204 | + assert get_adapter_absolute_path(path) == absolute_path |
205 | 205 |
|
206 | 206 |
|
207 | 207 | @patch('os.path.exists')
|
208 | 208 | @patch('os.path.abspath')
|
209 |
| -def test_get_lora_absolute_path_local_existing(mock_abspath, mock_exist): |
| 209 | +def test_get_adapter_absolute_path_local_existing(mock_abspath, mock_exist): |
210 | 210 | # Relative path that exists locally
|
211 | 211 | path = 'relative/path/to/lora'
|
212 | 212 | absolute_path = '/absolute/path/to/lora'
|
213 | 213 | mock_exist.return_value = True
|
214 | 214 | mock_abspath.return_value = absolute_path
|
215 |
| - assert get_lora_absolute_path(path) == absolute_path |
| 215 | + assert get_adapter_absolute_path(path) == absolute_path |
216 | 216 |
|
217 | 217 |
|
218 | 218 | @patch('huggingface_hub.snapshot_download')
|
219 | 219 | @patch('os.path.exists')
|
220 |
| -def test_get_lora_absolute_path_huggingface(mock_exist, |
221 |
| - mock_snapshot_download): |
| 220 | +def test_get_adapter_absolute_path_huggingface(mock_exist, |
| 221 | + mock_snapshot_download): |
222 | 222 | # Hugging Face model identifier
|
223 | 223 | path = 'org/repo'
|
224 | 224 | absolute_path = '/mock/snapshot/path'
|
225 | 225 | mock_exist.return_value = False
|
226 | 226 | mock_snapshot_download.return_value = absolute_path
|
227 |
| - assert get_lora_absolute_path(path) == absolute_path |
| 227 | + assert get_adapter_absolute_path(path) == absolute_path |
228 | 228 |
|
229 | 229 |
|
230 | 230 | @patch('huggingface_hub.snapshot_download')
|
231 | 231 | @patch('os.path.exists')
|
232 |
| -def test_get_lora_absolute_path_huggingface_error(mock_exist, |
233 |
| - mock_snapshot_download): |
| 232 | +def test_get_adapter_absolute_path_huggingface_error(mock_exist, |
| 233 | + mock_snapshot_download): |
234 | 234 | # Hugging Face model identifier with download error
|
235 | 235 | path = 'org/repo'
|
236 | 236 | mock_exist.return_value = False
|
237 | 237 | mock_snapshot_download.side_effect = HfHubHTTPError(
|
238 | 238 | "failed to query model info")
|
239 |
| - assert get_lora_absolute_path(path) == path |
| 239 | + assert get_adapter_absolute_path(path) == path |
0 commit comments