Reimplement replicate inference. Allow model deletion. Implement repetition penalty. Fixes in stream reading.
This commit is contained in:
1 parent
26aa137c98
commit
fe596761dc
10 files changed
+169
-20
No files matched your search
+13
-6
@@ -253,6 +253,8 @@ class App(ChatMixin):
|
||||
async def get_model(self, model_id):
|
||||
return await db.Model.get(id=model_id)
|
||||
|
||||
# Serves for creating and updating models.
|
||||
# Deletes the model by the id if all other parameters are empty.
|
||||
async def save_model(self, model_id, kind, name, value):
|
||||
if model_id is None:
|
||||
model = await db.Model.create(
|
||||
@@ -261,12 +263,17 @@ class App(ChatMixin):
|
||||
value=value,
|
||||
)
|
||||
else:
|
||||
model = await db.Model.update_or_create(
|
||||
id=model_id,
|
||||
name=name,
|
||||
kind=kind,
|
||||
value=value,
|
||||
)
|
||||
if value is None and name is None and kind is None:
|
||||
await db.Model.filter(id=model_id).delete()
|
||||
print(f"Deleted model: {model_id}")
|
||||
return None
|
||||
else:
|
||||
model = await db.Model.update_or_create(
|
||||
id=model_id,
|
||||
name=name,
|
||||
kind=kind,
|
||||
value=value,
|
||||
)
|
||||
print(f"Saved model: {model.id} - {name}")
|
||||
return model
|
||||
|
||||
|
||||
Reference in new issue
Block a user