forwardrepo

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	HuggingFaceForward = "huggingface"
	ModelScopeForward  = "modelscope"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchTag

type BranchTag struct {
	Name         string `json:"name"`
	TargetCommit string `json:"targetCommit"`
}

type EachRevision

type EachRevision struct {
	Revision string `json:"Revision"`
}

type Forward

type Forward interface {
	Summary(context.Context, ...Option) (string, error)
	Files(context.Context, ...Option) ([]string, error)
	Revisions(context.Context, ...Option) (Revision, error)
	DownloadFile(context.Context, ...Option) ([]byte, error)
}

func NewForward

func NewForward(forwardType string, opts ...Option) (Forward, error)

func NewHuggingFace

func NewHuggingFace(opts ...Option) Forward

func NewModelScope

func NewModelScope(opts ...Option) Forward

type HuggingFace

type HuggingFace struct {
	// contains filtered or unexported fields
}

func (*HuggingFace) DownloadFile

func (h *HuggingFace) DownloadFile(ctx context.Context, opts ...Option) ([]byte, error)

func (*HuggingFace) Files

func (h *HuggingFace) Files(ctx context.Context, opts ...Option) ([]string, error)

func (*HuggingFace) Revisions

func (h *HuggingFace) Revisions(ctx context.Context, opts ...Option) (Revision, error)

func (*HuggingFace) Summary

func (h *HuggingFace) Summary(ctx context.Context, opts ...Option) (string, error)

type Model

type Model struct {
	ID       string    `json:"id"`
	ModelID  string    `json:"modelId"`
	Author   string    `json:"author"`
	SHA      string    `json:"sha"`
	Siblings []Sibling `json:"siblings"`
}

type ModelRevision

type ModelRevision struct {
	Tags     []ModelTagBranch `json:"tags"`
	Branches []ModelTagBranch `json:"branches"`
}

type ModelScope

type ModelScope struct {
	// contains filtered or unexported fields
}

func (*ModelScope) DownloadFile

func (m *ModelScope) DownloadFile(ctx context.Context, opts ...Option) ([]byte, error)

TODO: don't support

func (*ModelScope) Files

func (m *ModelScope) Files(ctx context.Context, opts ...Option) ([]string, error)

TODO: don't support

func (*ModelScope) Revisions

func (m *ModelScope) Revisions(ctx context.Context, opts ...Option) (Revision, error)

func (*ModelScope) Summary

func (m *ModelScope) Summary(ctx context.Context, opts ...Option) (string, error)

type ModelScopeRevision

type ModelScopeRevision struct {
	Code int `json:"Code"`

	Data ModelScopeRevisionData `json:"Data"`

	Message string `json:"Message"`
	Success bool   `json:"Success"`
}

type ModelScopeRevisionData

type ModelScopeRevisionData struct {
	RevisionMap RevisionMap `json:"RevisionMap"`
}

type ModelScopeSummary

type ModelScopeSummary struct {
	Code int `json:"Code"`

	Data ModelScopeSummaryData `json:"Data"`

	Message string `json:"Message"`
	Success bool   `json:"Success"`
}

type ModelScopeSummaryData

type ModelScopeSummaryData struct {
	Name          string `json:"Name"`
	ReadMeContent string `json:"ReadMeContent"`
}

type ModelTagBranch

type ModelTagBranch struct {
	Name         string `json:"name"`
	Ref          string `json:"ref"`
	TargetCommit string `json:"targetCommit"`
}

type Option

type Option func(*option)

func WithBaseURL

func WithBaseURL(url string) Option

func WithDownloadFile

func WithDownloadFile(fn string) Option

func WithHFToken

func WithHFToken(hfToken string) Option

func WithModelID

func WithModelID(modelID string) Option

func WithRevision

func WithRevision(revision string) Option

func WithTransport

func WithTransport(tp *http.Transport) Option

type Revision

type Revision struct {
	Tags     []BranchTag `json:"tags"`
	Branches []BranchTag `json:"branches"`
}

type RevisionMap

type RevisionMap struct {
	Branches []EachRevision `json:"Branches"`
	Tags     []EachRevision `json:"Tags"`
}

type Sibling

type Sibling struct {
	RFileName string `json:"rfilename"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL