Text Generation
Transformers
Safetensors
qwen2
natural-language-autoencoder
activation-reconstructor
interpretability
affect
conversational
text-generation-inference
Instructions to use MaxChess/qwen2.5-7b-nla-affect-ar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaxChess/qwen2.5-7b-nla-affect-ar with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaxChess/qwen2.5-7b-nla-affect-ar") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MaxChess/qwen2.5-7b-nla-affect-ar") model = AutoModelForCausalLM.from_pretrained("MaxChess/qwen2.5-7b-nla-affect-ar", device_map="auto") 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 Settings
- vLLM
How to use MaxChess/qwen2.5-7b-nla-affect-ar with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaxChess/qwen2.5-7b-nla-affect-ar" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaxChess/qwen2.5-7b-nla-affect-ar", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MaxChess/qwen2.5-7b-nla-affect-ar
- SGLang
How to use MaxChess/qwen2.5-7b-nla-affect-ar 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 "MaxChess/qwen2.5-7b-nla-affect-ar" \ --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": "MaxChess/qwen2.5-7b-nla-affect-ar", "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 "MaxChess/qwen2.5-7b-nla-affect-ar" \ --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": "MaxChess/qwen2.5-7b-nla-affect-ar", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MaxChess/qwen2.5-7b-nla-affect-ar with Docker Model Runner:
docker model run hf.co/MaxChess/qwen2.5-7b-nla-affect-ar
| kind: nla_model | |
| schema_version: 2 | |
| role: ar | |
| stage: sft | |
| base_checkpoint: /home/sparrow/NLAmodel/models/qwen2.5-7b-instruct | |
| d_model: 3584 | |
| extraction: | |
| injection_scale: 150.0 | |
| mse_scale: 59.86651818838306 | |
| tokens: | |
| injection_char: "\u320E" | |
| injection_token_id: 149705 | |
| injection_left_neighbor_id: 29 | |
| injection_right_neighbor_id: 522 | |
| critic_suffix_ids: | |
| - 1318 | |
| - 29 | |
| - 366 | |
| - 1708 | |
| - 29 | |
| prompt_templates: | |
| av: 'You are a meticulous AI researcher conducting an important investigation into | |
| activation vectors from a language model. Your overall task is to describe the | |
| semantic content of that activation vector. | |
| We will pass the vector enclosed in <concept> tags into your context. You must | |
| then produce an explanation for the vector, enclosed within <explanation> tags. | |
| The explanation consists of 2-3 text snippets describing that vector. | |
| Here is the vector: | |
| <concept>{injection_char}</concept> | |
| Please provide an explanation.' | |
| ar: 'Summary of the following text: <text>{explanation}</text> <summary>' | |
| critic: | |
| extraction_layer_index: 20 | |
| trained_on: | |
| - /home/sparrow/NLAmodel/experiments/Exp16_affect_av_dataset/runs/production10000_clean_sources/dataset/records.jsonl | |
| parent_checkpoints: | |
| - /home/sparrow/NLAmodel/models/qwen2.5-7b-instruct | |
| created_by: Exp18_affect_ar_sft.train_ar_sft | |
| training: | |
| optimizer_steps: 209 | |
| learning_rate: 6.12e-06 | |
| global_batch_size: 24 | |
| num_epoch: 1 | |
| loss_type: direction_only_normalized_mse | |
| mse_scale: 59.86651818838306 | |
| dataset: /home/sparrow/NLAmodel/experiments/Exp16_affect_av_dataset/runs/production10000_clean_sources/dataset/records.jsonl | |