Yhhxhfh commited on
Commit
2ed9d6c
1 Parent(s): f011203

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -42,16 +42,17 @@ class ModelManager:
42
 
43
  models = []
44
  for config in model_configs:
45
- with tempfile.TemporaryDirectory() as tmpdir:
46
- model_path = os.path.join(tmpdir, config['filename'])
47
  download_url = f"https://huggingface.co/{config['repo_id']}/resolve/main/{config['filename']}"
48
  response = requests.get(download_url, headers={"Authorization": f"Bearer {HUGGINGFACE_TOKEN}"})
49
- with open(model_path, 'wb') as f:
50
- f.write(response.content)
51
- model = Llama(model_path=model_path, **self.params)
 
52
  models.append(model)
53
 
54
- self.params["tokens"] = models[0].tokenize(b"Hello")
 
55
  self.unified_model = models[0]
56
  return self.unified_model
57
 
 
42
 
43
  models = []
44
  for config in model_configs:
45
+ with BytesIO() as model_data:
 
46
  download_url = f"https://huggingface.co/{config['repo_id']}/resolve/main/{config['filename']}"
47
  response = requests.get(download_url, headers={"Authorization": f"Bearer {HUGGINGFACE_TOKEN}"})
48
+ model_data.write(response.content)
49
+ model_data.seek(0)
50
+
51
+ model = Llama(model_path=" ", model_data=model_data.read(), **self.params)
52
  models.append(model)
53
 
54
+ self.params["tokens"] = models[0].tokenize(b"Hello")
55
+
56
  self.unified_model = models[0]
57
  return self.unified_model
58