Text Generation
Transformers
Safetensors
qwen2
qwen
qwen2.5-coder
code
fine-tuned
russian
conversational
text-generation-inference
Instructions to use Vilyam888/Broken_Code_Generation.1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vilyam888/Broken_Code_Generation.1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Vilyam888/Broken_Code_Generation.1.0") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Vilyam888/Broken_Code_Generation.1.0") model = AutoModelForCausalLM.from_pretrained("Vilyam888/Broken_Code_Generation.1.0", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Vilyam888/Broken_Code_Generation.1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Vilyam888/Broken_Code_Generation.1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vilyam888/Broken_Code_Generation.1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Vilyam888/Broken_Code_Generation.1.0
- SGLang
How to use Vilyam888/Broken_Code_Generation.1.0 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 "Vilyam888/Broken_Code_Generation.1.0" \ --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": "Vilyam888/Broken_Code_Generation.1.0", "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 "Vilyam888/Broken_Code_Generation.1.0" \ --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": "Vilyam888/Broken_Code_Generation.1.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Vilyam888/Broken_Code_Generation.1.0 with Docker Model Runner:
docker model run hf.co/Vilyam888/Broken_Code_Generation.1.0
Download Dataset_BCG_1example.json from Vilyam888/Broken_Code_Generation.1.0: direct link, hf CLI and curl.
- Browser
- Download file 4.38 kB
-
https://huggingface.co/Vilyam888/Broken_Code_Generation.1.0/resolve/main/Dataset_BCG_1example.json
- Command line
-
hf download hf://Vilyam888/Broken_Code_Generation.1.0/Dataset_BCG_1example.json
-
curl -L -o Dataset_BCG_1example.json https://huggingface.co/Vilyam888/Broken_Code_Generation.1.0/resolve/main/Dataset_BCG_1example.json
4.38 kB
| { | |
| "id": 1, | |
| "title": "Стратифицированный split и масштабирование без data leakage", | |
| "difficulty": "hard", | |
| "topic_tags": { | |
| "Classification": 0.4, | |
| "DataPreprocessing": 0.4, | |
| "ModelSelection": 0.2 | |
| }, | |
| "task_context": "В учебном пайплайне для бинарной классификации нужно подготовить данные перед обучением модели. Текущая реализация допускает утечку данных: она обучает `StandardScaler` на всей выборке до разбиения на train и test, а затем делает разбиение без стратификации. Нужно сначала выполнить `train_test_split` с `test_size=0.2`, `random_state=42`, `stratify=y`, затем обучить `StandardScaler` только на `X_train`, преобразовать `X_train` и `X_test` и вернуть масштабированные выборки вместе с метками и обученным scaler.", | |
| "tests": [ | |
| "import numpy as np", | |
| "X = [[1.0, 10.0], [2.0, 20.0], [3.0, 30.0], [4.0, 40.0], [5.0, 50.0], [6.0, 60.0], [7.0, 70.0], [8.0, 80.0], [9.0, 90.0], [10.0, 100.0]]", | |
| "y = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]", | |
| "X_train_scaled, X_test_scaled, y_train, y_test, scaler = split_and_scale_binary_data(X, y)", | |
| "assert y_train == [1, 0, 0, 0, 1, 1, 1, 0]", | |
| "assert y_test == [0, 1]", | |
| "assert X_train_scaled.shape == (8, 2)", | |
| "assert X_test_scaled.shape == (2, 2)", | |
| "assert np.allclose(scaler.mean_, [5.125, 51.25])", | |
| "assert np.allclose(scaler.scale_, [2.7128168017763383, 27.128168017763382])", | |
| "assert np.allclose(X_train_scaled.mean(axis=0), [0.0, 0.0], atol=1e-12)", | |
| "assert np.allclose(X_test_scaled, [[-0.4146981098256822, -0.4146981098256823], [1.7970251425779564, 1.7970251425779564]])" | |
| ], | |
| "expected_output": "Функция должна вернуть кортеж `(X_train_scaled, X_test_scaled, y_train, y_test, scaler)`, где scaler обучен только на тренировочной части, а разбиение выполнено стратифицированно.", | |
| "input_example": "Пример входа: `X = [[1.0, 10.0], [2.0, 20.0], [3.0, 30.0], [4.0, 40.0], [5.0, 50.0], [6.0, 60.0], [7.0, 70.0], [8.0, 80.0], [9.0, 90.0], [10.0, 100.0]]`, `y = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]`.", | |
| "output_example": "Пример ожидаемого возврата: `y_train = [1, 0, 0, 0, 1, 1, 1, 0]`, `y_test = [0, 1]`, `scaler.mean_ = [5.125, 51.25]`, `scaler.scale_ = [2.7128168017763383, 27.128168017763382]`, `X_test_scaled = [[-0.4146981098256822, -0.4146981098256823], [1.7970251425779564, 1.7970251425779564]]`.", | |
| "requirements": [ | |
| "Сначала выполнить стратифицированное разбиение данных на train и test.", | |
| "Обучить `StandardScaler` только на `X_train`.", | |
| "Преобразовать и `X_train`, и `X_test` одним и тем же scaler.", | |
| "Вернуть результат в порядке `X_train_scaled, X_test_scaled, y_train, y_test, scaler`." | |
| ], | |
| "constraints": [ | |
| "Не менять имя функции `split_and_scale_binary_data`.", | |
| "Не изменять входные `X` и `y` на месте.", | |
| "Не обучать scaler на всей выборке до split.", | |
| "Нельзя хардкодить значения из примеров входа и выхода." | |
| ], | |
| "broken_code": "from sklearn.model_selection import train_test_split\\nfrom sklearn.preprocessing import StandardScaler\\n\\n\\ndef split_and_scale_binary_data(X, y):\\n scaler = StandardScaler()\\n X_scaled = scaler.fit_transform(X) # ВОТ ТУТ НУЖНО ИСПРАВИТЬ КОД: scaler нельзя обучать на всей выборке до split\\n X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size=0.2, random_state=42) # ВОТ ТУТ НУЖНО ИСПРАВИТЬ КОД: нужен stratify=y и split должен быть до масштабирования\\n return X_train, X_test, y_train, y_test, scaler" | |
| } | |