Skip to content

Commit

Permalink
Optimize tag detect rule and fix space clone url bug (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
pulltheflower authored Sep 19, 2024
1 parent ef27218 commit ec648c6
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 511 deletions.
5 changes: 4 additions & 1 deletion builder/git/gitserver/gitaly/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gitaly

import (
"context"
"errors"
"fmt"
"io"
"math"
Expand Down Expand Up @@ -142,7 +143,7 @@ func (c *Client) GetSingleCommit(ctx context.Context, req gitserver.GetRepoLastC
if err != nil {
return nil, err
}
if commitResp != nil {
if commitResp != nil && commitResp.Commit != nil {
commit = types.Commit{
ID: string(commitResp.Commit.Id),
CommitterName: string(commitResp.Commit.Committer.Name),
Expand All @@ -160,6 +161,8 @@ func (c *Client) GetSingleCommit(ctx context.Context, req gitserver.GetRepoLastC
})
}

} else {
return nil, errors.New("commit not found")
}
result = types.CommitResponse{
Commit: &commit,
Expand Down
1 change: 0 additions & 1 deletion cmd/csghub-server/cmd/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
func init() {
Cmd.AddCommand(serverCmd)
Cmd.AddCommand(rproxyCmd)
Cmd.AddCommand(syncServerCmd)
}

var Cmd = &cobra.Command{
Expand Down
49 changes: 0 additions & 49 deletions cmd/csghub-server/cmd/start/syncserver.go

This file was deleted.

4 changes: 2 additions & 2 deletions component/tagparser/nameparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ func LibraryTag(filePath string) string {
}

func isPytorch(filename string) bool {
return strings.HasPrefix(filename, "pytorch_model") && strings.HasSuffix(filename, ".bin")
return (strings.HasPrefix(filename, "pytorch_model") && strings.HasSuffix(filename, ".bin")) || strings.HasSuffix(filename, ".pt")
}

func isTensorflow(filename string) bool {
return strings.HasPrefix(filename, "tf_model") && strings.HasSuffix(filename, ".h5")
}
func isSafetensors(filename string) bool {
return strings.HasPrefix(filename, "model") && strings.HasSuffix(filename, ".safetensors")
return strings.HasSuffix(filename, ".safetensors")
}
func isJAX(filename string) bool {
return strings.HasPrefix(filename, "flax_model") && strings.HasSuffix(filename, ".msgpack")
Expand Down
6 changes: 4 additions & 2 deletions component/tagparser/nameparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func TestLibraryTag(t *testing.T) {
{name: "case insensitive", args: args{filePath: "Pytorch_model.Bin"}, want: "pytorch"},

{name: "pytorch", args: args{filePath: "pytorch_model.bin"}, want: "pytorch"},
{name: "pytorch", args: args{filePath: "model.pt"}, want: "pytorch"},
{name: "pytorch", args: args{filePath: "pytorch_model_001.bin"}, want: "pytorch"},
{name: "not pytorch", args: args{filePath: "1-pytorch_model_001.bin"}, want: ""},
{name: "not pytorch", args: args{filePath: "pytorch_model-bin"}, want: ""},
Expand All @@ -25,8 +26,9 @@ func TestLibraryTag(t *testing.T) {

{name: "safetensors", args: args{filePath: "model.safetensors"}, want: "safetensors"},
{name: "safetensors", args: args{filePath: "model_001.safetensors"}, want: "safetensors"},
{name: "not safetensors", args: args{filePath: "1-model.safetensors"}, want: ""},
{name: "not safetensors", args: args{filePath: "model-safetensors"}, want: ""},
{name: "safetensors", args: args{filePath: "adpter_model.safetensors"}, want: "safetensors"},
{name: "not safetensors", args: args{filePath: "1-test.safeten"}, want: ""},
{name: "not safetensors", args: args{filePath: "test-safetensors"}, want: ""},

{name: "flax_model", args: args{filePath: "flax_model.msgpack"}, want: "jax"},
{name: "flax_model", args: args{filePath: "flax_model-001.msgpack"}, want: "jax"},
Expand Down
53 changes: 0 additions & 53 deletions multisync/accounting/aync_quota_statement.go

This file was deleted.

135 changes: 0 additions & 135 deletions multisync/accounting/client.go

This file was deleted.

52 changes: 0 additions & 52 deletions multisync/accounting/sync_quota.go

This file was deleted.

Loading

0 comments on commit ec648c6

Please sign in to comment.