Skip to content

Commit

Permalink
add models & health check to serge.chat
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Jun 16, 2023
1 parent 7c2940f commit 0e144cd
Show file tree
Hide file tree
Showing 3 changed files with 583 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ vite.config.js.timestamp-*
.vercel
.test-tmp
symlink-from
/notebooks/.ipynb_checkpoints
118 changes: 118 additions & 0 deletions notebooks/health_check.ipynb
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
}
Loading

0 comments on commit 0e144cd

Please sign in to comment.