Skip to content

Commit 3f9be25

Browse files
committed
Add gist model generation utils
1 parent 037205c commit 3f9be25

16 files changed

+211
-186
lines changed

generate.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import itertools
77
import sys
88
import time
9+
import json
910
from pathlib import Path
1011
from typing import Optional
1112

@@ -256,8 +257,8 @@ def callback(x):
256257
parser.add_argument(
257258
"--prompt",
258259
type=str,
259-
default="long_prompt_short_output.txt",
260-
help="Input prompt. If it ends in .txt, we will load the prompt from the ./prompts dir.",
260+
default="long_prompt_short_output.json",
261+
help="Input prompt. If it ends in .json, we will load the prompt from the ./prompts dir.",
261262
)
262263

263264
parser.add_argument(
@@ -283,7 +284,7 @@ def callback(x):
283284
"--checkpoint_path",
284285
type=Path,
285286
default=Path(__file__).resolve().parent
286-
/ "checkpoints/meta-llama/Meta-Llama-3-8B-Instruct/model.pth",
287+
/ "checkpoints/meta-Transformer/Transformer-2-7b-chat-hf/model.pth",
287288
help="Model checkpoint path.",
288289
)
289290
parser.add_argument(
@@ -312,10 +313,10 @@ def callback(x):
312313

313314
args = parser.parse_args()
314315

315-
if args.prompt.endswith(".txt"):
316+
if args.prompt.endswith(".json"):
316317
prompt_fn = Path(__file__).resolve().parent / "prompts" / args.prompt
317318
with open(prompt_fn) as fd:
318-
args.prompt = fd.read().strip()
319+
args.prompt = json.load(fd)
319320

320321
cache_compatibility(args)
321322

@@ -335,3 +336,4 @@ def callback(x):
335336
args.device,
336337
cache_kwargs=vars(args),
337338
)
339+

model.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,36 @@ def from_name(cls, name: str):
139139
attention_bias=True,
140140
norm_eps=1e-6,
141141
),
142+
"Meta-Llama-3-8B-gist-finetune-instruction-and-input": dict(
143+
block_size=8192,
144+
n_layer=32,
145+
n_head=32,
146+
n_local_heads=8,
147+
dim=4096,
148+
intermediate_size=14336,
149+
vocab_size=128257,
150+
rope_base=500000
151+
),
152+
"Meta-Llama-3-8B-gist-finetune-instruction-only": dict(
153+
block_size=8192,
154+
n_layer=32,
155+
n_head=32,
156+
n_local_heads=8,
157+
dim=4096,
158+
intermediate_size=14336,
159+
vocab_size=128257,
160+
rope_base=500000
161+
),
162+
"Meta-Llama-3-8B-gist-finetune-input-only": dict(
163+
block_size=8192,
164+
n_layer=32,
165+
n_head=32,
166+
n_local_heads=8,
167+
dim=4096,
168+
intermediate_size=14336,
169+
vocab_size=128257,
170+
rope_base=500000
171+
),
142172
}
143173

144174

