Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support Intel #895

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.idea
ci
clients
.github
python
**/target
**/node_modules
45 changes: 40 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ jobs:

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/[email protected]
uses: docker/[email protected]
with:
# Needed to support OCI annotations
version: v0.12.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand Down Expand Up @@ -78,7 +81,7 @@ jobs:

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5.0.0
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -91,17 +94,50 @@ jobs:
type=schedule,pattern={{date 'YYYYMMDD'}}
type=semver,pattern={{version}}

- name: Docker meta for ROCm
id: meta-rocm
uses: docker/[email protected]
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ env.IMAGE_NAME }}/rocm
${{ env.IMAGE_NAME }}-rocm
# generate Docker tags based on the following events/attributes
variant: rocm
tags: |
type=raw,value={{branch}}-{{sha}},enable=${{ startsWith(github.ref, 'refs/heads') }}
type=schedule,pattern=nightly
type=schedule,pattern={{date 'YYYYMMDD'}}
type=semver,pattern={{version}}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3.1.1
uses: docker/build-push-action@v5.1.0
with:
file: Dockerfile
file: cuda.Dockerfile
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.labels }}
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
build-args: RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image for ROCm
id: build-and-push-rocm
uses: docker/[email protected]
with:
file: rocm.Dockerfile
push: true
context: .
tags: ${{ steps.meta-rocm.outputs.tags }}
labels: ${{ steps.meta-rocm.outputs.labels }}
annotations: ${{ steps.meta-rocm.outputs.labels }}
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
build-args: RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
Expand All @@ -112,4 +148,3 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: tabbyml/tabby

2 changes: 1 addition & 1 deletion clients/tabby-agent/src/AgentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from "fs-extra";
import toml from "toml";
import chokidar from "chokidar";
import deepEqual from "deep-equal";
import { getProperty, deleteProperty } from "dot-prop";
import { deleteProperty, getProperty } from "dot-prop";
import { isBrowser } from "./env";
import { rootLogger } from "./logger";

Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import decodeJwt from "jwt-decode";
import createClient from "openapi-fetch";
import type { paths as CloudApi } from "./types/cloudApi";
import type { AbortSignalOption } from "./Agent";
import { HttpError, abortSignalFromAnyOf } from "./utils";
import { abortSignalFromAnyOf, HttpError } from "./utils";
import { dataStore, DataStore } from "./dataStore";
import { rootLogger } from "./logger";

Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/CompletionCache.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LRUCache } from "lru-cache";
import { CompletionContext, CompletionResponse } from "./CompletionContext";
import { rootLogger } from "./logger";
import { splitLines, autoClosingPairOpenings, autoClosingPairClosings, findUnpairedAutoClosingChars } from "./utils";
import { autoClosingPairClosings, autoClosingPairOpenings, findUnpairedAutoClosingChars, splitLines } from "./utils";

type CompletionCacheKey = CompletionContext;
type CompletionCacheValue = CompletionResponse;
Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/CompletionContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { splitLines, autoClosingPairClosings } from "./utils";
import { autoClosingPairClosings, splitLines } from "./utils";
import hashObject from "object-hash";

export type CompletionRequest = {
Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/CompletionDebounce.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CompletionRequest, AbortSignalOption } from "./Agent";
import type { AbortSignalOption, CompletionRequest } from "./Agent";
import type { AgentConfig } from "./AgentConfig";
import { splitLines } from "./utils";

Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/StdIO.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import readline from "readline";
import { AgentFunction, AgentEvent, Agent, agentEventNames } from "./Agent";
import { Agent, AgentEvent, agentEventNames, AgentFunction } from "./Agent";
import { rootLogger } from "./logger";
import { isCanceledError } from "./utils";

