upgraded conversion tool

This commit is contained in:
Saifeddine ALOUI 2023-04-16 23:22:09 +02:00
parent ad71fb1967
commit 970a787764
4 changed files with 11 additions and 8 deletions

5
app.py
View File

@ -32,6 +32,7 @@ import time
from pyGpt4All.config import load_config, save_config
from pyGpt4All.api import GPT4AllAPI
import shutil
import markdown
class Gpt4AllWebUI(GPT4AllAPI):
def __init__(self, _app, config:dict, personality:dict, config_file_path) -> None:
super().__init__(config, personality, config_file_path)
@ -212,13 +213,13 @@ class Gpt4AllWebUI(GPT4AllAPI):
try:
while not self.text_queue.empty():
value = self.text_queue.get(False)
value.replace("\n","<br>")
yield value
yield value.replace("\n","<br>")
except :
time.sleep(0.1)
self.current_discussion.update_message(response_id, self.bot_says)
self.full_message_list.append(self.bot_says)
bot_says = markdown.markdown(self.bot_says)
return "\n".join(bot_says)

View File

@ -1,7 +1,7 @@
@echo off
@echo off
set filename=../models/ggml-alpaca-7b-q4.bin
set newname=../models/ggml-alpaca-7b-q4.bin.original
set filename=../models/$1
set newname=../models/$1.original
echo %modelPath%
echo Converting the model to the new format...
@ -10,6 +10,6 @@ cd tmp\llama.cpp
git checkout 6c248707f51c8a50f7792e7f7787ec481881db88
cd ../..
pwd
move /y "%filename%" "%filename%.original"
move /y "%filename%" "%newname%"
echo Converting ...
python tmp\llama.cpp\migrate-ggml-2023-03-30-pr613.py "%newname%" "%filename%"

View File

@ -82,8 +82,11 @@ function addMessage(sender, message, id, rank = 0, can_edit = false) {
function push() {
reader.read().then(function (result) {
if (result.done) {
console.log(result)
sendbtn.style.display = "block";
waitAnimation.style.display = "none";
hiddenElement_.innerHTML = txt
messageTextElement_.innerHTML = txt
controller.close();
return;
}
@ -100,6 +103,7 @@ function addMessage(sender, message, id, rank = 0, can_edit = false) {
function readStream() {
readableStreamDefaultReader.read().then(function (result) {
if (result.done) {
console.log(result)
return;
}
@ -109,7 +113,6 @@ function addMessage(sender, message, id, rank = 0, can_edit = false) {
if (entry_counter == 0) {
// We parse it and
infos = JSON.parse(text)
console.log(infos)
elements = addMessage(infos.sender, '', infos.response_id, 0, can_edit = true);
messageTextElement_ = elements['messageTextElement'];
hiddenElement_ = elements['hiddenElement'];

View File

@ -36,6 +36,7 @@ function update_main(){
if (result.done) {
sendbtn.style.display="block";
waitAnimation.style.display="none";
console.log(result)
controller.close();
return;
}
@ -62,7 +63,6 @@ function update_main(){
{
// We parse it and
infos = JSON.parse(text)
console.log(infos)
addMessage('User', infos.message, infos.id, 0, can_edit=true);
elements = addMessage(infos.sender, '', infos.response_id, 0, can_edit=true);
messageTextElement=elements['messageTextElement'];
@ -74,7 +74,6 @@ function update_main(){
// For the other enrtries, these are just the text of the chatbot
for (const char of text) {
txt = hiddenElement.innerHTML;
console.log(txt)
if (char != '\f') {
txt += char
hiddenElement.innerHTML = txt