fix params
This commit is contained in:
parent
d2928e54f7
commit
9d89b6f4db
@ -25,7 +25,7 @@ class ChatCompletionBody(ModelConfigBody):
|
|||||||
messages: List[Message]
|
messages: List[Message]
|
||||||
model: str = "rwkv"
|
model: str = "rwkv"
|
||||||
stream: bool = False
|
stream: bool = False
|
||||||
stop: str | List[str] = None
|
stop: Union[str, List[str]] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
schema_extra = {
|
schema_extra = {
|
||||||
@ -47,7 +47,7 @@ class CompletionBody(ModelConfigBody):
|
|||||||
prompt: Union[str, List[str]]
|
prompt: Union[str, List[str]]
|
||||||
model: str = "rwkv"
|
model: str = "rwkv"
|
||||||
stream: bool = False
|
stream: bool = False
|
||||||
stop: str | List[str] = None
|
stop: Union[str, List[str]] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
schema_extra = {
|
schema_extra = {
|
||||||
|
@ -3,7 +3,7 @@ import os
|
|||||||
import pathlib
|
import pathlib
|
||||||
import copy
|
import copy
|
||||||
import re
|
import re
|
||||||
from typing import Dict, Iterable, List, Tuple
|
from typing import Dict, Iterable, List, Tuple, Union
|
||||||
from utils.log import quick_log
|
from utils.log import quick_log
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
@ -213,7 +213,7 @@ class AbstractRWKV(ABC):
|
|||||||
return state[0].tolist(), token_len
|
return state[0].tolist(), token_len
|
||||||
|
|
||||||
def generate(
|
def generate(
|
||||||
self, prompt: str, stop: str | List[str] = None
|
self, prompt: str, stop: Union[str, List[str]] = None
|
||||||
) -> Iterable[Tuple[str, str, int, int]]:
|
) -> Iterable[Tuple[str, str, int, int]]:
|
||||||
quick_log(None, None, "Generation Prompt:\n" + prompt)
|
quick_log(None, None, "Generation Prompt:\n" + prompt)
|
||||||
cache = None
|
cache = None
|
||||||
|
@ -72,7 +72,7 @@ const CompositionPanel: FC = observer(() => {
|
|||||||
|
|
||||||
const setSoundFont = async () => {
|
const setSoundFont = async () => {
|
||||||
let soundUrl: string;
|
let soundUrl: string;
|
||||||
if (params.useLocalSoundFont)
|
if (commonStore.compositionParams.useLocalSoundFont)
|
||||||
soundUrl = 'assets/sound-font';
|
soundUrl = 'assets/sound-font';
|
||||||
else
|
else
|
||||||
soundUrl = !commonStore.settings.giteeUpdatesSource ?
|
soundUrl = !commonStore.settings.giteeUpdatesSource ?
|
||||||
@ -117,7 +117,7 @@ const CompositionPanel: FC = observer(() => {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
'text': params.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', '').trim()
|
'text': commonStore.compositionParams.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', ' ').trim()
|
||||||
})
|
})
|
||||||
}).then(r => {
|
}).then(r => {
|
||||||
r.arrayBuffer().then(midi => {
|
r.arrayBuffer().then(midi => {
|
||||||
@ -168,7 +168,7 @@ const CompositionPanel: FC = observer(() => {
|
|||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
if (e.data.trim() === '[DONE]') {
|
if (e.data.trim() === '[DONE]') {
|
||||||
commonStore.setCompositionGenerating(false);
|
commonStore.setCompositionGenerating(false);
|
||||||
generateNs(params.autoPlay);
|
generateNs(commonStore.compositionParams.autoPlay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let data;
|
let data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user