Skip to content

Commit 57cfa34

Browse files
committed
🚧 fix(wip): stream management on indexing
1 parent f022fdb commit 57cfa34

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
project = 'magnet'
1212
copyright = '2023, Prismadic, LLC'
1313
author = 'Prismadic, LLC.'
14-
release = '0.3.1'
14+
release = '0.3.11'
1515

1616
# -- General configuration ---------------------------------------------------
1717
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -29,7 +29,7 @@
2929
display_github = True
3030
html_logo = "../magnet.png"
3131
pygments_style = 'dracula'
32-
version = "v0.3.1"
32+
version = "v0.3.11"
3333
release = "latest"
3434
# -- Options for HTML output -------------------------------------------------
3535
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

magnet/ic/field.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async def on(self, job: bool = None, local: bool = False, bandwidth: int = 1000,
212212
, max_ack_pending=bandwidth
213213
, ack_wait=3600
214214
)
215-
_f('wait', f'connecting to {self.magnet.config.host}')
215+
_f('wait', f'connecting to {self.magnet.config.host.split("@")[1]}')
216216
try:
217217
if obj:
218218
self.sub = await self.magnet.os.watch(include_history=False)
@@ -222,7 +222,6 @@ async def on(self, job: bool = None, local: bool = False, bandwidth: int = 1000,
222222
self.sub = await self.magnet.js.pull_subscribe(
223223
durable=self.magnet.config.session
224224
, subject=self.magnet.config.category
225-
, stream=self.magnet.config.stream_name
226225
, config=self.consumer_config
227226
)
228227
_f('info',
@@ -271,13 +270,13 @@ async def deliver_messages(msgs):
271270
await self.download(msg)
272271
await cb(self.magnet.os, msg)
273272
else:
274-
_f("info", f'consuming {job_n} from [{self.magnet.config.category}] on\n🛰️ stream: {self.magnet.config.stream_name}\n🧲 session: "{self.magnet.session}"')
273+
_f("info", f'consuming {job_n} from [{self.magnet.config.category}] on\n🛰️ stream: {self.magnet.config.stream_name}\n🧲 session: "{self.magnet.config.session}"')
275274
msgs = await self.sub.fetch(batch=job_n, timeout=60)
276275
await deliver_messages(msgs)
277276
except ValueError as e:
278277
_f('warn', f'{self.magnet.config.session} reached the end of {self.magnet.config.category}, {self.magnet.config.name}')
279278
except Exception as e:
280-
_f('warn', "no more data")
279+
_f('warn', f"no more data\n{e}")
281280
else:
282281
if type(self.sub).__name__ == "ObjectWatcher":
283282
_f("info", f'consuming objects from [{self.magnet.config.host.split("@")[1]}] from\n🛰️ bucket: {self.magnet.config.stream_name}"')
@@ -300,7 +299,7 @@ async def deliver_messages(msgs):
300299
_f('warn', 'encountered a timeout, retrying in 1s')
301300
else:
302301
_f('fatal', str(e))
303-
_f("warn", f'retrying connection to {self.magnet.config.host}\n{e}')
302+
_f("warn", f'retrying connection to {self.magnet.config.host.split("@")[1]}\n{e}')
304303
_f("info", "this can also be a problem with your callback")
305304
await asyncio.sleep(1)
306305
_f("info", f'consuming delta from [{self.magnet.config.category}] on\n🛰️ stream: {self.magnet.config.stream_name}\n🧲 session: "{self.magnet.config.session}"')
@@ -350,8 +349,8 @@ async def off(self):
350349
351350
:return: None
352351
"""
353-
await self.magnet.js.sub.unsubscribe()
352+
await self.sub.unsubscribe()
354353
_f('warn', f'unsubscribed from {self.magnet.config.stream_name}')
355354
await self.nc.drain()
356-
_f('warn', f'safe to disconnect from {self.magnet.config.host}')
355+
_f('warn', f'safe to disconnect from {self.magnet.config.host.split("@")[1]}')
357356

magnet/ize/memory.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ async def index(self, payload, msg, field=None, v=False, instruction="Represent
5656
self.db.collection.insert([
5757
[payload.document], [_chunk], [embedding.tolist()]
5858
])
59-
_f('success', f'embedding indexed\n{payload}') if v else None
59+
_f('success', f'embedding indexed\n{_chunk}') if v else None
6060
if field:
6161
payload = EmbeddingPayload(
6262
model=self.config.index.model,
6363
embedding=embedding.tolist(),
6464
text=_chunk,
6565
document=payload.document
6666
)
67-
_f('info', f'sending payload\n{payload}') if v else None
67+
_f('info', f'sending payload\n{_chunk}') if v else None
6868
await self.field.pulse(payload)
6969
else:
7070
embedding = self._model.encode(text_to_encode, normalize_embeddings=True)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "llm_magnet"
3-
version = "0.3.1"
3+
version = "0.3.11"
44
description = "the small distributed language model toolkit. fine-tune state-of-the-art LLMs anywhere, rapidly."
55
readme = "dynamic"
66

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='llm_magnet',
5-
version='0.3.1',
5+
version='0.3.11',
66
description="the small distributed language model toolkit. fine-tune state-of-the-art LLMs anywhere, rapidly.",
77
long_description=open('README.md').read(),
88
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)