Auroraventures commited on
Commit
b1489f9
·
verified ·
1 Parent(s): e77e8d8

Upload quickgen.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. quickgen.py +11 -10
quickgen.py CHANGED
@@ -1,15 +1,16 @@
1
- """Generate 3 Awwwards-quality website examples with Cipher SFT."""
2
  import torch, re, os
3
- from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
- print("[1/4] Loading tokenizer...", flush=True)
6
- tok = AutoTokenizer.from_pretrained("/content/cipher-sft-merged")
7
- print("[2/4] Loading model (60GB - takes ~2min)...", flush=True)
8
- m = AutoModelForCausalLM.from_pretrained(
9
- "/content/cipher-sft-merged",
10
- torch_dtype=torch.bfloat16,
11
- device_map="auto",
12
  )
 
 
13
 
14
  PROMPTS = {
15
  "01-hero-particles": "Build a complete single-file HTML page with a stunning hero section featuring a Three.js particle system that responds to mouse movement. Include CDN imports for Three.js (use https://unpkg.com/three@0.160.0/build/three.module.js with importmap). Use GSAP from CDN for the headline entrance animation. Style with custom CSS - dark theme with bioluminescent blue/purple accents (#9bf, #a4f). Include a headline 'Cipher.ai' and subheadline 'The Code Kraken sees what others miss.' Make it Awwwards-quality. Output ONLY the complete HTML, nothing else.",
@@ -30,7 +31,7 @@ for name, prompt in PROMPTS.items():
30
  msgs, tokenize=True, add_generation_prompt=True, return_tensors="pt"
31
  ).to("cuda")
32
  with torch.no_grad():
33
- out = m.generate(
34
  inputs, max_new_tokens=4096, do_sample=True,
35
  temperature=0.7, top_p=0.9, repetition_penalty=1.05,
36
  pad_token_id=tok.eos_token_id,
 
1
+ """Generate 3 Awwwards-quality website examples with Cipher SFT (via Unsloth)."""
2
  import torch, re, os
3
+ from unsloth import FastLanguageModel
4
 
5
+ print("[1/4] Loading model with Unsloth (60GB - takes ~2min)...", flush=True)
6
+ model, tok = FastLanguageModel.from_pretrained(
7
+ model_name="/content/cipher-sft-merged",
8
+ max_seq_length=8192,
9
+ load_in_4bit=True,
10
+ dtype=None,
 
11
  )
12
+ FastLanguageModel.for_inference(model)
13
+ print("[2/4] Model ready.", flush=True)
14
 
15
  PROMPTS = {
16
  "01-hero-particles": "Build a complete single-file HTML page with a stunning hero section featuring a Three.js particle system that responds to mouse movement. Include CDN imports for Three.js (use https://unpkg.com/three@0.160.0/build/three.module.js with importmap). Use GSAP from CDN for the headline entrance animation. Style with custom CSS - dark theme with bioluminescent blue/purple accents (#9bf, #a4f). Include a headline 'Cipher.ai' and subheadline 'The Code Kraken sees what others miss.' Make it Awwwards-quality. Output ONLY the complete HTML, nothing else.",
 
31
  msgs, tokenize=True, add_generation_prompt=True, return_tensors="pt"
32
  ).to("cuda")
33
  with torch.no_grad():
34
+ out = model.generate(
35
  inputs, max_new_tokens=4096, do_sample=True,
36
  temperature=0.7, top_p=0.9, repetition_penalty=1.05,
37
  pad_token_id=tok.eos_token_id,