Text Generation
PEFT
Safetensors
English
pyspark
data-engineering
code-generation
qlora
lora
delta-lake
conversational
Instructions to use hoodarunner/pyspark-coding-assistant-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use hoodarunner/pyspark-coding-assistant-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3") model = PeftModel.from_pretrained(base_model, "hoodarunner/pyspark-coding-assistant-lora") - Notebooks
- Google Colab
- Kaggle
| id: agg_count_null_semantics | |
| category: aggregations | |
| difficulty: medium | |
| probes: > | |
| count(*) counts rows, count(col) skips NULLs, countDistinct(col) skips NULLs | |
| and dedups. Three counts that differ only because of NULL handling. Models | |
| reach for count("*") for all three, or use count("col") where the prompt | |
| asked for rows. | |
| tags: [count, null_semantics, distinct] | |
| prompt: | | |
| For each dept in `staff`, return one row with: | |
| - n_rows the number of rows in the group | |
| - n_emails the number of rows whose email is not null | |
| - n_distinct the number of distinct non-null emails | |
| Return columns: dept, n_rows, n_emails, n_distinct. | |
| fixtures: | |
| - name: staff | |
| schema: dept STRING, name STRING, email STRING | |
| rows: | |
| - ["eng", "ann", "a@x.com"] | |
| - ["eng", "bob", null] | |
| - ["eng", "cal", "a@x.com"] | |
| - ["eng", "dee", "d@x.com"] | |
| - ["ops", "eve", null] | |
| - ["ops", "fay", null] | |
| solution: | | |
| from pyspark.sql import functions as F | |
| def solve(spark, staff): | |
| return staff.groupBy("dept").agg( | |
| F.count(F.lit(1)).alias("n_rows"), | |
| F.count("email").alias("n_emails"), | |
| F.countDistinct("email").alias("n_distinct"), | |
| ) | |
| compare: | |
| mode: rows | |
| check_schema: false | |