Skip to content

Commit

Permalink
feat: use cutom WebLLM build to have qwen-2-0.5b quantized versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed Jun 26, 2024
1 parent 0617dbb commit 6052c4c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 15 deletions.
5 changes: 4 additions & 1 deletion app/client/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { ChatCompletionFinishReason, CompletionUsage } from "@mlc-ai/web-llm";
import {
ChatCompletionFinishReason,
CompletionUsage,
} from "@neet-nestor/web-llm";
import { CacheType, Model } from "../store";
export const ROLES = ["system", "user", "assistant"] as const;
export type MessageRole = (typeof ROLES)[number];
Expand Down
5 changes: 4 additions & 1 deletion app/client/mlcllm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import log from "loglevel";
import { ChatOptions, LLMApi } from "./api";
import { ChatCompletionFinishReason, CompletionUsage } from "@mlc-ai/web-llm";
import {
ChatCompletionFinishReason,
CompletionUsage,
} from "@neet-nestor/web-llm";

export class MlcLLMApi implements LLMApi {
private endpoint: string;
Expand Down
4 changes: 2 additions & 2 deletions app/client/webllm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
WebWorkerMLCEngine,
CompletionUsage,
ChatCompletionFinishReason,
} from "@mlc-ai/web-llm";
} from "@neet-nestor/web-llm";

import { ChatOptions, LLMApi, LLMConfig, RequestMessage } from "./api";
import { LogLevel } from "@mlc-ai/web-llm";
import { LogLevel } from "@neet-nestor/web-llm";
import { fixMessage } from "../utils";
import { DEFAULT_MODELS } from "../constant";

Expand Down
2 changes: 1 addition & 1 deletion app/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Route,
useLocation,
} from "react-router-dom";
import { ServiceWorkerMLCEngine } from "@mlc-ai/web-llm";
import { ServiceWorkerMLCEngine } from "@neet-nestor/web-llm";

import MlcIcon from "../icons/mlc.svg";
import LoadingIcon from "../icons/three-dots.svg";
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ErrorBoundary } from "./error";
import { InputRange } from "./input-range";
import { useNavigate } from "react-router-dom";
import { nanoid } from "nanoid";
import { LogLevel } from "@mlc-ai/web-llm";
import { LogLevel } from "@neet-nestor/web-llm";
import { WebLLMContext } from "../context";

function EditPromptModal(props: { id: string; onClose: () => void }) {
Expand Down
5 changes: 4 additions & 1 deletion app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { estimateTokenLength } from "../utils/token";
import { nanoid } from "nanoid";
import { createPersistStore } from "../utils/store";
import { WebLLMApi } from "../client/webllm";
import { ChatCompletionFinishReason, CompletionUsage } from "@mlc-ai/web-llm";
import {
ChatCompletionFinishReason,
CompletionUsage,
} from "@neet-nestor/web-llm";

export type ChatMessage = RequestMessage & {
date: string;
Expand Down
2 changes: 1 addition & 1 deletion app/store/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogLevel } from "@mlc-ai/web-llm";
import { LogLevel } from "@neet-nestor/web-llm";
import { ModelRecord } from "../client/api";
import {
DEFAULT_INPUT_TEMPLATE,
Expand Down
2 changes: 1 addition & 1 deletion app/worker/service-worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ServiceWorkerMLCEngineHandler } from "@mlc-ai/web-llm";
import { ServiceWorkerMLCEngineHandler } from "@neet-nestor/web-llm";
import { defaultCache } from "@serwist/next/worker";
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist";
import { CacheFirst, ExpirationPlugin, Serwist } from "serwist";
Expand Down
2 changes: 1 addition & 1 deletion app/worker/web-worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import log from "loglevel";
import { WebWorkerMLCEngineHandler } from "@mlc-ai/web-llm";
import { WebWorkerMLCEngineHandler } from "@neet-nestor/web-llm";

let handler: WebWorkerMLCEngineHandler;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@fortaine/fetch-event-source": "^3.0.6",
"@hello-pangea/dnd": "^16.5.0",
"@mlc-ai/web-llm": "^0.2.46",
"@neet-nestor/web-llm": "^0.2.58",
"@serwist/next": "^9.0.2",
"@svgr/webpack": "^6.5.1",
"emoji-picker-react": "^4.9.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2089,10 +2089,10 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@mlc-ai/web-llm@^0.2.46":
version "0.2.46"
resolved "https://registry.yarnpkg.com/@mlc-ai/web-llm/-/web-llm-0.2.46.tgz#bf32dab0710dba4967d49b2810b39184272d8840"
integrity sha512-NGf5ylTvOVwH1iN4Q2N0t/GfmrjDekFPMjWRO/WqEB3BhSC6+B2ZkLY3AZ43c2RbT2NqROp3BovgNq3Mxq3ONQ==
"@neet-nestor/web-llm@^0.2.58":
version "0.2.58"
resolved "https://registry.yarnpkg.com/@neet-nestor/web-llm/-/web-llm-0.2.58.tgz#72a3c04d7165880ebda1fda5e19008c2c15f0edb"
integrity sha512-ZLxAcr0cCeZEHttew/zV22KWkXRcp2gr36opgG1pWnCrNIWbGP7fdvzlMc5VuMOMmRSMWkJzLZZZ5hkzsX+aSA==
dependencies:
loglevel "^1.9.1"

Expand Down

0 comments on commit 6052c4c

Please sign in to comment.