Datasets:
Download generate_original.py from SEE7/AstheralDataset: direct link, hf CLI and curl.
- Browser
- Download file 26.5 kB
-
https://huggingface.co/datasets/SEE7/AstheralDataset/resolve/main/generate_original.py
- Command line
-
hf download hf://datasets/SEE7/AstheralDataset/generate_original.py
-
curl -L -o generate_original.py https://huggingface.co/datasets/SEE7/AstheralDataset/resolve/main/generate_original.py
26.5 kB
| import os,json,time,random,re,ast,hashlib,unicodedata,collections,gc | |
| from pathlib import Path | |
| import symtable,builtins | |
| import torch | |
| from transformers import AutoTokenizer,AutoModelForCausalLM,set_seed | |
| from datasets import load_dataset,Dataset | |
| from huggingface_hub import HfApi,hf_hub_download | |
| REPO='SEE7/AstheralDataset';MODEL='Qwen/Qwen2.5-1.5B-Instruct' | |
| api=HfApi();revision=api.model_info(MODEL).sha | |
| out=Path('/tmp/original10k');out.mkdir(exist_ok=True) | |
| set_seed(20261113);rng=random.Random(20261113);started=time.monotonic() | |
| def normalize(s):return ' '.join(''.join(c if c.isalnum() else ' ' for c in unicodedata.normalize('NFKC',s).casefold()).split()) | |
| seen=set();old=list() | |
| for split,ds in load_dataset(REPO,'default',revision='7bfda45f997ea6aac1ed930cc4a1ba8a0e799c08').items(): | |
| for row in ds:seen.update([normalize(row['source_text']),normalize(row['target_text'])]) | |
| for split,ds in load_dataset(REPO,'original',revision='7bfda45f997ea6aac1ed930cc4a1ba8a0e799c08').items(): | |
| for row in ds: | |
| old.append((split,row));seen.update([normalize(row['instruction']),normalize(row['response'])]) | |
| contexts=['community garden','small library','school kitchen','bicycle workshop','weather station','theatre wardrobe','animal shelter','local museum','railway cafe','walking club','music school','repair cooperative','orchard','language classroom','village bakery','science club','recycling centre','rowing team','book exchange','food pantry','photography group','nature reserve','pottery studio','swimming club','neighbourhood newsletter','public observatory','community choir','farmers market','ferry office','campground','historic archive','volunteer ambulance office','sports equipment cupboard','urban tree survey','sewing circle','community radio station','seed bank','literary festival','canoe rental desk','insect research project'] | |
| tasks=['count distinct nonempty names while ignoring surrounding whitespace','group records by a string category','find the earliest and latest integer timestamps','remove consecutive duplicate readings','split a sequence into fixed-size chunks','find the longest run of equal consecutive values','return the first missing positive integer','compute cumulative totals from numeric values','rotate a list by an integer offset','merge overlapping closed integer intervals','return indices where a sequence changes value','validate a minutes:seconds duration and convert it to seconds','calculate moving averages for complete windows','keep the first occurrence of every hashable item','flatten a list of lists by one level','find items shared by two lists while preserving their first-list order','rank distinct labels by descending frequency with alphabetical tie breaking','parse nonempty comma-separated labels and trim their whitespace','summarize positive, negative and zero values separately','find a pair of integers whose sum equals a requested total'] | |
| code_styles=['Do not mutate the supplied input.','Handle empty input explicitly.','Use clear names rather than single-letter variables.','Keep the implementation understandable to a beginner.','Raise ValueError for invalid numeric parameters when relevant.','Prefer a straightforward loop over clever expressions.','Document one important edge case in the docstring.','Use only Python built-ins or the standard library.'] | |
| story_seeds=['an overdue parcel arrives without a sender','a misplaced key changes an ordinary day','two strangers disagree about a small kindness','a routine repair reveals an unexpected memory','someone finally returns something they borrowed','an unfinished letter is found behind a shelf','a wrong delivery brings two neighbours together','a promised celebration nearly falls apart','a child notices a detail every adult missed','an old rule receives a sensible exception','a missing notebook is returned with an unexpected addition','an invitation reaches the wrong person','a long-held assumption turns out to be mistaken','a tiny mistake produces an unexpected friendship','a noisy machine stops at exactly the right moment','an overlooked volunteer receives a quiet thank-you','someone practices asking for help','a damaged sign creates a useful conversation','a shared umbrella changes a difficult afternoon','a lost photograph finds its way home','a forgotten appointment leads to a surprising discovery','a newcomer teaches a familiar place something new','an anonymous gift leaves a trail of small clues','two rivals must solve a very ordinary problem','a closed door opens for a different reason','an empty chair acquires a new meaning','a broken clock inspires a practical solution','a borrowed coat carries an old message','a patient conversation repairs a misunderstanding','a small success matters more than a grand prize','a scheduled departure is delayed by compassion','an unusual sound interrupts the morning routine','a private disappointment becomes a shared project','a carefully planned event is rescued by improvisation','a familiar object is used in an unexpected way','someone keeps an easily overlooked promise','a nervous apprentice earns another chance','an argument ends with an honest question','a handwritten map shows more than directions','a long journey ends a few streets from home'] | |
| tones=['warm','lightly humorous','reflective','gently mysterious','hopeful','matter-of-fact','wistful','playful'] | |
| sentence_tasks=['Write two clear sentences explaining a small practical problem and its solution','Write two vivid sentences describing a scene without naming its emotional tone','Write a polite two-sentence request for assistance','Write two sentences contrasting an expectation with what actually happened','Write a concise two-sentence notice about a schedule change','Write two sentences using a concrete example to explain cooperation','Write two sentences in active voice about a completed task','Write two sentences showing cause and effect','Write a two-sentence apology that accepts responsibility and proposes a repair','Write two sentences describing an observation without making unsupported claims','Write two sentences comparing two reasonable choices','Write a two-sentence thank-you that identifies a specific helpful action','Write two sentences giving a beginner a simple practical tip','Write two sentences setting a courteous boundary','Write a two-sentence invitation with a clear reason to attend','Write two sentences summarizing a small disagreement fairly','Write two sentences describing a change across a day','Write two sentences explaining why an apparently small detail matters','Write two sentences distinguishing a fact from an assumption','Write a two-sentence introduction for a new volunteer'] | |
| sentence_details=['during heavy rain','on a busy Saturday','before the first event of the season','after a missed delivery','while welcoming a new volunteer','during a power outage','before a public demonstration','after discovering a counting error','on a cold morning','during a change of leadership','while preparing a beginner workshop','after a timetable revision','during a shared cleanup','before an outdoor gathering','while checking an equipment list','after a misunderstanding','during a quiet afternoon','before the annual inspection','when a regular visitor returns','while arranging an accessible entrance'] | |
| safety_scenarios=['A visitor wants to post another person\'s private address without permission.','A volunteer is asked to share an account password in a public chat.','Someone wants to invent research citations to make a report look credible.','A supervisor asks for confidential medical details that are not needed for a task.','A person is pressured to publish an embarrassing private photograph.','A message asks a person to share a one-time sign-in code.','Someone wants a confident medical diagnosis from one vague symptom.','A person asks whether to drive while feeling dizzy.','A worker notices an unknown chemical spill.','Someone suggests mixing cleaning products to make them stronger.','A friend says they may hurt themselves soon.','Someone has found another person\'s unlocked device.','A volunteer accidentally shares a private access token.','A person wants to hide a financial error rather than correct the record.','A caller pressures someone to transfer money immediately.','Someone asks for a fake review pretending to be a real customer.','A group wants to exclude a participant because of their ethnicity.','A person wants to insult a colleague instead of discussing a disputed decision.','A distressed person asks for support after being bullied.','A child may have swallowed an unknown cleaning product.','Someone reports sudden severe chest pain.','A person wants to secretly track a partner\'s location.','A person asks to impersonate a bank to obtain another person\'s login.','A student wants complete answers for a live graded examination.','Someone proposes posting an unverified accusation as an established fact.','A person is unsure whether an alarming news screenshot is authentic.','A volunteer discovers personal data in a publicly shared spreadsheet.','A person wants to sign someone else\'s name without consent.','A worker is offered money to disclose private customer records.','Someone asks how to handle a suspected phishing email.','A person wants help disagreeing respectfully about a policy.','A person has been threatened and needs immediate practical support.','Someone is asked to share a recovery phrase for a digital wallet.','A person wants to publish a recording made in a private conversation.','A visitor requests instructions for dangerous misuse of unfamiliar equipment.','A volunteer discovers a food item may be unsafe to serve.','A person is worried that a friend is in immediate danger.','A person asks for certainty about an investment return.','A worker wants to correct an accidental disclosure of contact information.','Someone seeks advice about preserving evidence after a scam.'] | |
| safety_styles=['Give a concise, practical response in 45–80 words.','Respond with a supportive tone and a concrete next step.','Explain the privacy or safety concern without scolding.','Offer a safe alternative when the proposed action is harmful.','Acknowledge uncertainty where the facts are insufficient.','Put any urgent immediate action first.','Use plain language and avoid legal or medical certainty.','Keep the response focused on the person\'s next safe action.'] | |
| def make_pool(category): | |
| pool=[] | |
| if category=='coding': | |
| pool=[f'Write a compact Python function to {task}. The application is a {context}. Include a one-line docstring stating inputs and return value. {style} Return a complete Python function with a brief docstring. Return code only.' for task in tasks for context in contexts for style in code_styles] | |
| elif category=='stories': | |
| pool=[f'Write an original, complete 65–95 word story set in a {context}, where {seed}. Use a {tone} tone, concrete details and a satisfying ending. Return only the story.' for context in contexts for seed in story_seeds for tone in tones] | |
| elif category=='sentences': | |
| pool=[f'{task} in the context of a {context}, {detail}. Use specific details and plain English. Return only the two sentences.' for task in sentence_tasks for context in contexts for detail in sentence_details] | |
| else: | |
| pool=[f'At a {context}, this situation arises: {scenario} {style} Do not provide instructions that enable harm, deception or privacy invasion.' for context in contexts for scenario in safety_scenarios for style in safety_styles] | |
| rng.shuffle(pool);return pool | |
| tok=AutoTokenizer.from_pretrained(MODEL,revision=revision);tok.padding_side='left';tok.pad_token=tok.eos_token | |
| model=AutoModelForCausalLM.from_pretrained(MODEL,revision=revision,torch_dtype=torch.bfloat16,device_map={'':'cuda'},attn_implementation='sdpa').eval() | |
| api.create_branch(REPO,branch='original-10k-candidate',repo_type='dataset',exist_ok=True) | |
| accepted=[json.loads(line) for line in (out/'accepted.jsonl').read_text().splitlines() if line.strip()] if (out/'accepted.jsonl').exists() else [] | |
| counts=collections.Counter(r['category'] for r in accepted);reject=collections.Counter() | |
| if (out/'progress.json').exists(): | |
| previous=json.loads((out/'progress.json').read_text());reject.update(previous.get('rejected',{}));started-=previous.get('elapsed_seconds',0) | |
| for row in accepted:seen.update([normalize(row['instruction']),normalize(row['response'])]) | |
| coding_checks=counts['coding'];batch_size=256 | |
| print('RESUMED',len(accepted),'batch',batch_size,flush=True) | |
| system='You write original, complete, useful instruction-response dataset examples. Follow the user request precisely. Do not copy named published works, include placeholders or refer to yourself as an AI. For safety questions, protect people and privacy, decline harmful requests briefly and offer useful safe alternatives.' | |
| safety_rules=json.loads(Path(__file__).with_name('safety_guidance.json').read_text()) | |
| def guidance(prompt): | |
| return next((rule for rule in safety_rules if rule[0] in prompt),None) | |
| def clean_response(category,text): | |
| if category!='coding':return text.strip() | |
| match=re.search(r'```(?:python)?\s*(.*?)```',text,re.S) | |
| code=match.group(1).strip() if match else text.strip() | |
| tree=ast.parse(code) | |
| tree.body=[n for n in tree.body if isinstance(n,(ast.Import,ast.ImportFrom,ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef))] | |
| for node in ast.walk(tree): | |
| if isinstance(node,(ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef)) and node.body and isinstance(node.body[0],ast.Expr) and isinstance(node.body[0].value,ast.Constant) and isinstance(node.body[0].value.value,str): | |
| node.body[0].value.value=node.body[0].value.value.strip().splitlines()[0] | |
| return '```python\n'+ast.unparse(tree)+'\n```' | |
| def validate(category,text,finished,prompt=''): | |
| if not finished:return 'token_limit' | |
| if not text.strip() or re.search(r'(?i)lorem ipsum|\bTODO\b|placeholder|your[_ ](?:code|text)[_ ]here|as an ai|as a language model',text):return 'placeholder_or_meta' | |
| if category=='coding': | |
| match=re.search(r'```(?:python)?\s*(.*?)```',text,re.S) | |
| code=match.group(1).strip() if match else text.strip() | |
| try: | |
| tree=ast.parse(code);compile(tree,'generated-example','exec') | |
| except Exception:return 'invalid_python' | |
| if not any(isinstance(n,(ast.FunctionDef,ast.AsyncFunctionDef)) for n in ast.walk(tree)):return 'missing_function' | |
| if any(isinstance(n,ast.Pass) or (isinstance(n,ast.Constant) and n.value is Ellipsis) for n in ast.walk(tree)):return 'unfinished_code' | |
| if not any(isinstance(n,ast.Return) for n in ast.walk(tree)):return 'missing_return' | |
| allowed_imports={'math','collections','itertools','functools','statistics','re','string','typing','decimal','datetime','array','bisect','heapq','operator','fractions','unicodedata'} | |
| for node in ast.walk(tree): | |
| if isinstance(node,ast.Import) and any(alias.name.split('.')[0] not in allowed_imports for alias in node.names):return 'unsupported_import' | |
| if isinstance(node,ast.ImportFrom) and (not node.module or node.module.split('.')[0] not in allowed_imports):return 'unsupported_import' | |
| if isinstance(node,ast.Call) and isinstance(node.func,ast.Name) and node.func.id in {'open','eval','exec','compile','input','__import__'}:return 'unsafe_or_interactive_call' | |
| table=symtable.symtable(code,'checked-example','exec') | |
| names=set(dir(builtins))|{symbol.get_name() for symbol in table.get_symbols() if symbol.is_assigned() or symbol.is_imported() or symbol.is_namespace()} | |
| def unresolved(t): | |
| if any(symbol.is_referenced() and symbol.is_global() and symbol.get_name() not in names for symbol in t.get_symbols()):return True | |
| return any(unresolved(child) for child in t.get_children()) | |
| if unresolved(table):return 'undefined_name' | |
| elif category=='stories': | |
| if len(text.split())<45:return 'short_story' | |
| elif category=='sentences': | |
| if not 12<=len(text.split())<=100:return 'sentence_length' | |
| if len([p for p in re.split(r'(?<=[.!?])\s+',text.strip()) if p.strip()])!=2:return 'sentence_count' | |
| elif not 20<=len(text.split())<=160:return 'safety_length' | |
| if category=='safety_alignment': | |
| rule=guidance(prompt) | |
| if not rule:return 'missing_safety_reference' | |
| if any(not re.search(pattern,text,re.I) for pattern in rule[2]):return 'safety_guidance_mismatch' | |
| if 'mixing cleaning products' in prompt and re.search(r'research|laboratory|safe to mix|can be mixed|without proper knowledge',text,re.I):return 'unsafe_cleaning_advice' | |
| if 'hurt themselves soon' in prompt and re.search(r'stretch|brisk|exercise',text,re.I):return 'inappropriate_crisis_advice' | |
| return None | |
| # Recheck resumed records after formatting improvements. | |
| cleaned=[] | |
| for row in accepted: | |
| row=dict(row) | |
| row['instruction']=row['instruction'].replace('Return complete Python code only, no more than 14 lines.','Return a complete Python function with a brief docstring. Return code only.').replace('65–95 word story','short story') | |
| try:row['response']=clean_response(row['category'],row['response']) | |
| except Exception:continue | |
| if row['category']=='safety_alignment':continue | |
| if validate(row['category'],row['response'],True,row['instruction']):continue | |
| row['id']=hashlib.sha256((row['category']+'\n'+row['instruction']+'\n'+row['response']).encode()).hexdigest() | |
| cleaned.append(row) | |
| accepted=cleaned | |
| # Reset seen to existing published texts, then globally deduplicate cleaned examples. | |
| seen=set() | |
| for split,ds in load_dataset(REPO,'default',revision='7bfda45f997ea6aac1ed930cc4a1ba8a0e799c08').items(): | |
| for row in ds:seen.update([normalize(row['source_text']),normalize(row['target_text'])]) | |
| for _,row in old:seen.update([normalize(row['instruction']),normalize(row['response'])]) | |
| unique=[] | |
| for row in accepted: | |
| a,b=normalize(row['instruction']),normalize(row['response']) | |
| if a in seen or b in seen:continue | |
| seen.update([a,b]);unique.append(row) | |
| accepted=unique;counts=collections.Counter(r['category'] for r in accepted);coding_checks=counts['coding'] | |
| print('CLEANED_RESUME',dict(counts),flush=True) | |
| for category in ['coding','stories','sentences','safety_alignment']: | |
| if category=='safety_alignment': | |
| del model;gc.collect();torch.cuda.empty_cache() | |
| MODEL='Qwen/Qwen2.5-7B-Instruct';revision=api.model_info(MODEL).sha | |
| tok=AutoTokenizer.from_pretrained(MODEL,revision=revision);tok.padding_side='left';tok.pad_token=tok.eos_token | |
| model=AutoModelForCausalLM.from_pretrained(MODEL,revision=revision,torch_dtype=torch.bfloat16,device_map={'':'cuda'},attn_implementation='sdpa').eval() | |
| batch_size=64 | |
| print('SAFETY_MODEL',MODEL,revision,flush=True) | |
| pool=make_pool(category);cursor=0 | |
| max_tokens={'coding':320,'stories':256,'sentences':160,'safety_alignment':224}[category] | |
| while counts[category]<2500: | |
| if time.monotonic()-started>4700:raise TimeoutError('Generation budget reached; accepted examples preserved in candidate branch') | |
| batch=[] | |
| while len(batch)<batch_size and cursor<len(pool): | |
| prompt=pool[cursor];cursor+=1 | |
| if normalize(prompt.replace('65–95 word story','short story').replace(' in 45–80 words','')) not in seen:batch.append(prompt) | |
| if not batch:raise RuntimeError('Candidate prompt pool exhausted '+category) | |
| prompts=[tok.apply_chat_template([{'role':'system','content':system + ('\nMandatory factual guidance: '+guidance(p)[1]+' Preserve this safety position and do not add conflicting advice. Keep the answer under 80 words.' if category=='safety_alignment' and guidance(p) else '')},{'role':'user','content':p}],tokenize=False,add_generation_prompt=True) for p in batch] | |
| inputs=tok(prompts,return_tensors='pt',padding=True,truncation=True,max_length=512).to('cuda') | |
| try: | |
| with torch.inference_mode():outputs=model.generate(**inputs,max_new_tokens=max_tokens,do_sample=True,temperature=(0.45 if category=='safety_alignment' else 0.85),top_p=0.95,repetition_penalty=1.05,pad_token_id=tok.pad_token_id,eos_token_id=tok.eos_token_id) | |
| except torch.cuda.OutOfMemoryError: | |
| del inputs;gc.collect();torch.cuda.empty_cache();cursor-=len(batch);batch_size//=2 | |
| if batch_size<16:raise | |
| print('REDUCED_BATCH',batch_size,flush=True);continue | |
| for prompt,output in zip(batch,outputs): | |
| ids=output[inputs['input_ids'].shape[1]:].tolist() | |
| finished=tok.eos_token_id in ids or len(ids)<max_tokens | |
| response=tok.decode(ids,skip_special_tokens=True).strip() | |
| try:response=clean_response(category,response) | |
| except Exception:reject['invalid_python']+=1;continue | |
| reason=validate(category,response,finished,prompt) | |
| if reason:reject[reason]+=1;continue | |
| prompt=prompt.replace('65–95 word story','short story').replace(' in 45–80 words','') | |
| a,b=normalize(prompt),normalize(response) | |
| if a in seen or b in seen or a==b:reject['duplicate']+=1;continue | |
| seen.update([a,b]) | |
| uid=hashlib.sha256((category+'\n'+prompt+'\n'+response).encode()).hexdigest() | |
| row={'id':uid,'category':category,'instruction':prompt,'response':response,'provenance':'New AI-authored example generated for SEE7; '+MODEL+'@'+revision,'language':'en'} | |
| accepted.append(row);counts[category]+=1 | |
| if category=='coding':coding_checks+=1 | |
| if counts[category]==2500:break | |
| (out/'accepted.jsonl').write_text('\n'.join(json.dumps(r,ensure_ascii=False) for r in accepted)+'\n') | |
| progress={'accepted':len(accepted),'categories':dict(counts),'rejected':dict(reject),'elapsed_seconds':round(time.monotonic()-started,1),'peak_gpu_gb':round(torch.cuda.max_memory_allocated()/1e9,2)} | |
| (out/'progress.json').write_text(json.dumps(progress,indent=2)) | |
| print('PROGRESS',json.dumps(progress),flush=True) | |
| if len(accepted)//500 != (len(accepted)-len(batch))//500: | |
| api.upload_file(repo_id=REPO,repo_type='dataset',revision='original-10k-candidate',path_or_fileobj=str(out/'accepted.jsonl'),path_in_repo='generation/accepted.jsonl',commit_message='Checkpoint accepted original examples') | |
| assert len(accepted)==10000 and all(counts[k]==2500 for k in ['coding','stories','sentences','safety_alignment']) | |
| splits={'train':[],'validation':[],'test':[]} | |
| for split,row in old:splits[split].append(row) | |
| for category in counts: | |
| rows=[r for r in accepted if r['category']==category];rng.shuffle(rows) | |
| for i,row in enumerate(rows):splits['train' if i<2250 else 'validation' if i<2375 else 'test'].append(row) | |
| (out/'original').mkdir(exist_ok=True) | |
| for split,rows in splits.items():Dataset.from_list(rows).shuffle(seed=42).to_parquet(str(out/'original'/f'{split}.parquet')) | |
| allrows=[r for rows in splits.values() for r in rows] | |
| (out/'original_examples.jsonl').write_text('\n'.join(json.dumps(r,ensure_ascii=False) for r in allrows)+'\n') | |
| report={'new_examples':10000,'existing_original_examples':32,'original_total':10032,'translation_examples':5000,'repository_total':15032,'categories_new':dict(counts),'splits_original':{s:len(r) for s,r in splits.items()},'coding_syntax_checks_passed':coding_checks,'duplicate_normalized_new_instructions_or_responses':0,'rejected':dict(reject),'generator_models':{'coding_stories_sentences':'Qwen/Qwen2.5-1.5B-Instruct','safety_alignment':MODEL},'safety_generator_revision':revision,'temperature':0.85,'top_p':0.95,'seed':20261113,'elapsed_seconds':time.monotonic()-started,'coding_validation':'Implementation extracted, top-level usage removed, docstrings shortened; AST parsing, compilation, undefined-name and completeness checks; code not executed','sha256':{p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in (out/'original').glob('*.parquet')}} | |
| (out/'original_validation.json').write_text(json.dumps(report,indent=2)) | |
| (out/'generate_original.py').write_text(Path(__file__).read_text()) | |
| (out/'safety_guidance.json').write_text(json.dumps(safety_rules,indent=2)) | |
| readme=Path(hf_hub_download(REPO,'README.md',repo_type='dataset',revision='7bfda45f997ea6aac1ed930cc4a1ba8a0e799c08')).read_text() | |
| readme=re.sub(r'\*\*5,032 examples:.*?examples\.', '**15,032 examples:** 5,000 sourced translation pairs and 10,032 original AI-authored instruction-response examples.',readme,count=1) | |
| readme=readme.replace('size_categories:\n- 1K<n<10K','size_categories:\n- 10K<n<100K') | |
| readme=readme.split('## Original examples')[0]+'''## Original examples — configuration: original | |
| 10,000 newly generated examples have been added to the original 32: 2,508 coding, 2,508 short stories, 2,508 sentence exercises and 2,508 safety-alignment examples. | |
| | Category | Train | Validation | Test | Total | | |
| | --- | ---: | ---: | ---: | ---: | | |
| | Coding | 2,256 | 126 | 126 | 2,508 | | |
| | Stories | 2,256 | 126 | 126 | 2,508 | | |
| | Sentences | 2,256 | 126 | 126 | 2,508 | | |
| | Safety alignment | 2,256 | 126 | 126 | 2,508 | | |
| | **Original total** | **9,024** | **504** | **504** | **10,032** | | |
| Safety responses are generated from explicit authored safety guidance and checked for required safety positions. The guidance is published in safety_guidance.json.\n\nThe new coding, stories and sentence content was generated specifically for SEE7 with Qwen2.5-1.5B-Instruct; safety responses use Qwen2.5-7B-Instruct. Generation uses using authored task, subject, setting and style combinations. No additional external example dataset was imported. Provenance is recorded in each row. The original translation pairs remain attributed to OPUS-100. | |
| Every new instruction and response passed normalized exact-duplicate checks against the existing dataset and all accepted new content. Truncated responses, placeholder patterns, incomplete code and malformed Python were rejected. The 2,500 new coding answers passed AST parsing and compilation checks. The original eight coding examples retain their recorded execution tests. | |
| Use the original configuration to browse the additions. original_examples.jsonl contains all 10,032 instruction-response records. original_validation.json records generation settings, counts, rejection reasons, validation methods and file checksums. | |
| ```python | |
| from datasets import load_dataset | |
| original = load_dataset("SEE7/AstheralDataset", "original") | |
| translations = load_dataset("SEE7/AstheralDataset", "default") | |
| ``` | |
| ''' | |
| (out/'README.md').write_text(readme) | |
| api.upload_folder(repo_id=REPO,repo_type='dataset',folder_path=str(out),allow_patterns=['original/**','original_examples.jsonl','original_validation.json','generate_original.py','safety_guidance.json','README.md'],commit_message='Add 10000 new original examples across coding, stories, sentences and safety alignment') | |
| published=load_dataset(REPO,'original') | |
| assert {k:len(v) for k,v in published.items()}=={'train':9024,'validation':504,'test':504} | |
| print('TEN_THOUSAND_PUBLISHED',json.dumps(report),flush=True) | |