Comments (4)
The session should be reset at the end of the with
block. Try this:
from gpt4all import GPT4All
model = GPT4All("Phi-3-mini-4k-instruct.Q4_0.gguf")
with model.chat_session():
print(model.generate("2 fun names for a pelican"))
print(model.generate("2 more"))
with model.chat_session():
print("-- should have reset --")
print(model.generate("2 more"))
I get this:
"Pelico the Plunge" - A playful take on their diving behavior, suggesting they enjoy taking plunges into water to catch fish!
"Scoop Squad Pelicans" – Highlights how these birds skillfully scoop up prey with their large pouched bills while also being a fun and memorable name for an avian-themed team or group activity.
"Neck Divers of the Bayou" – This title captures both the unique neck dive behavior pelicans are known for, as well as their habitat in bayous where they can often be spotted fishing and diving with ease.
"The Scaly Surfers of the Sea" - A whimsical name that plays on the idea of pelicans riding ocean waves to catch food while also incorporating a nod to their scaly appearance, which is distinctive among birds.
-- should have reset --
It seems like your request was cut off. However, I'll assume you want to know what "2 more" could mean in a common context and provide an answer for that scenario: [...]
from gpt4all.
You might be able to achieve the same effect by calling __enter__()
and __exit__()
at the right moments instead of using with:
Try something like this:
from gpt4all import GPT4All
model = GPT4All("Phi-3-mini-4k-instruct.Q4_0.gguf")
# First chat session
session = model.chat_session()
session.__enter__()
try:
print(model.generate("2 fun names for a pelican"))
print(model.generate("2 more"))
finally:
session.__exit__(None, None, None)
# Second chat session
session = model.chat_session()
session.__enter__()
try:
print("-- should have reset --")
print(model.generate("2 more"))
finally:
session.__exit__(None, None, None)
You can keep that session
object as self.session
or similar.
from gpt4all.
Excellent, thanks! That works.
https://github.com/woheller69/gpt4all-TK-CHAT/blob/main/appGUI.py
from gpt4all.
that does not work for me. In my tkinter app mainloop() must at the end of the with statement.
So I would have to restart the app which - with the latest Python bindings - is more time consuming than before #2354.
Therefore I would like to stay within the contextmanager and just clear history.
from gpt4all.
Related Issues (20)
- Stuck processing
- Hailo-Support[Feature] Feature request title...
- Please add inkubaLM
- [Feature] please add Idefics 3 8B Llama 3
- CUDA 12.0 error while trying to run in CPU HOT 2
- [Python SDK] No Windows/Linux Release of 2.8.0 HOT 3
- Can't change GPU Layers setting for any model with a number larger than default
- Chats not retained if UI crash HOT 2
- Intel ARC device not listed as GPU HOT 1
- [Feature] Non-CUDA download option HOT 1
- [Feature] Keyboard shortcut to close current tab HOT 2
- [Feature] Play sound when answer is finished.
- [Feature] Save as screenshot HOT 1
- [Feature] Show processing time
- [Feature] Allow to start typing question while the model is loading
- how to uninstall gpt4all on Macbook (M) HOT 17
- Llama 3.1 8B model not working with Metal GPU (Mac M2) HOT 4
- [Feature] Close to tray
- After Updating to v3.2.0: GPT4All Replies with 'GGGG' and Crashes When Using RAG HOT 7
- Visibility issue when OS is in Dark Mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpt4all.