Expand Down
22 changes: 11 additions & 11 deletions clients/tabby-agent/src/TabbyAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import { EventEmitter } from "events";
import { v4 as uuid } from "uuid";
import deepEqual from "deep-equal";
import { deepmerge } from "deepmerge-ts";
import { getProperty, setProperty, deleteProperty } from "dot-prop";
import createClient from "openapi-fetch";
import { deleteProperty, getProperty, setProperty } from "dot-prop";
import type { ParseAs } from "openapi-fetch";
import createClient from "openapi-fetch";
import type { paths as TabbyApi } from "./types/tabbyApi";
import type {
AbortSignalOption,
Agent,
AgentStatus,
AgentIssue,
AgentEvent,
ClientProperties,
AgentInitOptions,
AbortSignalOption,
ServerHealthState,
AgentIssue,
AgentStatus,
ClientProperties,
CompletionRequest,
CompletionResponse,
LogEventRequest,
ServerHealthState,
} from "./Agent";
import type { DataStore } from "./dataStore";
import { isBlank, abortSignalFromAnyOf, HttpError, isTimeoutError, isCanceledError, errorToString } from "./utils";
import { abortSignalFromAnyOf, errorToString, HttpError, isBlank, isCanceledError, isTimeoutError } from "./utils";
import { Auth } from "./Auth";
import { AgentConfig, PartialAgentConfig, defaultAgentConfig, configFile } from "./AgentConfig";
import { AgentConfig, configFile, defaultAgentConfig, PartialAgentConfig } from "./AgentConfig";
import { CompletionCache } from "./CompletionCache";
import { CompletionDebounce } from "./CompletionDebounce";
import { CompletionContext } from "./CompletionContext";
import { preCacheProcess, postCacheProcess, calculateReplaceRange } from "./postprocess";
import { rootLogger, allLoggers } from "./logger";
import { calculateReplaceRange, postCacheProcess, preCacheProcess } from "./postprocess";
import { allLoggers, rootLogger } from "./logger";
import { AnonymousUsageLogger } from "./AnonymousUsageLogger";
import { CompletionProviderStats, CompletionProviderStatsEntry } from "./CompletionProviderStats";

Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/postprocess/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompletionResponse, CompletionContext } from "../CompletionContext";
import { CompletionContext, CompletionResponse } from "../CompletionContext";
import { rootLogger } from "../logger";

export type PostprocessFilter = (item: string, context: CompletionContext) => string | null | Promise<string | null>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CompletionContext, CompletionResponse } from "../CompletionContext";
import { isBlank, findUnpairedAutoClosingChars } from "../utils";
import { findUnpairedAutoClosingChars, isBlank } from "../utils";
import { logger } from "./base";

export function calculateReplaceRangeByBracketStack(
Expand Down
4 changes: 2 additions & 2 deletions clients/tabby-agent/src/postprocess/dropDuplicated.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompletionContext } from "../CompletionContext";
import { PostprocessFilter, logger } from "./base";
import { splitLines, isBlank, calcDistance } from "../utils";
import { logger, PostprocessFilter } from "./base";
import { calcDistance, isBlank, splitLines } from "../utils";

export function dropDuplicated(): PostprocessFilter {
return (input: string, context: CompletionContext) => {
Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/postprocess/formatIndentation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CompletionContext } from "../CompletionContext";
import { PostprocessFilter, logger } from "./base";
import { logger, PostprocessFilter } from "./base";
import { isBlank, splitLines } from "../utils";

function detectIndentation(lines: string[]): string | null {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompletionContext } from "../CompletionContext";
import { AgentConfig } from "../AgentConfig";
import { PostprocessFilter, logger } from "./base";
import { logger, PostprocessFilter } from "./base";
import { isBlank, splitLines } from "../utils";

function calcIndentLevel(line: string): number {
Expand Down
2 changes: 1 addition & 1 deletion clients/tabby-agent/src/postprocess/limitScopeBySyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type TreeSitterParser from "web-tree-sitter";
import { getParser, languagesConfigs } from "../syntax/parser";
import { typeList } from "../syntax/typeList";
import { CompletionContext } from "../CompletionContext";
import { PostprocessFilter, logger } from "./base";
import { logger, PostprocessFilter } from "./base";

export const supportedLanguages = Object.keys(languagesConfigs);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PostprocessFilter, logger } from "./base";
import { splitLines, isBlank } from "../utils";
import { logger, PostprocessFilter } from "./base";
import { isBlank, splitLines } from "../utils";

const repetitionTests = [
/(.{3,}?)\1{5,}$/g, // match a 3+ characters pattern repeating 5+ times
Expand Down
4 changes: 2 additions & 2 deletions clients/tabby-agent/src/postprocess/removeRepetitiveBlocks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompletionContext } from "../CompletionContext";
import { PostprocessFilter, logger } from "./base";
import { isBlank, calcDistance } from "../utils";
import { logger, PostprocessFilter } from "./base";
import { calcDistance, isBlank } from "../utils";

function blockSplitter(_: string) {
// Have not implemented this for each language for now
Expand Down
4 changes: 2 additions & 2 deletions clients/tabby-agent/src/postprocess/removeRepetitiveLines.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PostprocessFilter, logger } from "./base";
import { splitLines, isBlank, calcDistance } from "../utils";
import { logger, PostprocessFilter } from "./base";
import { calcDistance, isBlank, splitLines } from "../utils";

export function removeRepetitiveLines(): PostprocessFilter {
return (input: string) => {
Expand Down
1 change: 1 addition & 0 deletions clients/tabby-agent/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function findUnpairedAutoClosingChars(input: string): string {
// Such as distance is 9 between `const fooFooFoo = 1;` and `const barBarBar = 1;`, but maybe 1 is enough.
// May be better to count distance based on words instead of characters.
import * as levenshtein from "fast-levenshtein";

export function calcDistance(a: string, b: string) {
return levenshtein.get(a, b);
}
Expand Down
6 changes: 3 additions & 3 deletions clients/vscode/src/TabbyCompletionProvider.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
CancellationToken,
env,
InlineCompletionContext,
InlineCompletionItem,
InlineCompletionItemProvider,
InlineCompletionTriggerKind,
NotebookDocument,
NotebookRange,
Position,
Range,
TextDocument,
NotebookDocument,
NotebookRange,
env,
window,
workspace,
} from "vscode";
Expand Down
4 changes: 2 additions & 2 deletions clients/vscode/src/agent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExtensionContext, workspace, env, version } from "vscode";
import { TabbyAgent, AgentInitOptions, PartialAgentConfig, ClientProperties, DataStore } from "tabby-agent";
import { env, ExtensionContext, version, workspace } from "vscode";
import { AgentInitOptions, ClientProperties, DataStore, PartialAgentConfig, TabbyAgent } from "tabby-agent";

function buildInitOptions(context: ExtensionContext): AgentInitOptions {
const configuration = workspace.getConfiguration("tabby");
Expand Down
10 changes: 5 additions & 5 deletions clients/vscode/src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
commands,
ConfigurationTarget,
env,
ExtensionContext,
InputBoxValidationSeverity,
ProgressLocation,
Uri,
ThemeIcon,
ExtensionContext,
workspace,
Uri,
window,
env,
commands,
workspace,
} from "vscode";
import os from "os";
import { strict as assert } from "assert";
Expand Down
4 changes: 2 additions & 2 deletions clients/vscode/src/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { commands, window, workspace, ConfigurationTarget } from "vscode";
import { commands, ConfigurationTarget, window, workspace } from "vscode";
import type {
ConnectionFailedIssue,
HighCompletionTimeoutRateIssue,
SlowCompletionResponseTimeIssue,
ConnectionFailedIssue,
} from "tabby-agent";
import { agent } from "./agent";

Expand Down
1 change: 1 addition & 0 deletions crates/aim-downloader/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate custom_error;

use custom_error::custom_error;

custom_error! {
Expand Down
6 changes: 3 additions & 3 deletions crates/juniper-axum/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
pub mod extract;
pub mod response;

use std::future;

use axum::{
Expand All @@ -12,6 +9,9 @@ use juniper_graphql_ws::Schema;

use self::{extract::JuniperRequest, response::JuniperResponse};

pub mod extract;
pub mod response;

pub trait FromAuth<S> {
fn build(state: S, bearer: Option<String>) -> Self;
}
Expand Down
1 change: 1 addition & 0 deletions crates/llama-cpp-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[features]
cuda = []
rocm = []
oneapi = []

[build-dependencies]
cxx-build = "1.0"
Expand Down
Loading
Loading