Skip to content
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

ENH: add real paths column #1555

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions xinference/core/cache_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from logging import getLogger
from typing import Any, Dict, List, Optional

Expand Down Expand Up @@ -108,6 +109,17 @@ def list_cached_models(self) -> List[Dict[Any, Any]]:
if version_info["cache_status"]:
hainaweiben marked this conversation as resolved.
Show resolved Hide resolved
ret = version_info.copy()
ret["model_name"] = model_name
re_dict = version_info.get("model_file_location", None)
actor_ip_address, path = next(iter(re_dict.items()))
hainaweiben marked this conversation as resolved.
Show resolved Hide resolved
ret["actor_ip_address"] = actor_ip_address
ret["path"] = path
if os.path.isdir(path):
files = os.listdir(path)
resolved_file = os.path.realpath(os.path.join(path, files[0]))
if resolved_file:
ret["real_path"] = os.path.dirname(resolved_file)
else:
ret["real_path"] = os.path.realpath(path)
cached_models.append(ret)
cached_models = sorted(cached_models, key=lambda x: x["model_name"])
return cached_models
6 changes: 4 additions & 2 deletions xinference/core/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,9 @@ async def list_cached_models(self) -> List[Dict[str, Any]]:
"model_size_in_billions", None
)
quantizations = model_version.get("quantization", None)
re_dict = model_version.get("model_file_location", None)
actor_ip_address, path = next(iter(re_dict.items()))
actor_ip_address = model_version.get("actor_ip_address", None)
path = model_version.get("path", None)
real_path = model_version.get("real_path", None)

cache_entry = {
"model_name": model_name,
Expand All @@ -1003,6 +1004,7 @@ async def list_cached_models(self) -> List[Dict[str, Any]]:
"quantizations": quantizations,
"path": path,
"Actor IP Address": actor_ip_address,
"real_path": real_path,
}

cached_models.append(cache_entry)
Expand Down
Loading