Text Generation
Transformers
Safetensors
English
llama
llama-3
meta
facebook
unsloth
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use zxc4wewewe/llm-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zxc4wewewe/llm-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zxc4wewewe/llm-model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zxc4wewewe/llm-model") model = AutoModelForCausalLM.from_pretrained("zxc4wewewe/llm-model") 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/llm-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zxc4wewewe/llm-model" # 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/llm-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zxc4wewewe/llm-model
- SGLang
How to use zxc4wewewe/llm-model 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/llm-model" \ --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/llm-model", "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/llm-model" \ --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/llm-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use zxc4wewewe/llm-model 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/llm-model 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/llm-model to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for zxc4wewewe/llm-model to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="zxc4wewewe/llm-model", max_seq_length=2048, ) - Docker Model Runner
How to use zxc4wewewe/llm-model with Docker Model Runner:
docker model run hf.co/zxc4wewewe/llm-model
| 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'))]) | |