works with autogptq

This commit is contained in:
Saifeddine ALOUI 2023-07-07 18:25:18 +02:00
parent 3d72c84959
commit 83e3d995db
3 changed files with 73 additions and 62 deletions

View File

@ -29,7 +29,6 @@ import traceback
import sys import sys
from lollms.console import MainMenu from lollms.console import MainMenu
import urllib import urllib
import traceback
import gc import gc
__author__ = "parisneo" __author__ = "parisneo"
@ -265,7 +264,10 @@ class LoLLMsAPPI(LollmsApplication):
}, room=room_id }, room=room_id
) )
del self.download_infos[signature] del self.download_infos[signature]
try:
installation_path.unlink() installation_path.unlink()
except Exception as ex:
ASCIIColors.error(f"Couldn't delete file. Please try to remove it manually.\n{installation_path}")
return return
else: else:
@ -759,7 +761,7 @@ class LoLLMsAPPI(LollmsApplication):
self._generate(full_prompt, n_predict, callback) self._generate(full_prompt, n_predict, callback)
print("Finished executing the generation") print("Finished executing the generation")
def _generate(self, prompt, n_predict=50, callback=None): def _generate(self, prompt, n_predict=1024, callback=None):
self.current_generated_text = "" self.current_generated_text = ""
self.nb_received_tokens = 0 self.nb_received_tokens = 0
if self.model is not None: if self.model is not None:
@ -781,7 +783,7 @@ class LoLLMsAPPI(LollmsApplication):
output = self.model.generate( output = self.model.generate(
prompt, prompt,
callback=callback, callback=callback,
n_predict=self.personality.model_n_predicts, n_predict=min(n_predict,self.personality.model_n_predicts),
temperature=self.personality.model_temperature, temperature=self.personality.model_temperature,
top_k=self.personality.model_top_k, top_k=self.personality.model_top_k,
top_p=self.personality.model_top_p, top_p=self.personality.model_top_p,

1
app.py
View File

@ -1252,6 +1252,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
model_list = self.binding.get_available_models() model_list = self.binding.get_available_models()
models = [] models = []
ASCIIColors.yellow("Recovering available models")
for model in model_list: for model in model_list:
try: try:
filename = model.get('filename',"") filename = model.get('filename',"")

View File

@ -1597,13 +1597,50 @@ export default {
this.mzdc_collapsed = val this.mzdc_collapsed = val
}, },
fetchBindings() {
this.api_get_req("list_bindings")
then(response => {
this.bindings = response
this.bindings.sort((a, b) => a.name.localeCompare(b.name))
})
},
fetchMainConfig(){
this.api_get_req("get_config").then(response => {
this.getPersonalitiesArr().then(() => {
this.getMountedPersonalities()
})
console.log("Received config")
this.configFile = response
}).then(() => {
this.api_get_req("get_current_personality_path_infos").then(response => {
this.configFile.personality_language = response["personality_language"]
this.configFile.personality_category = response["personality_category"]
this.configFile.personality_folder = response["personality_name"]
console.log("received infos")
});
})
},
fetchModels() { fetchModels() {
this.api_get_req("get_available_models")
axios.get('/get_available_models') axios.get('/get_available_models')
.then(response => { .then(response => {
this.models = response.data; this.models = response.data;
this.models.sort((a, b) => a.title.localeCompare(b.title)) this.models.sort((a, b) => a.title.localeCompare(b.title))
this.fetchCustomModels() this.fetchCustomModels()
this.models.forEach(model => {
if (model.title == this.configFile["model_name"]) {
model.selected = true;
}
else {
model.selected = false;
}
});
}) })
.catch(error => { .catch(error => {
console.log(error.message, 'fetchModels'); console.log(error.message, 'fetchModels');
@ -1634,6 +1671,27 @@ export default {
console.log(error.message, 'fetchCustomModels'); console.log(error.message, 'fetchCustomModels');
}); });
}, },
fetchPersonalities(){
this.api_get_req("list_personalities_categories").then(response => {
this.persCatgArr = response
this.persCatgArr.sort()
})
this.api_get_req("list_personalities").then(response => {
this.persArr = response
this.persArr.sort()
console.log(`Listed personalities:\n${response}`)
})
},
fetchHardwareInfos(){
this.api_get_req("disk_usage").then(response => {
this.diskUsage = response
})
this.api_get_req("ram_usage").then(response => {
this.ramUsage = response
})
},
async onPersonalitySelected(pers) { async onPersonalitySelected(pers) {
console.log('on pers', pers) console.log('on pers', pers)
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -2141,64 +2199,12 @@ export default {
// Refresh stuff // Refresh stuff
refresh() { refresh() {
this.fetchMainConfig();
this.fetchBindings();
this.fetchModels();
this.fetchPersonalities();
this.fetchHardwareInfos();
this.api_get_req("list_personalities_categories").then(response => {
this.persCatgArr = response
this.persCatgArr.sort()
})
this.api_get_req("get_config").then(response => {
this.getPersonalitiesArr().then(() => {
this.getMountedPersonalities()
})
console.log("Received config")
this.configFile = response
this.models.forEach(model => {
if (model.title == response["model_name"]) {
model.selected = true;
}
else {
model.selected = false;
}
});
}).then(() => {
this.api_get_req("get_current_personality_path_infos").then(response => {
this.configFile.personality_language = response["personality_language"]
this.configFile.personality_category = response["personality_category"]
this.configFile.personality_folder = response["personality_name"]
console.log("received infos")
});
})
this.api_get_req("list_personalities").then(response => {
this.persArr = response
this.persArr.sort()
console.log(`Listed personalities:\n${response}`)
})
this.api_get_req("disk_usage").then(response => {
this.diskUsage = response
})
this.api_get_req("ram_usage").then(response => {
this.ramUsage = response
})
//this.fetchModels();
this.api_get_req("list_bindings")
then(response => {
this.bindings = response
this.bindings.sort((a, b) => a.name.localeCompare(b.name))
})
}, },
// Accordeon stuff // Accordeon stuff
toggleAccordion() { toggleAccordion() {
@ -2252,7 +2258,9 @@ export default {
this.update_model(null) this.update_model(null)
this.configFile.model_name = null this.configFile.model_name = null
this.refresh(); this.fetchMainConfig();
this.fetchBindings();
this.fetchModels();
nextTick(() => { nextTick(() => {
feather.replace() feather.replace()