Text Generation
Transformers
Safetensors
English
llama
llama-3
meta
facebook
unsloth
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use zxc4wewewe/usadata with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zxc4wewewe/usadata with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zxc4wewewe/usadata") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zxc4wewewe/usadata") model = AutoModelForCausalLM.from_pretrained("zxc4wewewe/usadata") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zxc4wewewe/usadata with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zxc4wewewe/usadata" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zxc4wewewe/usadata", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zxc4wewewe/usadata
- SGLang
How to use zxc4wewewe/usadata with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zxc4wewewe/usadata" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zxc4wewewe/usadata", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zxc4wewewe/usadata" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zxc4wewewe/usadata", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use zxc4wewewe/usadata with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for zxc4wewewe/usadata to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for zxc4wewewe/usadata to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for zxc4wewewe/usadata to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="zxc4wewewe/usadata", max_seq_length=2048, ) - Docker Model Runner
How to use zxc4wewewe/usadata with Docker Model Runner:
docker model run hf.co/zxc4wewewe/usadata
File size: 2,917 Bytes
9f64888 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
TrainingArguments,
Trainer
)
from datasets import load_dataset
import torch
# 1. Load dataset
dataset = load_dataset("zxc4wewewe/offsec")
# 2. Add labels (required for classification)
# Modify based on your actual classification task:
def add_labels(example):
# Example: Classify if prompt is malicious (1) or benign (0)
# Replace this logic with your actual labels!
malicious_keywords = ['hack', 'exploit', 'crack', 'bypass', 'inject']
text_lower = example["prompt"].lower()
example["labels"] = 1 if any(kw in text_lower for kw in malicious_keywords) else 0
return example
dataset = dataset.map(add_labels)
# 3. Load Tokenizer
tokenizer = AutoTokenizer.from_pretrained("zxc4wewewe/blackthinking")
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
# 4. Tokenize dataset
def tokenize_function(batch):
tokenized = tokenizer(
batch["prompt"],
padding=True,
truncation=True,
max_length=512
)
tokenized["labels"] = batch["labels"]
return tokenized
dataset = dataset.map(tokenize_function, batched=True)
dataset.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])
# 5. Load Model with SafeTensors support
model = AutoModelForSequenceClassification.from_pretrained(
"zxc4wewewe/blackthinking",
num_labels=2,
torch_dtype=torch.float16, # Optional: saves memory
use_safetensors=True # Force SafeTensors loading
)
# 6. Training Arguments with SafeTensors saving
training_args = TrainingArguments(
output_dir="./safetensors_results",
num_train_epochs=3,
per_device_train_batch_size=4,
gradient_accumulation_steps=2,
learning_rate=2e-5,
logging_steps=10,
save_strategy="epoch",
# SafeTensors Configuration
save_safetensors=True, # Save as .safetensors (not .bin)
load_best_model_at_end=True,
# Optional optimizations
fp16=torch.cuda.is_available(), # Use FP16 if GPU available
report_to="none"
)
# 7. Initialize Trainer
trainer = Trainer(
model=model,
args=training_args,
train_dataset=dataset["train"].shuffle(seed=42).select(range(1000)),
eval_dataset=dataset["test"].shuffle(seed=42).select(range(200)) if "test" in dataset else None,
tokenizer=tokenizer,
)
# 8. Train and Save
print("Starting training with SafeTensors format...")
trainer.train()
# Save final model in SafeTensors format
trainer.save_model("./final_safetensors_model")
print("Model saved in SafeTensors format!")
# 9. Verification - Check files
import os
model_path = "./final_safetensors_model"
files = os.listdir(model_path)
print("Saved files:", [f for f in files if f.endswith(('.safetensors', '.json', '.txt'))])
|