Skip to content

Commit

Permalink
feat(examples): update setting to run demo (#968)
Browse files Browse the repository at this point in the history
* update to run demo

* update retriever

* update

* fix pre-commit

* update readme
  • Loading branch information
lwaekfjlk authored Dec 31, 2024
1 parent a4f4fa1 commit 351bffb
Show file tree
Hide file tree
Showing 12 changed files with 963 additions and 1,217 deletions.
4 changes: 2 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# openai keys
OPENAI_API_KEY="xxx"
OPENAI_API_KEY="sk-xxxxx"

# local storage
DATABASE_FOLDER_PATH="xxx"
DATABASE_FOLDER_PATH="./data"
5 changes: 2 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
通过 `pypi` 安装 `research-town`

```bash
pip install research-town
pip install research-town
```

### 虚拟环境安装
Expand All @@ -50,7 +50,7 @@ curl -sSL https://install.python-poetry.org | python3
1.`.env.template` 文件复制到项目根目录,并命名为 `.env`
```bash
cp .env.template .env
```
```
2.`.env` 文件中填写所需的环境变量。

### 运行示例
Expand Down Expand Up @@ -114,4 +114,3 @@ pre-commit install
</picture>
</a>
</p>

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Use a virtual environment, e.g. with anaconda3:
conda create -n research-town python=3.10
conda activate research-town
curl -sSL https://install.python-poetry.org | python3
export PATH="$HOME/.local/bin:$PATH"
```

### Configure environment variables
Expand All @@ -66,6 +67,8 @@ cd examples
python research_town_demo.py
```

All generated research progress like ideas, proposals will be automatically saved in the database folder you set in the .env file.

## Developing

#### Develop Demo
Expand Down
77 changes: 0 additions & 77 deletions examples/research_eval_demo.py

This file was deleted.

1,912 changes: 951 additions & 961 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ lxml = "*"
tqdm = "*"
keybert = "*"
semanticscholar = "*"
torch = { version = ">=2.2.0, <2.3.0", optional = true }

socksio = "*"

torch = { version = ">=2.2.0, <2.3.0", optional = true }
uvicorn = { version = "*", optional = true }
fastapi = { version = "*", optional = true }
pandas = { version = "*", optional = true }
Expand Down
4 changes: 1 addition & 3 deletions research_town/dbs/db_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def add(self, data: T) -> None:
self.database_client.add(
self.data_class.__name__, [data.model_dump(exclude_none=True)], embeddings
)
logger.info(
f"Creating instance of '{data.__class__.__name__}': '{data.model_dump()}'"
)
logger.info(f"Creating instance of '{data.__class__.__name__}'")

def update(self, pk: str, updates: Dict[str, Any]) -> bool:
return self.database_client.update(self.data_class.__name__, pk, updates)
Expand Down
6 changes: 2 additions & 4 deletions research_town/utils/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

def get_embed(
instructions: List[str],
retriever_tokenizer: BertTokenizer = BertTokenizer.from_pretrained(
'facebook/contriever'
),
retriever_model: BertModel = BertModel.from_pretrained('facebook/contriever'),
retriever_tokenizer: BertTokenizer,
retriever_model: BertModel,
) -> List[torch.Tensor]:
encoded_input_all = [
retriever_tokenizer(text, return_tensors='pt', truncation=True, max_length=512)
Expand Down
59 changes: 0 additions & 59 deletions scripts/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions scripts/human_eval/human_eval_analysis.py

This file was deleted.

Empty file removed scripts/prompting_eval/.gitkeep
Empty file.
91 changes: 0 additions & 91 deletions scripts/prompting_eval/eval.py

This file was deleted.

0 comments on commit 351bffb

Please sign in to comment.