Skip to content

Commit a6a30b9

Browse files
committed
Address some feedback from reviewer
1 parent 1455722 commit a6a30b9

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

tests/lora/test_utils.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from huggingface_hub.utils import HfHubHTTPError
66
from torch import nn
77

8-
from vllm.lora.utils import (get_lora_absolute_path,
8+
from vllm.lora.utils import (get_adapter_absolute_path,
99
parse_fine_tuned_lora_name, replace_submodule)
1010
from vllm.utils import LRUCache
1111

@@ -187,53 +187,53 @@ def test_lru_cache():
187187
assert 6 in cache
188188

189189

190-
# Unit tests for get_lora_absolute_path
190+
# Unit tests for get_adapter_absolute_path
191191
@patch('os.path.isabs')
192-
def test_get_lora_absolute_path_absolute(mock_isabs):
192+
def test_get_adapter_absolute_path_absolute(mock_isabs):
193193
path = '/absolute/path/to/lora'
194194
mock_isabs.return_value = True
195-
assert get_lora_absolute_path(path) == path
195+
assert get_adapter_absolute_path(path) == path
196196

197197

198198
@patch('os.path.expanduser')
199-
def test_get_lora_absolute_path_expanduser(mock_expanduser):
199+
def test_get_adapter_absolute_path_expanduser(mock_expanduser):
200200
# Path with ~ that needs to be expanded
201201
path = '~/relative/path/to/lora'
202202
absolute_path = '/home/user/relative/path/to/lora'
203203
mock_expanduser.return_value = absolute_path
204-
assert get_lora_absolute_path(path) == absolute_path
204+
assert get_adapter_absolute_path(path) == absolute_path
205205

206206

207207
@patch('os.path.exists')
208208
@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):
210210
# Relative path that exists locally
211211
path = 'relative/path/to/lora'
212212
absolute_path = '/absolute/path/to/lora'
213213
mock_exist.return_value = True
214214
mock_abspath.return_value = absolute_path
215-
assert get_lora_absolute_path(path) == absolute_path
215+
assert get_adapter_absolute_path(path) == absolute_path
216216

217217

218218
@patch('huggingface_hub.snapshot_download')
219219
@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):
222222
# Hugging Face model identifier
223223
path = 'org/repo'
224224
absolute_path = '/mock/snapshot/path'
225225
mock_exist.return_value = False
226226
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
228228

229229

230230
@patch('huggingface_hub.snapshot_download')
231231
@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):
234234
# Hugging Face model identifier with download error
235235
path = 'org/repo'
236236
mock_exist.return_value = False
237237
mock_snapshot_download.side_effect = HfHubHTTPError(
238238
"failed to query model info")
239-
assert get_lora_absolute_path(path) == path
239+
assert get_adapter_absolute_path(path) == path

vllm/lora/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ def get_adapter_absolute_path(lora_path: str) -> str:
145145
local_snapshot_path = huggingface_hub.snapshot_download(
146146
repo_id=lora_path)
147147
except (HfHubHTTPError, RepositoryNotFoundError, EntryNotFoundError,
148-
HFValidationError) as e:
148+
HFValidationError):
149149
# Handle errors that may occur during the download
150150
# Return original path instead instead of throwing error here
151-
print(f"Error downloading the Hugging Face model: {e}")
151+
logger.exception("Error downloading the HuggingFace model")
152152
return lora_path
153153

154154
return local_snapshot_path

vllm/lora/worker_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from vllm.lora.models import (LoRAModel, LoRAModelManager,
1414
LRUCacheLoRAModelManager, create_lora_manager)
1515
from vllm.lora.request import LoRARequest
16-
from vllm.lora.utils import get_lora_absolute_path
16+
from vllm.lora.utils import get_adapter_absolute_path
1717

1818
logger = init_logger(__name__)
1919

@@ -90,7 +90,7 @@ def _load_adapter(self, lora_request: LoRARequest) -> LoRAModel:
9090
packed_modules_mapping[module])
9191
else:
9292
expected_lora_modules.append(module)
93-
lora_path = get_lora_absolute_path(lora_request.lora_path)
93+
lora_path = get_adapter_absolute_path(lora_request.lora_path)
9494
lora = self._lora_model_cls.from_local_checkpoint(
9595
lora_path,
9696
expected_lora_modules,

0 commit comments

Comments
 (0)