You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we deploy square we need to deploy the models from the DB, but this does not download them. So I created this small script to automatically download all of them. This should be put somewhere but dunno and it's not urgent. So I'll put it here and we'll think how to call this later on.
from tqdm import tqdm
def init_models():
# get list of skills
response = requests.get(
url="https://test.square.ukp-lab.de/api/skill-manager/skill",
verify=os.getenv("VERIFY_SSL") == "1",
)
list_skills = response.json()
input_data = {'query': 'which layer of the meninges is connected to the brain',
'skill_args': {'context': "<P> The pia mater ( Latin : tender mother ) is a very delicate membrane . It is the meningeal envelope that firmly adheres to the surface of the brain and spinal cord , following all of the brain 's contours ( the gyri and sulci ) . It is a very thin membrane composed of fibrous tissue covered on its outer surface by a sheet of flat cells thought to be impermeable to fluid . The pia mater is pierced by blood vessels to the brain and spinal cord , and its capillaries nourish the brain . </P>"},
'preprocessing_kwargs': {'max_length': 512}}
no_adapter = lambda skill : "adapter" not in skill['default_skill_args'] or skill['default_skill_args']['adapter'] is None or len(skill['default_skill_args']['adapter']) == 0
# call each skill
for skill in tqdm(list_skills):
if skill['skill_type'] == 'span-extraction' and len(skill['data_sets']) > 0 and no_adapter(skill):
print(f"Calling skill {skill['name']} - {skill['id']}")
response = requests.post(
url="https://test.square.ukp-lab.de/api/skill-manager/skill/" + skill["id"] + "/query",
json=input_data,
# headers={"Authorization": f"Bearer {token}"},
verify=os.getenv("VERIFY_SSL") == "1",
)
time.sleep(1)
The text was updated successfully, but these errors were encountered:
The download only on request is a good feature I think, as long as the current logic deploys all models at once. Otherwise there will be many models downloaded and loaded into memory that are not used at all.
However, I agree that this logic can be improved. I think it would be better to have the model deployment automatic whenever a request to a un-deployed model comes in. The UI could also be extended to show if the model of a skill is currently deployed or not. This would indicate if the user should expect a longer waiting time or not.
Alternatively, I think the model service has now and endpoint to deploy a single model. Therefore, before sending a request to the Skill, the UI could check if a model is deployed and if not hit the deployment endpoint of that model first.
Hi,
When we deploy square we need to deploy the models from the DB, but this does not download them. So I created this small script to automatically download all of them. This should be put somewhere but dunno and it's not urgent. So I'll put it here and we'll think how to call this later on.
The text was updated successfully, but these errors were encountered: