Huggingface.js documentation
インターフェース: CommitEditFile
@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
インターフェース: CommitEditFile
既存のファイルを編集するには、元のコンテンツのバイト範囲を置き換えます。
originalContentがXetBlobである場合(xetバックエンドのファイルに対してdownloadFileが返すもの)、ファイルの未変更部分はダウンロードも再チャンク化もされません。CASサーバーがチャンク境界に整列した編集ウィンドウと部分的なMerkleデータ(GET /v2/file-chunk-hashes)を提供するため、変更された領域(およびそのチャンク境界の近傍)のみが取得、再チャンク化、ハッシュ化されます。
- バケット(sha256は関与しない)の場合、これは編集および追記において、変更されていないデータのダウンロードが一切不要であることを意味します。
- モデル/データセット/スペースの場合、変更されていないデータは、新しいファイルのsha256を計算するために1回だけストリーミングされます(LFSプロトコルで必要)。2回(sha256 + チャンク分割)ではありません。
originalContentが他のBlobである場合、コンテンツ全体がローカルで再チャンク化され、変更されていないチャンクはリモートに対して重複排除されます(アップロードはスキップされますが、コンテンツは完全に読み取られます)。
プロパティ
編集
• edits: { content: Blob ; end: number ; start: number }[]
定義場所
packages/hub/src/lib/commit.ts:76
操作
• 操作: "edit"
定義場所
packages/hub/src/lib/commit.ts:72
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
後で、ContentSourceになります。現時点では、ブロブを処理する方が簡単です
定義場所
packages/hub/src/lib/commit.ts:75
path
• path: string
定義場所
packages/hub/src/lib/commit.ts:73
Update on GitHub