跳到主要内容

Model Guide

AtomGit provides a rich set of model resources, which you can easily create, search, download, and use. This guide will help you understand how to perform model-related operations on the platform.

Model Creation

Create a New Model

  1. Log in to your AtomGit account
  2. Click "+" at the top right > "New Model"
  3. Fill in the basic information of the model:
    • Model ID
    • Model Name
    • Select a LICENSE template
    • Choose whether to make it public
  4. Select a LICENSE template:
    • PyTorch Creative Commons Attribution Non Commercial 3.0
    • Creative Commons Attribution Non Commercial No Derivatives 3.0
    • Creative Commons Attribution Non Commercial Share Alike 2.0
    • Creative Commons Attribution Non Commercial Share Alike 3.0
    • H Research License
    • Open Model, Data & Weights License Agreement
    • Unknown
  5. Click "Create Model" to complete

Model creation page screenshot Model creation page screenshot

Model Configuration File

Each model requires a model-config.yaml configuration file, as shown in the example:

model-name: my-awesome-model
version: 1.0.0
framework: pytorch
task: image-classification
dependencies:
- torch>=2.0.0
- transformers>=4.30.0
  1. Enter a keyword in the search box
  2. Use filters to sort:
    • Task type
    • Framework
    • License
    • Download count
    • Update time

The following advanced search syntax is supported:

  • framework:pytorch - Search by framework
  • task:nlp - Search by task type
  • stars:>100 - Search by star count
  • language:python - Search by programming language

Model Download

Download Using Web Interface

  1. Go to the model details page
  2. Click the "Download" button
  3. Choose version and format

Download Using Command Line

# Install GitCode CLI
pip install gitcode

# Download model
gitcode download username/model-name

# Download specific version
gitcode download username/model-name --version v1.0.0

Model Usage

Python Code Example

from gitcode_hub import load_model

# Load model
model = load_model("username/model-name")

# Use model for inference
result = model.predict(input_data)

API Call Example

import requests

API_URL = "https://api.gitcode.com/v1/models/username/model-name"
headers = {"Authorization": f"Bearer {API_TOKEN}"}

def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()

# Send inference request
output = query({
"inputs": "Hello, World!" ,
})

Best Practices

  1. Version Control

    • Use semantic version numbers
    • Maintain backward compatibility
    • Record version change logs
  2. Documentation

    • Provide detailed model descriptions
    • Include usage examples
    • Explain model limitations and notes
  3. Performance Optimization

    • Provide quantized model versions
    • Support batch inference
    • Optimize inference speed
  4. Security

    • Conduct model security testing
    • Provide model cards describing potential risks
    • Comply with data privacy requirements

Frequently Asked Questions

Q: How do I update a published model? A: You can publish a new version through the version management feature, or update the files of the existing version.

Q: What formats does the model support? A: It supports mainstream deep learning framework formats, including PyTorch, TensorFlow, ONNX, etc.

Q: How to handle model dependencies? A: Declare dependencies in model-config.yaml, or provide a requirements.txt file.