Skip to content

Commit

Permalink
Merge pull request #5 from cadenmackenzie/main
Browse files Browse the repository at this point in the history
updates from main
  • Loading branch information
cadenmackenzie authored Nov 21, 2024
2 parents 1ca11ea + 93d38e2 commit 7a8c722
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 54 deletions.
7 changes: 4 additions & 3 deletions exo/orchestration/standard_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ async def process_inference_result(
token = await self.inference_engine.sample(result)
await self.inference_engine.ensure_shard(shard)
self.buffered_token_output[request_id][0].append(token.item())
self.trigger_on_token_callbacks(request_id, self.buffered_token_output[request_id][0], is_finished)
if DEBUG >= 2: print(f"[{request_id}] result size: {result.size}, is finished: {is_finished}, buffered tokens: {len(self.buffered_token_output[request_id][0])}")
is_finished = token.item() == self.inference_engine.tokenizer.eos_token_id
forward = token.reshape(1, -1)
self.trigger_on_token_callbacks(request_id, self.buffered_token_output[request_id][0], is_finished)
asyncio.create_task(self.broadcast_result(request_id, self.buffered_token_output[request_id][0], is_finished))
else:
forward = result

Expand Down Expand Up @@ -260,7 +261,7 @@ async def forward_prompt(
if DEBUG >= 1: print(f"target partition index: {target_index}")
target_id = self.partitioning_strategy.partition(self.topology)[target_index].node_id
next_shard = self.get_current_shard(base_shard, target_index)
if DEBUG >= 2: print(f"Computed target from: {base_shard} {target_index}, {self.topology}. target shard: {target_shard}")
if DEBUG >= 2: print(f"Computed target from: {base_shard} {target_index}, {self.topology}. next shard: {next_shard}")
if target_id == self.id:
await self.process_prompt(next_shard, prompt, request_id)
else:
Expand All @@ -280,7 +281,7 @@ async def forward_tensor(
if DEBUG >= 1: print(f"target partition index: {target_index}")
target_id = self.partitioning_strategy.partition(self.topology)[target_index].node_id
next_shard = self.get_current_shard(base_shard, target_index)
if DEBUG >= 2: print(f"Computed target from: {base_shard} {target_index}, {self.topology}. target shard: {target_shard}")
if DEBUG >= 2: print(f"Computed target from: {base_shard} {target_index}, {self.topology}. target shard: {next_shard}")
if target_id == self.id:
await self.process_tensor(next_shard, tensor, request_id)
else:
Expand Down
91 changes: 40 additions & 51 deletions exo/tinychat/index.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
/* define colors */
:root {
--primary-color: #a52e4d;
--primary-color-transparent: #a52e4d66;
--secondary-color: #228039;
--secondary-color-transparent: #22803966;

--primary-color: #fff;
--secondary-color: #2a2a2a;
--secondary-color-transparent: #ffffff66;
--primary-bg-color: #1a1a1a;
--foreground-color: #f0f0f0;
--red-color: #a52e4d;
--green-color: #228039;
--silver-color: #88808e;
}
@media(prefers-color-scheme: light) {
:root {
--primary-bg-color: #f0f0f0;
--secondary-bg-color: #eeeeee;
--tertiary-bg-color: #dddddd;
--foreground-color: #111111;
--accent-color: #000000;
}
}
@media(prefers-color-scheme: dark) {
:root {
--primary-bg-color: #111111;
--secondary-bg-color: #131313;
--tertiary-bg-color: #232323;
--foreground-color: #f0f0f0;
--accent-color: #aaaaaa;
}
}

main {
Expand Down Expand Up @@ -81,7 +61,11 @@ main {
top: 0;
position: absolute;

background: linear-gradient(180deg, var(--primary-bg-color) 0%, transparent 100%);
background: linear-gradient(
180deg,
var(--primary-bg-color) 0%,
transparent 100%
);
}
.histories-end {
height: 3rem;
Expand All @@ -91,15 +75,19 @@ main {
bottom: 0;
position: absolute;

background: linear-gradient(0deg, var(--primary-bg-color) 0%, transparent 100%);
background: linear-gradient(
0deg,
var(--primary-bg-color) 0%,
transparent 100%
);
}

.history {
padding: 1rem;
width: 100%;
max-width: 40rem;

background-color: var(--tertiary-bg-color);
background-color: var(--secondary-color);
border-radius: 10px;
border-left: 2px solid var(--primary-color);

Expand All @@ -109,7 +97,7 @@ main {
opacity: var(--opacity, 1);
}
.history:hover {
background-color: var(--secondary-bg-color);
background-color: var(--secondary-color);
}

.history-delete-button {
Expand All @@ -120,21 +108,22 @@ main {
margin: 0;
outline: none;
border: none;
background-color: var(--secondary-bg-color);
background-color: var(--secondary-color);
color: var(--foreground-color);
border-radius: 0 0 0 10px;
cursor: pointer;
transition: 0.2s;
}
.history-delete-button:hover {
background-color: var(--tertiary-bg-color);
background-color: var(--secondary-color);
padding: 0.75rem;
}

.messages {
overflow-y: auto;
height: 100%;
width: 100%;
max-width: 1200px;

display: flex;
flex-direction: column;
Expand All @@ -145,24 +134,19 @@ main {
}

.message {
width: 96%;
max-width: 80rem;

display: grid;

background-color: var(--secondary-bg-color);
max-width: 75%;
padding: 0.5rem 1rem;
border-radius: 10px;
border-radius: 20px;
}
.message-role-assistant {
border-bottom: 2px solid var(--primary-color);
border-left: 2px solid var(--primary-color);
box-shadow: -10px 10px 20px 2px var(--primary-color-transparent);
background-color: var(--secondary-color);
margin-right: auto;
color: #fff;
}
.message-role-user {
border-bottom: 2px solid var(--secondary-color);
border-right: 2px solid var(--secondary-color);
box-shadow: 10px 10px 20px 2px var(--secondary-color-transparent);
margin-left: auto;
background-color: var(--primary-color);
color: #000;
}
.download-progress {
margin-bottom: 12em;
Expand Down Expand Up @@ -275,14 +259,14 @@ main {
margin: 0;
outline: none;
border: none;
background-color: var(--secondary-bg-color);
background-color: var(--secondary-color);
color: var(--foreground-color);
border-radius: 0 0 0 10px;
cursor: pointer;
transition: 0.2s;
}
.clipboard-button:hover {
background-color: var(--tertiary-bg-color);
background-color: var(--secondary-color);
padding: 0.75rem;
}

Expand All @@ -291,9 +275,14 @@ main {
bottom: 0;

/* linear gradient from background-color to transparent on the top */
background: linear-gradient(0deg, var(--primary-bg-color) 55%, transparent 100%);
background: linear-gradient(
0deg,
var(--primary-bg-color) 55%,
transparent 100%
);

width: 100%;
max-width: 1200px;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down Expand Up @@ -340,7 +329,7 @@ main {
min-height: 3rem;
max-height: 8rem;

background-color: var(--tertiary-bg-color);
background-color: var(--secondary-color);
color: var(--foreground-color);
border-radius: 10px;
border: none;
Expand All @@ -352,8 +341,8 @@ main {
height: 3rem;
width: 4rem;

background-color: var(--secondary-color);
color: var(--foreground-color);
background-color: var(--primary-color);
color: var(--secondary-color);
border-radius: 10px;
padding: 0.5rem;
cursor: pointer;
Expand All @@ -362,7 +351,7 @@ main {
background-color: var(--secondary-color-transparent);
}
.input-button:disabled {
background-color: var(--secondary-bg-color);
background-color: var(--secondary-color);
cursor: not-allowed;
}

Expand Down

0 comments on commit 7a8c722

Please sign in to comment.