OpenChat: Easy to use opensource chatting framework via neural networks
APACHE-2.0 License
____ ____ ______ _ __ ______ __ __ ___ ______
/ __ \ / __ \ / ____// | / / / ____// / / // | /_ __/
/ / / // /_/ // __/ / |/ / / / / /_/ // /| | / /
/ /_/ // ____// /___ / /| / / /___ / __ // ___ | / /
\____//_/ /_____//_/ |_/ \____//_/ /_//_/ |_|/_/
pip install openchat
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cpu")
device='cuda'
If you want to use GPU acceleration.>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cuda")
device='cuda:n'
If you want to use a specific GPU.>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cuda:2") # <--- use 3rd GPU
>>> OpenChat(model="blender.medium", device="cuda:0") # <--- use 1st GPU
**kwargs
if you want to change decoding options.
["greedy", "beam", "top_k", "nucleus"]
,keyword argument
not positional argument
.>>> from openchat import OpenChat
>>> OpenChat(
... model="blender.medium",
... device="cpu",
... method="top_k",
... top_k=20,
... no_repeat_ngram_size=3,
... length_penalty=0.6,
... )
safety.offensive
model, parameter method
must be one of ["both", "string-match", "bert"]
>>> from openchat import OpenChat
>>> OpenChat(
... model="safety.offensive",
... device="cpu"
... method="both" # ---> both, string-match, bert
... )
*
means all models)
gptneo.*
*
means all models)
blender.*
dodecathlon.convai2
unlikelihood.convai2.*
*
means all models)
wizard_of_wikipedia.end2end_generator
dodecathlon.wizard_of_wikipedia
unlikelihood.wizard_of_wikipedia.*
safety.offensive
: offensive words classificationsafety.sensitive
: sensitive topic classificationCopyright 2021 Hyunwoong Ko.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.