This is a fine tune of Qwen3 4B Thinking 2507 on Gemini 2.5 Flash and Gemini 3.0 Preview's outputs.

  • Developed by: qingy2024
  • License: apache-2.0
  • Finetuned from model : qingy2024/Gem-4B-Thinking (stage 1 model)
  • Method: 16-bit LoRA, two-stage fine tuning process.
  • Hardware: 1 x L40S (6 hours total training time)
  • Training Library: Unsloth

Example Output

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "qingy2024/Refined-Gem-4B-Thinking"

# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)

# prepare the model input
prompt = "What is PyTorch?"
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    do_sample = True,
    temperature = 0.4,
    max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()

# parsing thinking content
try:
    # rindex finding 151668 (</think>)
    index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
    index = 0

print(tokenizer.decode(output_ids))

Output:


<think>

Understanding PyTorch's Essence

I'm now zeroing in on defining PyTorch's core purpose. It's clear that I need to articulate its role as a deep learning framework, but I'm also considering how to succinctly convey its unique selling points. I'm focusing on the "why" behind its popularity, aiming for a concise yet informative definition.

Defining PyTorch's Scope

I'm now expanding the definition to include the framework's key features. I'm focusing on its "Python-first" approach and dynamic computation graphs, which are central to its appeal. I'm also considering its versatility, encompassing various deep learning tasks and deployment scenarios. The goal is to provide a comprehensive overview that highlights its strengths.

Elaborating PyTorch's Features

I'm now detailing PyTorch's key features, focusing on its dynamic computation graphs and Python-first approach. I'm also considering its versatility, encompassing various deep learning tasks and deployment scenarios. I'm aiming for a concise yet informative definition that highlights its strengths. I'm focusing on the practical implications of these features, like ease of use and flexibility.

Summarizing PyTorch's Core

I'm now consolidating the key points. I'm focusing on PyTorch's role as a deep learning framework, highlighting its Python-first approach, dynamic computation graphs, and versatility. I'm aiming for a concise definition that captures its essence and appeal, emphasizing its strengths and practical applications.

Defining PyTorch's Core

I'm now revisiting the core definition, refining the language. I'm focusing on the Python-first approach and dynamic computation graphs, which are central to its appeal. I'm also considering its versatility, encompassing various deep learning tasks and deployment scenarios. The goal is to provide a comprehensive overview that highlights its strengths.

Summarizing PyTorch's Core

I'm now consolidating the key points. I'm focusing on PyTorch's role as a deep learning framework, highlighting its Python-first approach, dynamic computation graphs, and versatility. I'm aiming for a concise definition that captures its essence and appeal, emphasizing its strengths and practical applications. I'm also considering how to structure the information for optimal clarity. </think>

PyTorch is an open-source machine learning framework that is widely used for developing and training deep learning models. It is particularly known for its flexibility, ease of use, and dynamic computation graph capabilities.

Here are its key characteristics:

  1. Python-first: PyTorch is built on Python, making it highly accessible for data scientists and machine learning engineers who are already familiar with the language. It integrates seamlessly with other Python libraries like NumPy, Pandas, Matplotlib, and Jupyter Notebooks.

  2. Dynamic Computation Graph (TorchScript): Unlike some static graph frameworks (like TensorFlow's initial version), PyTorch builds a graph of operations on the fly as the code is executed. This offers greater flexibility and ease of debugging, as you can inspect the graph at runtime. However, for production deployment, PyTorch provides TorchScript to convert these dynamic graphs into a more optimized, static format for better performance.

  3. Tensors: At its core, PyTorch is built around tensors, which are multi-dimensional arrays similar to NumPy arrays but with additional functionality for GPU acceleration and automatic differentiation. This makes it ideal for representing data in neural networks.

  4. Automatic Differentiation (Autograd): PyTorch's torch.autograd module automatically computes gradients (derivatives) for tensors. This is crucial for training neural networks, as it allows models to learn by adjusting their weights based on the error of their predictions.

  5. GPU Acceleration: PyTorch leverages CUDA (Compute Unified Device Architecture) to accelerate computations on NVIDIA GPUs, significantly speeding up training times for deep learning models.

  6. Community and Ecosystem: PyTorch has a vibrant community and a rich ecosystem of pre-trained models, datasets, and tools (like torchvision for computer vision, torchaudio for audio processing, and torchtext for text processing).

  7. Research and Industry Adoption:

    • Research: PyTorch is the preferred framework for many researchers due to its dynamic nature and ease of experimentation. Many groundbreaking deep learning models (like those developed by Facebook AI Research - FAIR) were initially built and published using PyTorch.
    • Industry: It's widely adopted in industries like computer vision (e.g., image recognition, object detection), natural language processing (e.g., chatbots, translation), and reinforcement learning.

In summary, PyTorch is a powerful, flexible, and user-friendly deep learning framework that allows developers and researchers to build, train, and deploy sophisticated neural network models efficiently.<|im_end|>


Downloads last month
213
Safetensors
Model size
4B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for qingy2024/Refined-Gem-4B-Thinking

Finetuned
(1)
this model
Quantizations
2 models