prompts/long_prompt_long_output.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"instruction": "You are an architect tasked with drawing up plans for a modern residential house.\n\nArchitectural Plan Creation Instructions\n\nObjective:\nCreate a comprehensive set of architectural plans for a modern residential house. The plans should include detailed layouts, elevations, sections, and necessary annotations to guide the construction process. The design should focus on functionality, aesthetics, sustainability, and compliance with local building codes.\n\nRequirements:\n\nGeneral Layout:\n\nTotal area: Approximately 2,500 square feet.\nNumber of floors: Two.\nNumber of bedrooms: Four (including a master suite).\nNumber of bathrooms: Three full bathrooms and one half bathroom.\nCommon areas: Open-plan kitchen, dining area, living room, and a study/office.\nAdditional spaces: Laundry room, garage (for two cars), storage rooms, and a small basement.\nSite Plan:\n\nInclude property boundaries, adjacent streets, and any existing structures.\nShow the placement of the house, driveway, pathways, garden, and outdoor living spaces (e.g., patio, deck).\nInclude landscaping elements like trees, shrubs, and lawn areas.\nFloor Plans:\n\nGround Floor: Include entryway, living spaces, kitchen, one bedroom (guest room), one full bathroom, and access to the garage.\nSecond Floor: Include master suite with attached bathroom and walk-in closet, two additional bedrooms, one full bathroom, and a study/office.\nIndicate all door and window placements, furniture layouts, and circulation paths.\nElevations:\n\nProvide front, rear, and side elevations.\nShow the external appearance, including the roof design, facade materials, window and door placements, and any architectural features (e.g., balconies, porches).\nSections:\n\nInclude at least two sections (one longitudinal and one cross-sectional) showing internal details.\nHighlight the relationship between different floors and ceiling heights.\nShow structural elements like beams, columns, and floor slabs.\nRoof Plan:\n\nIndicate the roof slope, materials, drainage system, and any roof features (e.g., skylights, chimneys).\nElectrical and Plumbing Plans:\n\nShow the layout of electrical outlets, switches, lighting fixtures, and major appliances.\nInclude the plumbing layout for water supply and drainage, showing the location of pipes, fixtures, and connections.\nMaterials and Finishes:\n\nSpecify the materials for walls, floors, ceilings, and roofs.\nInclude details on interior and exterior finishes (e.g., paint, tiles, cladding).\nSustainability Features:\n\nIncorporate energy-efficient systems (e.g., HVAC, solar panels).\nUse sustainable building materials.\nPlan for natural lighting and ventilation.\nInclude rainwater harvesting and greywater recycling systems if possible.\nCompliance:\n\nEnsure the design complies with local building codes and regulations.\nInclude necessary annotations and notes for construction guidelines.\n\n",
3+
"input": "You must return the following:\n- Include a detailed list of materials and specifications.\n- Add a cover sheet with project title, address, date, and designer's name.\n- Add a sheet for each component with detailed plans.\n- Ensure all documents are clearly labeled and organized."
4+
}

prompts/long_prompt_long_output.txt

Lines changed: 0 additions & 63 deletions
This file was deleted.

