Huggingface.js documentation
インターフェース: CommitEditFileParams
@huggingface/inference
Inference Client を使用API リファレンス
クラス
HfInferenceInferenceClientInferenceClientEndpointInferenceClientErrorInferenceClientHubApiErrorInferenceClientInputErrorInferenceClientProviderApiErrorInferenceClientProviderOutputErrorInferenceClientRoutingError
インターフェース
AudioToAudioOutputAudioToAudioOutputElemBaseArgsBodyParamsHeaderParamsInferenceProviderMappingEntryLoggerオプションTextGenerationInputTextGenerationOutputTextGenerationStreamBestOfSequenceTextGenerationStreamDetailsTextGenerationStreamOutputTextGenerationStreamPrefillTokenTextGenerationStreamTokenUrlParams
モジュール
@huggingface/hub
Hub とのインタラクションAPI リファレンス
クラス
インターフェース
AuthInfoCachedFileInfoCachedRepoInfoCachedRevisionInfoCommitCopyFileCommitDataCommitDeletedEntryCommitEditFileCommitEditFileParamsCommitFileCommitInfoCommitOutputCopyDestinationCopyFilesEntryCopyProgressEventCopySource認証情報DatasetEntryFileDownloadInfoOutputHFCacheInfoJobVolumeLfsPathInfoListFileEntryMlxQuantizationConfigModelConfigModelDerivedFieldsModelEntryOAuthResultParallelDownloadOptionsPathInfoQuantizationConfigRangeEditCacheEntryRepoIdSafetensorsIndexJsonSafetensorsShardFileInfoSecurityFileStatusSpaceEntrySpaceResourceConfigSpaceResourceRequirementSpaceRuntimeTensorInfoUserInfoWhoAmIAppWhoAmIOrgWhoAmIUserXetFileInfoXetReadToken
@huggingface/mcp-client
@huggingface/tiny-agents
@huggingface/space-header
@huggingface/gguf
@huggingface/lerobot
@huggingface/usd-web-viewer
インターフェース: CommitEditFileParams
…
originalContentがxetバックエンドのファイルのdownloadFileから来的时候、変更されていない部分はダウンロードも再アップロードもされません。転送されるのは、変更されたバイト範囲(およびそのチャンク境界の近傍)のみです。バケットへのアップロードの場合、変更されていないデータを一切ダウンロードせずに、完全にリモートで動作します。
Example
const original = await downloadFile({ repo: "buckets/me/repo", path: "model.gguf" });
await uploadFile({
repo: "buckets/me/repo",
file: {
path: "model.gguf",
originalContent: original,
edits: [{ start: 0, end: 100, content: new Blob([patchedHeader]) }],
},
});プロパティ
編集
• edits: { content: Blob ; end: number ; start: number }[]
定義場所
packages/hub/src/lib/upload-file.ts:29
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, dim, num_heads): super().__init__() self.num_heads = num_heads self.head_dim = dim // num_heads self.qkv = nn.Linear(dim, 3 * dim) self.out = nn.Linear(dim, dim) def forward(self, x): b, n, d = x.shape qkv = self.qkv(x).reshape(b, n, 3, self.num_heads, self.head_dim).permute(2, 0, 3, 1, 4) q, k, v = qkv.unbind(0) attn = F.scaled_dot_product_attention(q, k, v) out = attn.permute(1, 3, 2, 4).reshape(b, n, d) return self.out(out)
• originalContent: Blob
ファイルの現在の内容(downloadFileによって返されるものなど)
定義場所
packages/hub/src/lib/upload-file.ts:28
path
• path: string
定義場所
packages/hub/src/lib/upload-file.ts:26
Update on GitHub