-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add models & health check to serge.chat
- Loading branch information
Showing
3 changed files
with
583 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ vite.config.js.timestamp-* | |
.vercel | ||
.test-tmp | ||
symlink-from | ||
/notebooks/.ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "77f34a9a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import huggingface_hub\n", | ||
"import json\n", | ||
"import requests\n", | ||
"import time" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "fd21a173", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"302" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"with open('../static/models.json', 'r') as models_file:\n", | ||
" models = json.load(models_file)\n", | ||
" \n", | ||
"def check_model(repo, filename):\n", | ||
" url = huggingface_hub.hf_hub_url(repo, filename, repo_type=\"model\", revision=\"main\")\n", | ||
" r=requests.head(url)\n", | ||
"\n", | ||
" return r.status_code\n", | ||
"check_model(\"nsarrazin/alpaca\", \"alpaca-7B-ggml/tokenizer.model\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "a0ad3497", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"49" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"checks = []\n", | ||
"for family in models.values():\n", | ||
" for model in family.values():\n", | ||
" for file in model[\"files\"]:\n", | ||
" checks.append([check_model(model[\"model_repo\"],\n", | ||
" file[\"filename\"]),\n", | ||
" model[\"model_repo\"],\n", | ||
" file[\"filename\"]])\n", | ||
"len(checks)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "ac07047e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"0" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"failed_checks = filter(lambda x:str(x[0])[0] == '4', checks)\n", | ||
"len(list(failed_checks))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.