prompts/long_prompt_short_output.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"instruction": "Carefully read the beginning of the Wikipedia page on the Guggenheim museum. You will be asked to answer a question at the end.\n\n ### Introduction The Solomon R. Guggenheim Museum, often referred to as The Guggenheim, is an art museum at 1071 Fifth Avenue between 88th and 89th Streets on the Upper East Side of Manhattan in New York City. It hosts a permanent collection of Impressionist, Post-Impressionist, early Modern, and contemporary art and also features special exhibitions throughout the year. It was established by the Solomon R. Guggenheim Foundation in 1939 as the Museum of Non-Objective Painting, under the guidance of its first director, Hilla von Rebay. The museum adopted its current name in 1952, three years after the death of its founder Solomon R. Guggenheim. It continues to be operated and owned by the Solomon R. Guggenheim Foundation. The museum's building, a landmark work of 20th-century architecture designed by Frank Lloyd Wright, drew controversy for the unusual shape of its display spaces and took 15 years to design and build; it was completed in 1959. It consists of a six-story, bowl-shaped main gallery to the south, a four-story \"monitor\" to the north, and a ten-story annex to the northeast. A six-story helical ramp extends along the main gallery's perimeter, under a central ceiling skylight. The Thannhauser Collection is housed within the top three stories of the monitor, and there are additional galleries in the annex and a learning center in the basement. The museum building's design was controversial when it was completed but was widely praised afterward. The building underwent extensive renovations from 1990 to 1992, when the annex was built, and it was renovated again from 2005 to 2008. The museum's collection has grown over the decades and is founded upon several important private collections, including those of Guggenheim, Karl Nierendorf, Katherine Sophie Dreier, Justin Thannhauser, Rebay, Giuseppe Panza, Robert Mapplethorpe, and the Bohen Foundation. The collection, which includes around 8,000 works as of 2022, is shared with sister museums in Bilbao, Spain, and Venice, Italy. In 2023, nearly 861,000 people visited the museum. # History ## Early years and Hilla Rebay Solomon R. Guggenheim, a member of a wealthy mining family, began collecting works of the old masters in the 1890s. In 1926, he met artist Hilla von Rebay, who introduced him to European avant-garde art, in particular abstract art that she felt had a spiritual and utopian aspect (non-objective art). Guggenheim completely changed his collecting strategy, turning to the work of Wassily Kandinsky, among others. He began to display his collection to the public at his apartment in the Plaza Hotel in New York City. Guggenheim and Rebay initially considered building a museum at Rockefeller Center in Manhattan. As the collection grew, Guggenheim established the Solomon R. Guggenheim Foundation, in 1937, to foster the appreciation of modern art. The foundation's first venue, the Museum of Non-Objective Painting, opened in 1939, under Rebay's direction, at 24 East 54th Street in midtown Manhattan. Under her guidance, Guggenheim sought to include in the collection the most important examples of non-objective art by early modernists. He wanted to display the collection at the 1939 New York World's Fair in Queens, but Rebay advocated for a more permanent location in Manhattan. By the early 1940s, the foundation had accumulated such a large collection of avant-garde paintings that the need for a permanent museum was apparent, and Rebay wanted to establish it before Guggenheim died. ## Design process In 1943, Rebay and Guggenheim wrote a letter to Frank Lloyd Wright asking him to design a structure to house and display the collection. Rebay thought the 76-year-old Wright was dead, but Guggenheim's wife Irene Rothschild Guggenheim knew better and suggested that Rebay contact him. Wright accepted the opportunity to experiment with his \"organic\" style in an urban setting, saying that he had never seen a museum that was \"properly designed\". He was hired to design the building in June 1943. He was to receive a 10 percent commission on the project, which was expected to cost at least $1 million. It took him 15 years, more than 700 sketches, and six sets of working drawings to create and complete the museum, after a series of difficulties and delays; the cost eventually doubled from the initial estimate. Rebay envisioned a space that would facilitate a new way of seeing modern art. She wrote Wright that \"each of these great masterpieces should be organized into space, and only you ... would test the possibilities to do so. ... I want a temple of spirit, a monument!\" Critic Paul Goldberger later wrote that Wright's modernist building was a catalyst for change, making it \"socially and culturally acceptable for an architect to design a highly expressive, intensely personal museum. In this sense almost every museum of our time is a child of the Guggenheim.\" The Guggenheim is the only museum Wright designed; its urban location required him to design it in a vertical rather than horizontal form, far different from his earlier, rural works. Since he was not licensed as an architect in New York, he relied on Arthur Cort Holden, of the architectural firm Holden, McLaughlin & Associates, to deal with New York City's Board of Standards and Appeals. From 1943 to early 1944, Wright produced four differing designs. One had a hexagonal shape and level floors for the galleries, though all the others had circular schemes and used a ramp continuing around the building. In his notes, he indicated that he wanted a \"well proportioned floor space from bottom to top—a wheel chair going around and up and down\". His original concept was called an inverted \"ziggurat\", because it resembled the steep steps on the ziggurats built in ancient Mesopotamia. Several architecture professors have speculated that the helical ramp and glass dome of Giuseppe Momo's 1932 staircase at the Vatican Museums was an inspiration for Wright's ramp and atrium.",
3+
"input": "Question: Which is the largest number? A) Frank Lloyd Wright's age in 1943. B) The size of the collection at the Guggenheim. C) The building number of the museum's first venue. D) The number of sketches it took Frank Lloyd Wright to create the museum."
4+
}

0 commit comments

Comments
 (0)